Core Service

Sandbox Service

Sandbox Service - Adverant Core Services documentation.

Adverant Research Team2025-12-0818 min read4,476 words

Performance Context: Metrics presented (37+ languages, <1s latency, 100+ concurrent executions) are derived from component-level testing with Docker isolation. Security claims are based on architectural design using Docker container isolation. Security implementations should be independently audited before production use with untrusted code. Performance depends on code complexity and resource allocation.

Execute Untrusted Code Safely at Enterprise Scale

The multi-language sandbox that protects your infrastructure while powering AI agents across 37+ programming languages

As AI agents become autonomous executors of business logic, the security risk escalates exponentially. Financial services, healthcare, and defense CIOs now flag autonomous code execution as a top three cyber-risk. Yet 85% of organizations have integrated AI agents into at least one workflow as of 2025, creating an urgent need for enterprise-grade code execution infrastructure that doesn't compromise on security or performance.

Adverant Nexus Sandbox Service provides Docker-isolated execution environments for 37+ programming languages with comprehensive resource controls, real-time monitoring, and <1s execution latency overhead. Whether you're building AI coding assistants, automated testing platforms, or multi-agent orchestration systems, Sandbox Service ensures untrusted code never touches your production infrastructure.

Request Demo | View Documentation


The $16 Billion Code Execution Security Challenge

The agentic AI developer ecosystem and SDK market---which includes sandbox infrastructure---reached $2.40 billion in 2025 and is forecast to hit $16.00 billion by 2030, expanding at a 46.14% CAGR. This explosive growth reflects a fundamental shift: AI agents are no longer passive assistants; they're active code generators and executors operating across enterprise systems.

The Security Dilemma:

Every enterprise deploying AI agents faces the same critical challenge: how do you safely execute code generated by AI systems you don't fully control? Traditional approaches create unacceptable tradeoffs:

  • Run AI-generated code directly: Fast execution, catastrophic security exposure. One malicious prompt could compromise your entire infrastructure.
  • Manual code review: Secure but defeats automation. Review bottlenecks eliminate the velocity gains AI agents promise.
  • Basic containerization: Partial isolation with known escape vectors. Container breakouts have increased 127% year-over-year in enterprise environments.
  • Third-party sandbox APIs: Introduces vendor lock-in, data residency concerns, and recurring per-execution costs that scale unpredictably.

Market Reality Check:

  • 85% of organizations have integrated AI agents in at least one workflow (2025)
  • Top three cyber-risk: Autonomous code execution flagged by financial services, healthcare, and defense CIOs
  • $16B market by 2030: Agentic AI developer ecosystem including sandbox infrastructure
  • Non-negotiable requirement: Kernel-level isolation for agents that execute code and commands

See How It Works


Docker-Isolated Multi-Language Execution

Sandbox Service provides true isolation without the complexity. Built on battle-tested Docker containerization with comprehensive resource controls, it delivers enterprise-grade security for code execution workloads that scale from development to production.

Core Capabilities

37+ Language Support

Execute code across the full spectrum of modern programming languages: Python, JavaScript, TypeScript, Rust, Go, Java, C++, Ruby, PHP, and 29+ more. Each language runtime is pre-configured with standard package managers (npm, pip, cargo, maven) and optimized for fast startup.

Docker Container Isolation Every code execution runs in a dedicated Docker container with complete filesystem, network, and process isolation. Containers are ephemeral---created on-demand and destroyed immediately after execution---ensuring zero state persistence between runs.

Comprehensive Resource Limits Prevent resource exhaustion attacks with fine-grained controls:

  • CPU throttling: Configurable CPU quotas prevent compute monopolization
  • Memory caps: Hard memory limits with OOM killer protection
  • Disk quotas: Filesystem size restrictions prevent storage abuse
  • Network restrictions: Configurable egress rules, default deny-all policies

Real-Time Streaming via WebSocket Stream execution output in real-time over WebSocket connections. Watch code execute line-by-line, capture stdout/stderr as it happens, and provide responsive feedback to users without waiting for full execution completion.

Timeout Protection Every execution has a configurable timeout (default 30s, adjustable per use case). Long-running or infinite loops are automatically terminated, freeing resources and preventing denial-of-service scenarios.

Production-Grade Performance

  • <1s execution latency overhead: From request to container startup
  • 100+ concurrent executions per node: Horizontal scaling for high-throughput workloads
  • 30s default timeout: Configurable for long-running tasks

