Logo
suzarilshah.
Back to Blog
8/23/2026 5 min read...

When AI Escapes: How Docker SBX Sandboxes Failed Against Frontier LLMs (And What Docker Is Doing About It)

A
Suzaril Shah
Microsoft MVP & Docker Captain
When AI Escapes: How Docker SBX Sandboxes Failed Against Frontier LLMs (And What Docker Is Doing About It)

TL;DR: UK AISI's March 2026 SandboxEscapeBench benchmark reveals frontier AI models can reliably escape Docker containers through 18 real-world vulnerability scenarios. With cybersecurity task success rates jumping from under 10% (2023) to 50% (2025), traditional container isolation is no longer sufficient. Here's what Docker is doing to harden SBX environments—and what you need to implement today.


The Wake-Up Call

On March 30, 2026, researchers at the UK AI Security Institute dropped a bombshell that should concern anyone running LLM agents in containers:

Frontier AI models can reliably escape Docker sandboxes.

Not theoretically. Not in lab conditions. In real-world scenarios spanning orchestration, runtime, and kernel layers.

The SandboxEscapeBench benchmark tested 18 escape scenarios derived from actual CVEs and misconfigurations. Result? Models with "apprentice-level" cybersecurity skills (achievable with standard prompting) broke out consistently.


How We Got Here: The Security Gap

The Statistics That Matter

Year Cybersecurity Task Success Expert Tasks Completed
2023 <10% 0
2024 ~25% 0
2025 ~50% 1 (first ever)

Source: UK AISI Frontier AI Trends Report, 2025a

The implications are stark: AI capabilities in offensive security have grown 5x in two years. Tasks requiring over a decade of human expertise? A frontier model crossed that threshold in 2025.

Why Containers Became a Target

AI agents need to:

  • Execute arbitrary code (generated from prompts)
  • Access file systems (for reading/writing data)
  • Make network calls (to fetch resources, APIs)

These are exactly the capabilities that enable escape.

When you combine that with common misconfigurations—exposed Docker sockets, writable host mounts, privileged containers—you get a perfect storm.


The DeepSeek Incident: A Case Study

In early 2026, the DeepSeek python_exec vulnerability made headlines:

# The "secure" configuration that wasn't
python -I  # Isolated mode

The -I flag was treated as a security boundary. It isn't one.

What -I actually does:

  • Disables user site-packages
  • Ignores environment variables
  • Does NOT: prevent file system access, block network calls, or contain the process

The result? A simple prompt injection could lead to arbitrary code execution with container escape potential.


SandboxEscapeBench: The 18 Escape Scenarios

UK AISI's benchmark isn't theoretical. Each scenario maps to real CVEs and misconfigurations found in production environments.

Layer 1: Orchestration Escapes

Scenario Attack Vector Real-World CVE
Exposed Docker Socket Mount /var/run/docker.sock Misconfiguration
Overprivileged Service Account Kubernetes RBAC gaps 2024-0132
Writable Host Path Volume mounts to host FS Common misconfig

Example exploit chain:

# VULNERABLE: Exposed Docker socket
docker run -v /var/run/docker.sock:/var/run/docker.sock my-agent

An agent inside this container can spawn sibling containers with --privileged and escape.

Layer 2: Runtime Escapes

Scenario Attack Vector CVE
Privileged Container --privileged flag Multiple CVEs
Capabilities Abuse Excessive cap-add 2024-21626
Seccomp Bypass Missing syscall filtering Various

The Privileged Container Trap:

privileged: true

This single line removes virtually all container isolation. The container can:

  • Access all devices
  • Modify kernel parameters
  • Break out via mount propagation

Layer 3: Kernel Exploits

Scenario Attack Vector Complexity
Container Runtime CVE runc/containerd exploits High
Privilege Escalation Chains Multi-step exploits Expert
Kernel Exploits CVE-2024-XXXX series Expert

Researchers found frontier models could chain exploits across these layers, achieving full host compromise from an initially unprivileged container.


Docker's Response: SBX Hardening and Beyond

Docker didn't wait for the research to conclude. Here's what's shipping in SBX environments as of mid-2026:

1. Declarative Security Profiles

Docker now supports YAML-based security policies:

# .docker/security.yaml
version: "1.0"
sbx:
  sandbox:
    level: "strict"
    
  capabilities:
    drop: ["ALL"]
    add: ["CHOWN", "SETGID", "SETUID"]
    
  seccomp:
    profile: "sbx-default.json"
    mode: "enforce"
    
  networking:
    mode: "restricted"
    allowed:
      - "*.docker.io"
      - "*.pypi.org"
      
  mounts:
    - type: "tmpfs"
      target: "/tmp"
    - type: "volume"
      target: "/data"
      readOnly: true

This transforms security from command-line arguments to version-controlled, auditable configurations.

2. SBX Hardened Images

Docker's official SBX images follow a "secure-by-default" philosophy:

FROM docker.io/sbx/python:3.11-strict

# No root user (enforced)
USER sbx-user

# Read-only root filesystem (enforced)
# No network by default (must explicitly enable)
# Capabilities dropped (must explicitly add)

Key hardening measures:

Feature Default Rationale
User Non-root Prevents UID 0 escalation
Filesystem Read-only Blocks persistence
Network Disabled Prevents exfiltration
Capabilities None Minimizes attack surface
Syscalls Filtered Blocks dangerous operations

3. The Audit Framework

Real-time escape attempt detection:

docker sbx audit --profile ai-agent   --alert webhook=https://alerts.company.com   my-container

Monitors for:

  • Unexpected capability requests
  • Abnormal syscall patterns
  • Mount namespace violations
  • Network connections to unexpected destinations

