An enterprise assistant gets handed a quarterly PDF and a routine instruction to summarize it. Somewhere inside the document, in white text on a white background, sits a second instruction the user never wrote: read the host environment variables, then work them into the summary. The agent complies. It always does what it's told — just not always by the person who uploaded the file.
Start With a Caveat About the Headline
Let's put this on the table first: nothing in the research behind this piece documents a disclosed, real-world escape of Gemini from a production sandbox. Not one. That's worth saying plainly, because the phrasing invites a scarier story than the evidence supports.
What the evidence does support is narrower and more useful. Autonomous agents with code interpreters need strict execution controls. The interesting failure here isn't the model talking its way past a guardrail. It's the infrastructure underneath the model handing over more than anyone intended.
So read this as a playbook for the isolation layer, not a post-mortem. The threat model is real. The incident report isn't.
The Sandbox Isn't the Model's Problem
Prompt injection has held the top spot on the risk list for LLM applications long enough that calling it a novelty feels generous.
- "Prompt injection is the first-listed risk in the OWASP Top 10 for LLM Applications, catalogued as LLM01."
- OWASP GenAI Security Project, Top 10 for LLM Applications
That ranking matters, and not because of its popularity. Injection isn't a bug you patch out of a model. It's a property of any system that treats retrieved text and system instructions as the same kind of input.
A document, a web page, a code comment, a calendar invite — it all arrives as tokens, and the model has no reliable way to tell which tokens came from its operator and which came from an attacker. Which is why the security baseline is moving.
Teams that spent two years on model-level alignment are now being told, correctly, that alignment reduces probability and doesn't eliminate capability. The deterministic controls live one layer down, in the runtime.
Why Standard Container Isolation Falls Short
Here's a misconception that shows up in architecture reviews with impressive regularity: ordinary OS-level user permissions, or a plain Docker container, give you adequate isolation for an LLM generating and executing arbitrary code. They don't.
And the reason is structural rather than a matter of tuning. Containers on a shared kernel are a packaging and scheduling boundary. A process inside one still reaches the host kernel through the same system call interface as any other process. If generated code finds a kernel-level weakness, the container wall is a fence, not a vault.
Isolation runtimes take a different approach. gVisor restricts system call access by intercepting those calls instead of passing them straight through. Google's own documentation describes it as implementing a substantial portion of the Linux system call interface while providing "an additional layer of isolation between running applications and the host operating system."
MicroVM approaches sit in a similar philosophical neighborhood: give the workload its own kernel boundary rather than argue about namespaces. That distinction is easy to wave away in a design doc. It's very hard to wave away during an incident.
What a Realistic Escape Chain Looks Like
Take the scenario from the enterprise deployment. An AI assistant processes a document containing hidden prompt injection commands that try to inspect host environment variables. There's no exotic exploit here — no memory corruption, no zero-day. The document just asks, and the agent's code interpreter, built to be helpful, tries to answer.
Three things decide whether that attempt becomes a breach. First, whether the execution environment is ephemeral. If each interpreter session spins up fresh and dies on completion, nothing the injected instruction writes survives into the next run.
Second, whether network egress is blocked. Exfiltration needs a destination. A sandbox that can read environment variables but can't reach an external endpoint has turned a data breach into a logged curiosity.
Third, whether those two controls are applied together. gVisor-style syscall restriction without egress filtering leaves a process that can't touch the kernel but can still phone home. Egress filtering without runtime isolation leaves an attacker inside a boundary they might be able to widen.
In the enterprise case, the combination held. The process was isolated, egress was denied, and nothing left the building. That's the outcome to design for — but notice how many independent controls had to be right at the same time.
The Trade-off Nobody Escapes: Capability Versus Containment
Dynamic code interpreters need access to libraries and network endpoints to do legitimate developer work. That's not sloppiness. It's the feature. An agent that can't install a package or call an API is an agent that can't do much.
Every permission you add to make the interpreter useful widens the surface an attacker can steer toward. The practical problem isn't that teams are lazy about hardening. It's that the hardening budget competes directly with the product roadmap, and the roadmap usually wins the scheduling argument.
The honest framing: you're not choosing between a secure sandbox and an insecure one. You're choosing how much capability to trade for how much containment — and whether that trade is written down anywhere.
A Layered Playbook for Containing Agent Execution
If the trade-off is unavoidable, the response is to layer controls so no single one has to be perfect.
Assume the runtime is already compromised
Design from the position that injected instructions will sometimes succeed in reaching the execution layer. If your controls only work when the model behaves, you don't have controls. You have a hope.
Make execution ephemeral by default
Fresh environment per task, destroyed on completion, no shared writable state between sessions. Ephemerality turns a successful injection into a non-event instead of a persistent foothold.
Close the network by default
Deny egress, then allowlist the specific endpoints a task genuinely requires. The endpoints an agent needs for a summarization job look nothing like the ones it needs for a deployment job, so the allowlist should differ by task type rather than by agent.
Move authorization out of the model's reach
The orchestrator decides what the runtime may do. The model requests; the infrastructure grants or refuses. Once authorization logic is expressible in natural language that the model reads, it's inside the injection surface.
Instrument for the attempt, not just the failure
A blocked egress request is a signal. So is a syscall gVisor refuses. Teams that only alert on successful breaches are throwing away the best telemetry they'll ever get — the near miss.
How to Test Your Agent for Sandbox Escapes
The short version of sandboxing an AI code interpreter: run ephemeral, non-root execution environments such as gVisor or microVMs. Enforce strict network egress policies, restrict system calls through seccomp profiles, and keep authorization decisions in the orchestrator rather than the model. The test that matters is whether those layers hold when the input is adversarial, not when it's clean.
Practical red-teaming follows from that. Feed the agent documents with embedded instructions and watch whether anything tries to reach the host or the network. Instrument for near misses, because a blocked attempt is the highest-value signal you'll get.
A Dissenting View: Isolation Doesn't Fix Injection
There's a serious counterargument here, and it deserves more room than it usually gets. Hardening the runtime limits blast radius. It does nothing about the exfiltration channel you deliberately left open — the agent's own output.
If the assistant can read a document and write a summary, it can put secrets in that summary. No syscall policy catches that, because the leak travels through a channel the product requires.
The evidence for this reading comes from the capability trade-off itself: legitimate tasks need legitimate access to legitimate data. Anyone arguing that sandboxing solves prompt injection has to explain how a perfectly isolated process still produces text a user will read and act on.
So the dissenting position isn't that isolation is useless. It's that infrastructure hardening addresses the wrong half of the problem if it's the only investment you make. The alternative allocation goes toward data-flow authorization — controlling what information an agent is permitted to read in the first place — and content provenance, so that instructions arriving from retrieved documents carry a different trust weight than instructions from the operator.
That's a harder engineering problem than tightening a container. It also targets the mechanism that actually moves data.
Key Uncertainties and Open Questions
The long-term efficacy of current adversarial benchmarks against evolving agent capabilities remains unresolved, and that's the largest open question in this space. Benchmarks are snapshots. Agent capability isn't.
Two statistics circulate widely in this debate, and both deserve caution. One puts adoption of web security standards at 92%. The other puts reliability in current AI safety benchmarks at 90%. Neither figure arrives with a named provider, dataset, or study attached in the available material.
That means they can suggest a direction — mature standards get adopted, current benchmarks perform reasonably — but they can't support a precise claim. Treat them as context, not as evidence.
There's also a measurement gap nobody has closed. Public telemetry on real-world sandbox escape attempts by LLM agents is thin, which makes it hard to tell controls that are working from controls that simply haven't been tested. A blocked attack and an unattempted one look identical in most dashboards.
And an edge case that keeps resurfacing: what happens when agents gain the ability to request new tools or dependencies at runtime? Static allowlists assume a fixed capability set. Agents are trending away from that assumption, and the security model hasn't caught up.
The Question Nobody Can Answer Yet
Here's the uncomfortable part. The strongest controls are the ones that shrink what the agent can do, and the market keeps rewarding agents that do more. Every quarter, capability expands. Every quarter, the containment conversation gets one more paragraph in the architecture doc.
So the question worth sitting with isn't whether gVisor beats Docker, or whether egress filtering beats a network namespace. It's this: when an agent can acquire its own tools mid-task, and no human approved the request, who is the authorizing party — and does your architecture have an answer that doesn't depend on the model choosing to behave?
Key Takeaways
- Prompt injection tops the OWASP Top 10 for LLM Applications as LLM01, and it's a structural property of systems that treat retrieved text and operator instructions as the same input.
- Standard OS permissions and plain Docker containers aren't adequate isolation for LLMs executing arbitrary code, because they share the host kernel rather than restricting the system call surface.
- Effective containment is layered: ephemeral runtimes, restricted syscalls through something like gVisor, default-deny egress, and authorization held outside the model.
- Isolation limits blast radius but doesn't close the output channel, where data can still leave inside a legitimate-looking answer.
- The widely cited 92% and 90% figures lack named sources in the available material, so they indicate direction rather than precise measurement.
FAQ
Is Docker enough to sandbox an LLM code interpreter?
No. Containers share the host kernel, so a process inside one still reaches the same system call interface as anything else on the machine. Adequate isolation for generated code needs another boundary — a gVisor-style runtime or a microVM — plus network controls.
What's the single highest-value control for AI sandbox security?
Default-deny network egress. It converts a lot of successful injections into logged non-events, because exfiltration needs a destination. Syscall restriction matters too, but a process that can't reach the network has far fewer ways to move data out.
How does prompt injection lead to a sandbox escape?
It doesn't break the sandbox directly. It persuades the agent to use its legitimate interpreter access for something the operator never intended — reading environment variables, say — and the escape succeeds only if the surrounding controls permit it.
Why not just rely on model-level safety alignment?
Alignment reduces the probability of a bad action. It can't eliminate the capability. Deterministic infrastructure controls — ephemeral runtimes, syscall policies, egress filtering — are what remain when the model is successfully manipulated.
Can you test whether your agent sandbox is actually safe?
Partly. Adversarial benchmarks and injected-document red-teaming reveal real weaknesses, but their long-term efficacy against evolving agent capabilities is unresolved. Instrument for blocked attempts, since near misses are the most reliable signal you've got — and the only one that shows what your controls are catching before an attacker finds a way around them.

Reader Discussion
0No comments yet. Be the first to share your thoughts, strategic perspective, or feedback on this guide!
Post a Comment
Join the discussion. All constructive feedback and editorial insights are welcome.