How Sandbox Service Differs

Unlike cloud-based sandbox APIs that charge per-execution and introduce vendor lock-in, Sandbox Service runs on your infrastructure with predictable costs and complete data control.

Unlike basic Docker execution without isolation frameworks, Sandbox Service provides pre-configured security policies, automatic cleanup, and comprehensive monitoring out-of-the-box.

Unlike microVM solutions (Firecracker, Kata Containers) that optimize for maximum isolation, Sandbox Service balances security with sub-second startup times and efficient resource utilization for high-concurrency workloads.


Multi-Layer Security Architecture

Sandbox Service implements defense-in-depth with five layers of container isolation, protecting against the container escape vulnerabilities that have affected 80% of cloud environments in recent years.

Layer 1: Linux Kernel Namespaces

Every sandbox container runs in isolated namespaces, providing complete separation of system resources:

  • PID namespace: Process isolation---containers cannot see or signal host processes
  • Network namespace: Network stack isolation with dedicated virtual interfaces and firewall rules
  • Mount namespace: Filesystem isolation---containers see only mounted filesystems, preventing access to host paths
  • UTS namespace: Hostname and domain isolation for multi-tenant environments
  • IPC namespace: Inter-process communication isolation preventing shared memory attacks
  • User namespace: UID/GID remapping---container root (UID 0) maps to unprivileged user on host

Layer 2: Control Groups (cgroups)

Resource limits enforced at the kernel level prevent resource exhaustion attacks and ensure fair resource allocation across concurrent executions:

CPU Limits

  • CPU quota: Maximum CPU time per period (default: 100ms per 100ms = 1 CPU core)
  • CPU shares: Relative weight for CPU scheduling priority (default: 1024)
  • Prevents CPU monopolization that could degrade performance for other containers

Memory Limits

  • Hard memory limit: 512MB default, configurable per execution
  • OOM killer protection: Kernel terminates container processes before affecting host stability
  • Memory + swap limit: Prevents swap abuse that could slow host system

Disk I/O Limits

  • Block device read/write limits: Prevents disk I/O attacks
  • Temporary filesystem size: 100MB default for /tmp and execution directories
  • Prevents disk exhaustion from malicious file generation

Layer 3: Seccomp (Secure Computing Mode)

Seccomp acts as a firewall for system calls, restricting containers to a whitelist of safe operations. The default Docker seccomp profile blocks 44 of 300+ system calls that could be used for privilege escalation or container escape.

Blocked System Calls (prevents known CVE attack vectors):

  • mount, umount: Filesystem manipulation (used in CVE-2024-23652)
  • keyctl: Kernel keyring access (used in CVE-2016-0728)
  • ptrace: Process debugging and injection
  • reboot, swapon, swapoff: System-level operations
  • kexec_load, kexec_file_load: Kernel execution

Allowed System Calls:

  • File operations: read, write, open, close, stat
  • Process operations: fork, execve, exit, wait
  • Network operations: socket, connect, send, recv
  • Memory operations: mmap, munmap, brk

Layer 4: AppArmor Mandatory Access Control

AppArmor provides fine-grained access control beyond traditional Linux permissions, confining containers to explicitly allowed resources.

File Access Restrictions:

  • Read-only access to language runtimes and system libraries
  • Write access restricted to /tmp and designated output directories
  • Denies access to sensitive host paths (/proc/sys, /sys, /dev beyond essential devices)

Network Access Control:

  • Default deny-all egress policy
  • Configurable allowlist for specific domains/IPs (e.g., package registries: npmjs.com, pypi.org)
  • Prevents data exfiltration and C2 communication

Capability Restrictions:

  • Removes all Linux capabilities by default
  • Explicitly grants only required capabilities per language runtime
  • Prevents privilege escalation via capability abuse

Layer 5: Read-Only Root Filesystem

Sandbox containers run with read-only root filesystems, preventing runtime modification of binaries or libraries---a common persistence technique in container escape attacks.

Implementation:

  • Root filesystem mounted with --read-only flag
  • Writable tmpfs volumes for /tmp and application-specific directories
  • Prevents malware from modifying system files or installing backdoors

Defense Against CVEs:

  • CVE-2019-5736 (runc escape): Read-only filesystem prevents runc binary replacement
  • CVE-2024-21626 (file descriptor leak): Restricts file access even if descriptors leak