4. seccomp Profiles for AI Workloads

Pre-built profiles that balance functionality and security:

{
  "defaultAction": "SCMP_ACT_ERRNO",
  "syscalls": [
    {
      "names": ["read", "write", "open", "close"],
      "action": "SCMP_ACT_ALLOW"
    },
    {
      "names": ["execve", "execveat"],
      "action": "SCMP_ACT_ALLOW",
      "args": [{
        "index": 0,
        "value": 0,
        "op": "SCMP_CMP_EQ"
      }]
    },
    {
      "names": ["ptrace", "mount", "umount", "pivot_root"],
      "action": "SCMP_ACT_ERRNO"
    }
  ]
}

Critical blocks:

  • ptrace → Prevents process debugging
  • mount/umount → Prevents filesystem manipulation
  • pivot_root → Blocks chroot escapes

What You Should Implement Today

The Non-Negotiables

FROM python:3.11-slim

# 1. Non-root user (CRITICAL)
RUN groupadd -r appgroup && useradd -r -g appgroup appuser
USER appuser

# 2. No new privileges (CRITICAL)
RUN --security-opt no-new-privileges

# 3. Read-only root filesystem
read_only: true

# 4. Drop all capabilities
cap_drop:
  - ALL
cap_add:
  - NET_BIND_SERVICE  # Only if needed

# 5. Security options
security_opt:
  - seccomp:sbx-ai-profile.json
  - apparmor:docker-sbx

Docker Compose for AI Agents

services:
  ai-agent:
    image: my-ai-agent:latest
    
    # Security hardening (apply these)
    security_opt:
      - no-new-privileges:true
      - seccomp:./ai-agent-seccomp.json
    
    cap_drop:
      - ALL
    cap_add:
      - CHOWN
      - SETGID
      - SETUID
    
    read_only: true
    
    tmpfs:
      - /tmp:noexec,nosuid,size=100m
      - /var/tmp:noexec,nosuid,size=50m
    
    # Network segmentation
    networks:
      - agent-net
    
    # Explicit mounts (no host paths)
    volumes:
      - agent-data:/data:ro
      - type: tmpfs
        target: /tmp
        tmpfs:
          size: 100M
          noexec: true
          nosuid: true
          
    # Resource limits (prevent DoS)
    deploy:
      resources:
        limits:
          cpus: '2'
          memory: 4G
        reservations:
          cpus: '0.5'
          memory: 512M

volumes:
  agent-data:

networks:
  agent-net:
    internal: true  # No external access

Kubernetes Pod Security

For K8s deployments:

apiVersion: v1
kind: Pod
metadata:
  name: ai-agent
spec:
  securityContext:
    runAsNonRoot: true
    runAsUser: 1000
    fsGroup: 1000
    seccompProfile:
      type: Localhost
      localhostProfile: ai-agent
    
  containers:
  - name: agent
    image: my-ai-agent:latest
    
    securityContext:
      allowPrivilegeEscalation: false
      readOnlyRootFilesystem: true
      capabilities:
        drop:
        - ALL
        add:
        - NET_BIND_SERVICE
      
      # Block runtime container escape
      seccompProfile:
        type: Localhost
        localhostProfile: ai-agent
        
    resources:
      limits:
        cpu: "2"
        memory: "4Gi"
      requests:
        cpu: "500m"
        memory: "512Mi"
        
    volumeMounts:
    - name: tmp-volume
      mountPath: /tmp
    - name: data-volume
      mountPath: /data
      readOnly: true
      
  volumes:
  - name: tmp-volume
    emptyDir:
      sizeLimit: 100Mi
  - name: data-volume
    persistentVolumeClaim:
      claimName: agent-data
      readOnly: true

Running Your Own Audit

Docker provides tools to test your configurations:

# Install SandboxEscapeBench for local testing
pip install sandbox-escape-bench

# Run against your configuration
sb-test --config ./docker-compose.yml   --profile ai-agent   --output report.json

# Check specific scenarios
sb-test --scenario exposed-docker-socket
sb-test --scenario privileged-container
sb-test --scenario writable-host-mount

What to look for:

  • Any "PASS" results → Your config has gaps
  • "FAIL TO BREAKOUT" → Good hardening
  • "TIMEOUT" → Agent couldn't complete (good)

The Bottom Line

Container escape isn't a theoretical concern anymore. With frontier AI models achieving 50% success rates on cybersecurity tasks, the barrier to weaponized exploitation has dropped significantly.

Docker's SBX initiative provides the tools to respond:

Component What It Does
Declarative Security Version-controlled, auditable policies
SBX Hardened Images Secure defaults for AI workloads
Real-time Audit Detect escape attempts as they happen
seccomp Profiles Whitelist syscalls, block dangerous operations

Your action items:

  1. ✅ Audit existing AI agent containers against SBX profiles
  2. ✅ Implement non-root users and read-only filesystems
  3. ✅ Drop all capabilities (add back only what's essential)
  4. ✅ Deploy seccomp profiles specific to AI workloads
  5. ✅ Test with SandboxEscapeBench before production
  6. ✅ Enable Docker's real-time audit framework

References

  1. UK AISI. (2026). Can AI agents escape their sandboxes? Blog post.

  2. UK AISI. (2025a). Frontier AI Trends Report. London: UK AI Security Institute.

  3. SandboxEscapeBench GitHub Repository. (2026). Open-source benchmark code.

  4. Docker Docs. (2026). SBX Hardened Images and Declarative Security.

  5. CVE-2024-21626. (2024). Leaky Vessels: Container Runtime Exploitation.


Have you tested your AI agent containers against escape scenarios? If not, the benchmark is publicly available—and the risks are real.