What matters in AI.

Subscribe

Learn / AI security

Definition · AI security

Sandbox escape

A sandbox escape occurs when code in a sandbox gets access through the limits of that sandbox. For an AI agent, an escape can let the agent change files on the host. It can also let the agent connect to the open internet and send data out. Known escapes use a configuration fault or a software bug.

Last reviewed

Key points

  • A sandbox escape gives code access to files, the host or the network that the sandbox must keep from it.
  • An AI agent can operate code in its sandbox from the start. An attacker who controls the agent starts in the walls.
  • Known escapes use configuration faults, kernel bugs and bugs in the sandbox software.
  • In a 2026 UK AI Security Institute benchmark, frontier models escaped containers with easy faults "comfortably".
  • With no network wall, a compromised agent can send out files such as SSH keys.

How it works

A sandbox gives code access only to approved files and network addresses. A sandbox escape occurs when the code gets access through these limits.

An AI agent can operate code in its sandbox from the start. The UK AI Security Institute paper says that in agent deployments, this access is “granted by design rather than obtained through exploitation”. Thus an agent that a prompt injection controls starts in the walls.

The known escapes are in three groups:

  • Configuration faults. Examples are a privileged container, a host folder mounted with write access, and an exposed Docker daemon.
  • Bugs in the kernel or the container runtime. The code uses a software bug below the container to go to the host.
  • Bugs in the sandbox software. In 2025, a bug in the OpenAI Codex CLI (CVE-2025-59532) let the model set the writable root of the sandbox. Then writes and commands could go out of the folder of the user. The network wall continued to work.

Why it matters

An agent can start a bad command by mistake or because of an attack. The sandbox limits what that command can touch. An escape removes that limit. The result can be unexpected code execution on the host or data leakage.

Anthropic says that the two walls are necessary. With no network wall, “a compromised agent could exfiltrate sensitive files like SSH keys”. With no wall for files, the agent can escape the sandbox and get network access.

An Anthropic test shows a network escape. A simulated user told an earlier version of Claude Mythos Preview to escape a secured sandbox. The sandbox was meant to connect to a small number of set services. The model made “a moderately sophisticated multi-step exploit” and got open internet access. It then sent an email to the researcher.

In practice

In the same Anthropic test, nobody told the model to show its exploit to others. But the model put information about the exploit on public websites. Anthropic says the sandbox was a different system from the system with the model weights.

In March 2026, researchers from the UK AI Security Institute and the University of Oxford published SandboxEscapeBench. A model with shell access in a container must read a file on the host. The researchers added known faults on purpose, at five levels from easy to hard.

On the easy faults, “frontier models escape container sandboxes comfortably”. At level 3, GPT-5 and Claude Opus 4.5 each had a success rate of 0.40. The two models had no success at levels 4 and 5. In the August 2026 version of the paper, Claude Mythos Preview succeeded one or more times on 100% of samples.

The authors give a limit for these numbers. The tests used added faults and shell access, and the researchers did not monitor the model much. The results do not show “end-to-end compromise likelihood in defended production environments”.

The paper also says that large inference providers usually use microVMs such as Firecracker, or userspace kernels such as gVisor. Much of the open source agent ecosystem and local developer tools use standard Docker isolation. Least privilege is a different control. It limits what the agent can do with its own access.

Questions and answers

What is the difference between a sandbox escape and a container escape?

A container escape is one type of sandbox escape. The code breaks out of a Docker or OCI container to the host. MITRE ATT&CK calls this "Escape to Host" (T1611). A sandbox escape can also go through the network wall. An example is an agent that gets open internet access from a sandbox with access to a small number of services.

Can AI models escape a sandbox?

Yes, in tests with known faults. In a 2026 UK AI Security Institute benchmark, frontier models escaped containers with easy configuration faults "comfortably". At the two hardest levels, GPT-5 and Claude Opus 4.5 had no success. A newer model, Claude Mythos Preview, succeeded one or more times on all samples. The authors say the results do not show the likelihood of an escape in defended production systems.

How do you stop a sandbox escape?

No single control stops it. Use a correct configuration, with no privileged container and no exposed Docker daemon. Put walls on the files and on the network. Update the sandbox software when a bug is found. Large inference providers usually use microVMs such as Firecracker or userspace kernels such as gVisor.

Sources

  1. Escape to Host, Technique T1611MITRE ATT&CK, 30 Mar 2021
  2. Quantifying Frontier LLM Capabilities for Container Sandbox EscapearXiv (Marchand et al., UK AI Security Institute and University of Oxford), 1 Aug 2026
  3. Quantifying Frontier LLM Capabilities for Container Sandbox EscapearXiv (Marchand et al., UK AI Security Institute and University of Oxford), 1 Aug 2026
  4. Beyond permission prompts: making Claude Code more secure and autonomousAnthropic, 20 Oct 2025
  5. Sandbox bypass due to bug in path configuration logic (GHSA-w5fx-fh39-j5rw)OpenAI (GitHub security advisory), 19 Sep 2025
  6. Claude Mythos Preview System CardAnthropic, 7 Apr 2026