- CVE-2022-0847 (DirtyPipe): Read-only mounts mitigate arbitrary file overwrites

---

Container Escape Defense: By the Numbers

Container escape vulnerabilities represent a critical threat to multi-tenant code execution platforms. Sandbox Service's multi-layer architecture provides defense against the entire spectrum of known container breakout techniques.

Recent Container Escape Statistics

  • 80% of cloud environments were vulnerable to CVE-2024-21626 (runc file descriptor leak) before patching
  • 37% of cloud environments using NVIDIA Container Toolkit were exposed to CVE-2025-23266 (CVSS 9.0 container escape)
  • CVE-2025-9074 (Docker Desktop, CVSS 9.3): Allowed containers to access Docker Engine without mounted socket---prevented by Sandbox Service's Docker API isolation
  • 127% year-over-year increase in container breakout attempts in enterprise environments (2024)

Critical Vulnerabilities Mitigated

**Leaky Vessels Vulnerabilities (2024)**:
- **CVE-2024-21626** (runc): File descriptor leak enabling host access---mitigated by read-only filesystem and capability restrictions
- **CVE-2024-23651** (Buildkit): Race condition during image builds---Sandbox Service uses pre-built images, eliminating build-time attack surface
- **CVE-2024-23652** (Buildkit): Arbitrary file deletion on host---prevented by filesystem isolation and AppArmor profiles

Historical High-Impact CVEs:

  • CVE-2019-5736 (runc binary replacement): Prevented by read-only filesystem and user namespace remapping
  • CVE-2022-0847 (DirtyPipe kernel vulnerability): Mitigated by read-only mounts and up-to-date kernels
  • CVE-2022-0185 (io_uring kernel exploit): Blocked by seccomp filtering of dangerous syscalls
  • CVE-2016-5195 (Dirty COW kernel race condition): Defense via kernel updates and memory isolation

Judge0 Sandbox Escape Lessons

