Slide 16 of 28
Part 3 — Attack ScenariosSlide 16
Slide 16 · Scenarios 5–6
Scenario 5: Code interpreter sandbox escape via subprocess — Scenario 6: Unbounded retry loop causes disk exhaustion
Scenario 5 Code Interpreter Sandbox Escape via subprocess and Environment Variable Reading

What happened: A user interacts with an AI assistant that has a code interpreter. Through a multi-turn conversation, the user gradually guides the assistant to generate code that uses Python's subprocess module to run a shell command — ostensibly to perform a legitimate data processing step. The generated shell command reads environment variables from the process environment, which includes internal service credentials injected by the container orchestration platform.

The outcome: The code executes successfully. The environment variables — including internal API tokens for downstream services — are returned in the interpreter output. The user now has credentials that were never intended to be accessible through the AI interface.

The broader pattern: Security researchers have repeatedly demonstrated that many AI code interpreters, when asked to use subprocess, os.system, or shell-equivalent calls, will do so — and that the resulting subprocess inherits the full environment of the parent process, including all injected secrets.

Type 1 — Sandbox escape / environment variable exfiltration
Scenario 6 Unbounded Retry Loop Causes Host Disk Exhaustion

What happened: An automation agent is tasked with "downloading and processing all pages of a large dataset until the download is complete." The agent generates a retry loop to handle transient failures. The loop condition is written incorrectly — it checks a variable that is never updated, so the loop never exits. Each iteration writes a partial file to disk. After several hours, the host disk is full, the agent's process crashes, and several other services on the host also fail due to the disk exhaustion.

No malice required: The loop bug is the kind of off-by-one or stale-variable error that human programmers make too. The difference: a human running this code would have noticed the loop within minutes. The agent, running autonomously with no monitoring of its resource consumption, ran it until the disk was full.

The fix is a single line: ulimit on disk writes, or a hard limit on loop iterations, would have stopped this at a small fraction of the damage.

Type 6 — Resource exhaustion
← Back The pattern across all six scenarios →