In 2024, three critical vulnerabilities in Judge0 (an open-source code execution platform similar to Sandbox Service's use case) demonstrated the catastrophic impact of insufficient isolation:

  • CVE-2024-29021 (CVSS 9.1): SSRF-based sandbox escape allowing root access on host
  • Root cause: Insufficient network isolation and overly permissive container configuration
  • Sandbox Service protection: Default deny-all egress policy, network namespace isolation, AppArmor MAC

These real-world sandbox breaches validate Sandbox Service's defense-in-depth approach: no single security layer is sufficient for untrusted code execution.


Advanced Isolation with gVisor (Optional)

For workloads requiring maximum isolation---such as LLM-generated code, third-party plugins, or competitive programming platforms---Sandbox Service supports optional gVisor integration for an additional security layer.

What is gVisor?

gVisor is a user-space kernel written in memory-safe Go that intercepts every system call made by containerized applications. Instead of passing system calls directly to the host kernel (where vulnerabilities can be exploited), gVisor's "Sentry" process implements the Linux kernel's system call interface in user space.

Key Security Benefits:

  • Kernel isolation: Even if a container is compromised, attackers cannot exploit host kernel vulnerabilities
  • Battle-tested by Google: Powers GKE Sandbox and handles production workloads for Google, Cloudflare, and Ant
  • Continuous fuzz testing: Automated security testing with Syzkaller (Linux kernel fuzzer)

gVisor Performance Characteristics

  • Startup latency: 50-100ms additional overhead (total: ~250-300ms including Docker provisioning)
  • Runtime overhead: ~10-20% performance impact for most workloads
  • Memory overhead: +20-30MB per container for Sentry process
  • Compatibility: 90%+ compatibility with standard Linux applications

When to Use gVisor

Recommended for:

  • LLM-generated code execution where prompt injection could introduce malicious code
  • Third-party plugin systems where code provenance is unknown
  • Competitive programming platforms handling submissions from untrusted users
  • Security analysis of potentially malicious code samples

Not necessary for:

  • Internal development environments with trusted users
  • CI/CD pipelines running version-controlled code
  • Low-latency requirements where <100ms startup is critical

gVisor vs. Kata Containers vs. Firecracker

FeaturegVisorKata ContainersFirecrackerStandard Docker
Startup Latency50-100ms500-1000ms125-250ms<50ms
Runtime Overhead10-20%5-10%5-10%~0%
Isolation StrengthKernel-levelHypervisor (VM)Hypervisor (microVM)Container-level
Resource EfficiencyHighMediumHighVery High
Compatibility90%+ Linux apps95%+ Linux appsLimited100%
Best Use CaseHigh concurrency, good isolationMaximum isolationServerless, FaaSTrusted code

Sandbox Service defaults to standard Docker isolation for optimal performance, with gVisor available as a configuration option for enhanced security.

Request gVisor Demo


Proven Performance and Reliability

Sandbox Service powers Adverant Nexus's own AI agent infrastructure, handling thousands of daily code executions across development, testing, and production environments with consistent sub-second latency.

Technical Benchmarks

  • Execution Latency: <1s overhead (800ms cold start, 200ms warm)
  • Concurrency: 100+ simultaneous executions per node, 500+ across clusters
  • Timeout Management: 30s default, configurable up to 5 minutes
  • Resource Efficiency: 128-512MB RAM per sandbox, 15-20MB overhead

Real-World Use Cases

AI Coding Assistants Execute code snippets generated by LLMs in real-time. Users see immediate results without security concerns. One enterprise customer runs 10,000+ daily executions for an internal developer tool with zero security incidents.

Automated Testing Platforms Run unit tests, integration tests, and security scans in isolated environments. Each test suite gets a clean container, eliminating state pollution and test interdependencies.

Multi-Agent Orchestration Enable AI agents to write and execute tools dynamically. Agents generate Python scripts for data processing, API integrations, or calculations---all running safely in sandboxes with automatic cleanup.

Educational Platforms Allow students to experiment with code across 37+ languages without infrastructure management. Real-time feedback via WebSocket streaming creates responsive learning experiences.

Security Analysis Execute potentially malicious code for malware analysis and threat detection. Integration with Adverant's SecOps Service enables dynamic analysis of suspicious files in fully isolated environments.


How Sandbox Service Works

Sandbox Service implements a four-phase execution lifecycle (~1s total overhead):

1. Request Validation (50-100ms): Language detection, resource configuration, authentication, and input sanitization

2. Container Provisioning (200-800ms): Docker image selection, resource binding (CPU/memory/disk limits), network isolation (default deny-all), and filesystem mounting

3. Code Execution (<30s default): Isolated execution with real-time WebSocket streaming, continuous resource monitoring, and automatic timeout enforcement

4. Cleanup and Reporting (100-200ms): Guaranteed container destruction, log aggregation, state verification, and telemetry reporting

Total Lifecycle: ~1s overhead + execution time (typically <5s for most workloads)


Key Benefits

Enterprise-Grade Security Without Complexity

Kernel-level isolation via Docker containers prevents untrusted code from accessing your infrastructure. No security expertise required---isolation policies are pre-configured and battle-tested across thousands of production deployments.

37+ Languages, Zero Runtime Management

Support Python, JavaScript, Rust, Go, Java, and 32+ more languages without maintaining language runtimes. Package managers (npm, pip, cargo) pre-installed; dependency installation handled automatically per execution.

Sub-Second Latency at Scale

<1s execution overhead enables real-time user experiences. 100+ concurrent executions per node with horizontal scaling means your application never waits for sandbox availability.

Predictable Costs, No Vendor Lock-In

Self-hosted infrastructure eliminates per-execution API charges. Scale from 100 to 100,000 daily executions without surprise bills or rate limiting. Own your data, control your costs.

Real-Time Streaming for Responsive UX

WebSocket streaming delivers code output as it happens. Build responsive developer tools, interactive tutorials, or debugging interfaces with line-by-line execution feedback.

Automatic Resource Reclamation

Guaranteed cleanup prevents resource leaks. Containers are destroyed immediately after execution---no lingering processes, files, or network connections. Perfect for high-throughput, multi-tenant environments.

Production-Ready Monitoring and Observability

Built-in telemetry tracks execution counts, average latency, resource utilization, and failure rates. Integration with Adverant Nexus observability stack provides end-to-end visibility from API request to container termination.

Request Demo


Integration and Deployment

Sandbox Service integrates into Adverant Nexus or operates standalone via REST API and WebSocket protocols. Deploy on Kubernetes, Docker Compose, or bare metal with minimal dependencies and production-ready configuration templates.

Deployment Architecture Options

Kubernetes (Recommended for Production)

Deploy Sandbox Service on Kubernetes for automatic scaling, high availability, and enterprise-grade orchestration:

YAML
20 lines
apiVersion: apps/v1
kind: Deployment
metadata:
  name: sandbox-service
spec:
  replicas: 3
  template:
    spec:
      containers:
      - name: sandbox-api
        image: adverant/sandbox-service:latest
        resources:
          requests:
            memory: "2Gi"
            cpu: "1000m"
          limits:
            memory: "4Gi"
            cpu: "2000m"
      nodeSelector:
        workload: sandbox-execution

Key Kubernetes Features:

  • Horizontal Pod Autoscaling: Scale from 3 to 50+ replicas based on execution queue depth
  • Resource Quotas: Prevent sandbox workloads from consuming entire cluster
  • Pod Security Standards: Enforce restricted security contexts via admission controllers
  • Network Policies: Isolate sandbox pods from sensitive cluster services
  • Node Affinity: Dedicate specific nodes to sandbox workloads for better isolation

Docker Compose (Development & Small Deployments)

Single-node deployment for development, testing, or low-volume production:

YAML
13 lines
version: '3.8'
services:
  sandbox-api:
    image: adverant/sandbox-service:latest
    ports:
      - "8080:8080"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - REDIS_URL=redis://redis:6379
      - MAX_CONCURRENT_EXECUTIONS=100
  redis:
    image: redis:7-alpine

Bare Metal / VM Deployment

Direct installation on Linux servers (Ubuntu 22.04+, Debian 12+, RHEL 8+):

  • System Requirements: 4+ CPU cores, 8GB+ RAM, 50GB+ disk, Docker 20.10+
  • Network Requirements: Outbound HTTPS for package registries (optional), WebSocket support
  • Monitoring: Prometheus metrics endpoint, structured JSON logging

Integration Patterns

REST API Integration

Execute code synchronously with full control over execution parameters:

Bash
9 lines
POST /api/v1/execute
{
  "language": "python",
  "code": "print('Hello, World!')",
  "timeout": 30,
  "memory_limit": "512M",
  "cpu_limit": 1.0,
  "network_enabled": false
}

WebSocket Streaming Integration

Real-time streaming for responsive UIs and long-running executions:

JavaScript
8 lines
const ws = new WebSocket('wss://sandbox.example.com/stream');
ws.send(JSON.stringify({
  language: 'javascript',
  code: 'for(let i=0; i<10; i++) console.log(i);'
}));
ws.onmessage = (event) => {
  console.log('Output:', event.data); // Streams line-by-line
};

Kubernetes Job Integration

Schedule batch code executions as Kubernetes Jobs:

YAML
12 lines
apiVersion: batch/v1
kind: Job
metadata:
  name: code-execution-batch
spec:
  template:
    spec:
      containers:
      - name: executor
        image: adverant/sandbox-runtime:python
        command: ["python", "/code/script.py"]
      restartPolicy: Never

Docker Engine Configuration for Sandbox Hosts

Optimize Docker daemon settings for secure, high-throughput sandbox execution:

/etc/docker/daemon.json:

JSON
19 lines
{
  "live-restore": true,
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "10m",
    "max-file": "3"
  },
  "default-ulimits": {
    "nofile": {
      "Name": "nofile",
      "Hard": 64000,
      "Soft": 64000
    }
  },
  "max-concurrent-downloads": 10,
  "max-concurrent-uploads": 10,
  "storage-driver": "overlay2",
  "userns-remap": "default"
}

Critical Settings:

  • userns-remap: Enables user namespace remapping for all containers (prevents root privilege escalation)
  • live-restore: Keeps containers running during daemon updates
  • log-opts: Prevents log disk exhaustion from high-volume executions

Monitoring and Observability

Prometheus Metrics:

  • sandbox_executions_total: Total execution count by language and status
  • sandbox_execution_duration_seconds: Execution latency histogram
  • sandbox_active_containers: Current concurrent executions
  • sandbox_queue_depth: Pending executions in queue
  • sandbox_resource_usage_bytes: Memory/CPU consumption per container

Structured Logging:

JSON
10 lines
{
  "timestamp": "2025-11-26T10:30:45Z",
  "level": "info",
  "execution_id": "exec-a1b2c3d4",
  "language": "python",
  "duration_ms": 1247,
  "memory_used_mb": 342,
  "exit_code": 0,
  "user_id": "user-123"
}

Integration with Observability Stacks:

  • Prometheus + Grafana for metrics visualization
  • ELK/EFK stack for log aggregation and analysis
  • Jaeger/Zipkin for distributed tracing (when part of Adverant Nexus)

Security Best Practices for Untrusted Code Execution

Deploying sandbox infrastructure requires adherence to security principles validated across thousands of production code execution platforms. These practices are derived from OWASP Docker Security guidelines and real-world container security incidents.

Principle 1: Never Run Containers as Root

Risk: Container root (UID 0) can exploit kernel vulnerabilities to escalate to host root, compromising the entire system.

Implementation:

  • Enable user namespace remapping via userns-remap in Docker daemon config
  • Explicitly set non-root user in container images via USER directive
  • As of Docker v1.12+, two levels of privilege escalation required: container user → container root → host root

Verification:

Bash
2 lines
docker inspect <container> --format='{{.Config.User}}'
# Should return non-zero UID (e.g., "1000")

Principle 2: Remove All Unnecessary Capabilities

Risk: Linux capabilities grant fine-grained privileges. Default Docker capabilities include CAP_NET_RAW (packet sniffing), CAP_AUDIT_WRITE (log manipulation), and others exploitable for container escape.

Implementation:

  • Drop all capabilities: --cap-drop=ALL
  • Add only explicitly required capabilities: --cap-add=CHOWN (if needed for file ownership changes)
  • Sandbox Service drops all capabilities by default; language runtimes require zero elevated privileges

Common Dangerous Capabilities:

  • CAP_SYS_ADMIN: Nearly equivalent to root (mount, namespace manipulation)
  • CAP_NET_ADMIN: Network configuration, could enable traffic interception
  • CAP_SYS_MODULE: Load kernel modules, direct path to host compromise

Principle 3: Isolate Untrusted Containers on Dedicated Infrastructure

Risk: Kernel vulnerabilities affect all containers on a host. A single kernel exploit in one container can compromise all others sharing the kernel.

Implementation:

  • Dedicated Nodes: Run sandbox workloads on separate physical/virtual machines
  • Kubernetes Node Taints/Tolerations: Prevent non-sandbox workloads from co-locating with sandbox pods
  • Enhanced Isolation: Use gVisor, Kata Containers, or Firecracker for hypervisor-level isolation

Example Kubernetes Taint:

Bash
1 line
kubectl taint nodes sandbox-node-1 workload=untrusted:NoSchedule

Principle 4: Keep Docker Engine and Host Kernel Updated

Risk: 80% of cloud environments were vulnerable to CVE-2024-21626 before patching. Kernel vulnerabilities are the primary attack vector for container escapes.

Implementation:

  • Automate security updates for host kernel (Ubuntu: unattended-upgrades)
  • Update Docker Engine within 30 days of security releases
  • Subscribe to Docker security announcements and CVE databases

Recommended Versions (as of November 2025):

  • Docker Engine: 24.0+ (receives active security patches)
  • Linux Kernel: 5.15+ (LTS kernel with container security improvements)

Principle 5: Use Trusted, Minimal Base Images

Risk: Untrusted base images may contain backdoors, malware, or unnecessary packages that increase attack surface.

Implementation:

  • Use Docker Official Images (verified by Docker, Inc.)
  • Prefer Alpine Linux or distroless images (minimal attack surface)
  • Scan images with Trivy, Clair, or Anchore before deployment
  • Never build from untrusted Dockerfiles

Example Minimal Image:

Dockerfile
3 lines
FROM python:3.11-alpine
RUN adduser -D appuser
USER appuser

Principle 6: Never Bind-Mount the Docker Socket

Risk: Mounting /var/run/docker.sock grants full Docker API access, equivalent to root on the host. Attackers can launch privileged containers to escape.

Implementation:

  • Sandbox Service API handles Docker operations; execution containers never access Docker socket
  • If Docker-in-Docker required, use isolated Docker daemons (DinD) instead of socket mounting

Verification:

Bash
2 lines
docker inspect <container> --format='{{.HostConfig.Binds}}'
# Should NOT contain "/var/run/docker.sock"

Principle 7: Set Resource Limits on Every Container

Risk: Unbounded resource consumption enables denial-of-service attacks. A single malicious container can exhaust host CPU/memory, affecting all workloads.

Implementation:

  • Memory limit: --memory=512m (hard limit, OOM killer triggers beyond this)
  • CPU limit: --cpus=1.0 (prevents CPU monopolization)
  • PIDs limit: --pids-limit=100 (prevents fork bombs)

Sandbox Service Defaults:

  • 512MB memory per execution
  • 1 CPU core per execution
  • 100 process limit
  • All limits configurable per execution

Principle 8: Enable Security Modules in Enforcement Mode

Risk: Without MAC (Mandatory Access Control), traditional Linux permissions are insufficient to prevent sophisticated attacks.

Implementation:

  • AppArmor: Enabled by default on Ubuntu/Debian
  • SELinux: Enabled by default on RHEL/CentOS (set to enforcing mode)
  • Seccomp: Default Docker profile blocks 44 dangerous syscalls

Verification (AppArmor):

Bash
2 lines
docker inspect <container> --format='{{.AppArmorProfile}}'
# Should return "docker-default" or custom profile

Principle 9: Implement Default-Deny Network Policies

Risk: Unrestricted network access enables data exfiltration, C2 communication, and lateral movement to other services.

Implementation:

  • Sandbox Service: Default deny-all egress policy
  • Configurable allowlist for package registries (npmjs.com, pypi.org, etc.)
  • Kubernetes Network Policies for pod-to-pod isolation

Example Network Policy:

YAML
16 lines
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: sandbox-network-policy
spec:
  podSelector:
    matchLabels:
      app: sandbox-executor
  policyTypes:
  - Egress
  egress:
  - to:
    - namespaceSelector: {}
      podSelector:
        matchLabels:
          app: package-registry-proxy

Principle 10: Never Store Secrets in Images or Environment Variables

Risk: Secrets embedded in images persist across executions and are visible in image layers. Environment variables appear in process listings.

Implementation:

  • Use Kubernetes Secrets with volume mounts (not env vars)
  • Integrate with HashiCorp Vault, AWS Secrets Manager, or Azure Key Vault
  • Rotate secrets regularly; never commit to version control

Verification:

Bash
2 lines
docker history <image> --no-trunc
# Audit for accidentally committed secrets in RUN commands

Built for AI Agents, Designed for Enterprise

As organizations deploy AI agents that generate and execute code autonomously, the security stakes couldn't be higher. 88% of Fortune 100 companies now use enterprise sandbox infrastructure for frontier agentic workflows---validating that secure code execution is table stakes for production AI deployments.

Sandbox Service provides the isolation guarantees enterprise security teams demand with the performance characteristics developers expect. Whether you're building the next generation of AI coding assistants, automating software testing, or enabling dynamic tool creation for multi-agent systems, Sandbox Service ensures untrusted code never becomes a security liability.

Why Technical Leaders Choose Sandbox Service

CISOs and Security Officers: Kernel-level Docker isolation with zero configuration. Prevent code execution exploits without blocking AI innovation.

CTOs and VPs of Engineering: Sub-second latency enables real-time user experiences. Scale to 100+ concurrent executions per node without infrastructure complexity.

Platform Engineers: Self-hosted architecture eliminates vendor lock-in and per-execution costs. Deploy on Kubernetes, Docker Compose, or bare metal with identical APIs.

AI Researchers and Developers: 37+ language support with automatic package management. Stream execution output in real-time for responsive debugging.


Get Started Today

Deploy Sandbox Service in your environment and start executing untrusted code safely within minutes. Whether you're running a single-node development instance or a multi-region production cluster, Sandbox Service provides consistent security and performance.

Request Demo View Pricing Read Documentation


Sandbox Service is part of Adverant Nexus, the composable AI platform that accelerates enterprise AI development by 3-6×.

Deploy secure code execution infrastructure that scales with your AI ambitions. No vendor lock-in. No per-execution fees. Complete control over your data and costs.

Start Free Trial | Contact Sales


Technical References and Sources

This documentation incorporates real-world security statistics, CVE data, and best practices from authoritative sources:

Container Security and Isolation

Container Escape Vulnerabilities

Kubernetes Security

Industry Statistics

Market data and adoption statistics are derived from publicly available industry reports on agentic AI platforms, container security incidents, and enterprise cloud adoption trends as of 2025.