Your Sandbox Degrades Gracefully, What’s the Wurst That Could Happen?

Daniel Cuthbert (Security Researcher)

[un]prompted II 2026 — The AI Security Practitioner Conference · Day 1 · Stage 1

Overview

In this insightful and candid talk from [un]prompted II, security researcher Daniel Cuthbert presented a "humility talk" detailing the arduous journey and numerous pitfalls encountered while developing a robust sandbox for Raptor, an open-source security tool. The talk, titled "Your Sandbox Degrades Gracefully, What’s the Wurst That Could Happen?", delves into the complexities of securing agentic systems, particularly those powered by Large Language Models (LLMs) that execute untrusted code. Cuthbert, alongside collaborators Gadi and JC, set out to build a secure execution environment from scratch, only to discover a series of fundamental flaws and vulnerabilities.

Watch on YouTube

Visual summary for Your Sandbox Degrades Gracefully, What’s the Wurst That Could Happen? by Daniel Cuthbert
Visual summary for Your Sandbox Degrades Gracefully, What’s the Wurst That Could Happen? by Daniel Cuthbert

Key moments

  1. 3:15 Why Raptor needs a sandbox for LLM agent research
  2. 5:45 Raptor's sandbox architecture: parent, child, grandchild processes
  3. 9:00 Critical sandbox flaw: "The assumption has a hole"
  4. 13:00 Most bothersome bug: Chaining vulnerabilities to resign logs
  5. 16:00 Lessons learned and massive increase in sandbox tests
  6. 17:30 Future plans: Agent run receipts and canary tokens
  7. 20:00 Key takeaways and call for more sandbox research

Your Sandbox Degrades Gracefully, What’s the Wurst That Could Happen?

Speakers: Daniel Cuthbert, Security Researcher

Conference: [un]prompted II

YouTube: https://www.youtube.com/watch?v=C_yqOtsT8ZM

Overview

In this insightful and candid talk from [un]prompted II, security researcher Daniel Cuthbert presented a "humility talk" detailing the arduous journey and numerous pitfalls encountered while developing a robust sandbox for Raptor, an open-source security tool. The talk, titled "Your Sandbox Degrades Gracefully, What’s the Wurst That Could Happen?", delves into the complexities of securing agentic systems, particularly those powered by Large Language Models (LLMs) that execute untrusted code. Cuthbert, alongside collaborators Gadi and JC, set out to build a secure execution environment from scratch, only to discover a series of fundamental flaws and vulnerabilities.

The core problem addressed is the inherent danger of running potentially malicious or unpredictable code generated by AI agents on a researcher's host machine. As LLMs increasingly drive automated security analysis, bug finding, and proof-of-concept (PoC) generation, the need for stringent isolation becomes paramount. Cuthbert’s presentation serves as a stark reminder that even experienced security professionals can stumble when confronting the subtle intricacies of sandbox design, underscoring the critical importance of rigorous testing and a profound understanding of underlying operating system mechanisms.

Ultimately, the talk not only exposes the specific vulnerabilities discovered in Raptor's sandbox but also offers invaluable lessons for the broader security community. It challenges the prevailing, often oversimplified, notion that sandboxing is an easily achievable task, particularly in an era where AI agents are becoming ubiquitous. By openly sharing their failures and learnings, Cuthbert and his team contribute significantly to the ongoing discourse on secure AI development, advocating for a renewed focus on foundational sandboxing research.

Background

▶ Watch: Why Raptor needs a sandbox for LLM agent research (3:15)

The genesis of this research lies in the development of Raptor, an innovative open-source project aimed at revolutionizing how security researchers find vulnerabilities. Daniel Cuthbert recounted how traditional vulnerability discovery often involved a patchwork of disparate tools and manual scripting, which he vividly described as "a whole lot of cigarette packets, lipsticks, sticky back plastic, tying together code QL and all these other scripts." It was Gadi who proposed a more advanced approach: "throw an LLM at this." This led to the creation of Raptor, a tool designed to ingest repositories, binaries, or mobile applications, leverage LLMs to identify bugs, and then automatically construct and execute proof-of-concepts (PoCs).

However, the very capability that made Raptor powerful—the execution of arbitrary, potentially untrusted code generated by an LLM—introduced a significant security dilemma. Running such code directly on a researcher's laptop, often configured with all their development tools and sensitive credentials, is akin to "going to a festival, licking the toilet seat and then getting really shocked that your tongue feels really weird the next day." The risk of prompt injection or accidental malicious execution compromising the host system, potentially leaking .ssh directories or other critical data, was unacceptably high.

Recognizing this critical need for isolation, Cuthbert and JC embarked on building a custom sandbox from the ground up. They acknowledged that they were "not inventing the box," but rather standing "on a lot of amazing shoulders of giants." Their work built upon decades of sandboxing advancements, including Unix chroot (introduced in '79), the sophisticated FreeBSD and Solaris jails (early 2000s), Linux namespaces, seccomp, landlock, and macOS Seatbelt. The goal was to create an environment tailored for agentic security tools, specifically targeting Linux and macOS hosts, by intelligently leveraging the best available sandboxing primitives on each platform. This ambitious endeavor, however, soon revealed the profound difficulties inherent in crafting truly secure isolation mechanisms.

Key Findings

▶ Watch: Critical sandbox flaw: "The assumption has a hole" (9:00)

The journey of building Raptor's sandbox proved to be a humbling experience, exposing a series of critical vulnerabilities and misconfigurations that challenged the team's initial assumptions. Daniel Cuthbert candidly stated, "The vast reality was the bugs were there and it was a really good exercise in understanding how hard it is to write a sandbox." This section outlines the main discoveries and contributions arising from their development and testing efforts.

One of the most significant findings was dubbed "the assumption has a hole," a polite British idiom for a severe screw-up. This referred to a fundamental flaw related to user namespaces. The team initially believed the Linux kernel would adequately protect host processes from the payload's user namespace. However, it was discovered that the setup child process, responsible for configuring the sandbox, inadvertently joined the parent's user namespace and retained the parent's environmental variables. This meant that the grandchild process, where the untrusted payload executed, could read all session credentials from the parent, effectively bypassing the intended isolation. This bug was identified and fixed between August 22nd and 26th.

Another critical area of failure concerned network isolation. The sandbox was designed with a block_network=true flag, intended to completely cut off network access using network namespaces or a Landlock TCP deny. Alarmingly, this mechanism often resulted in a fail-open scenario: if neither robust network namespace isolation nor Landlock denial was fully available or correctly configured, the network would remain completely open, exposing the host. Compounding this, a specific bug allowed a supplied port_list (e.g., allowing only port 443) to completely ignore the entire network blocking logic, effectively opening all ports.

The team also uncovered several bypasses related to their initial security checks. A Landlock check performed at startup was found to be insufficient, as five different routes could completely bypass it. Similarly, agents could specify a different binary or an output directory outside the allowed list, circumventing intended restrictions.

Perhaps the most concerning finding highlighted the danger of vulnerability chaining. Raptor's design included cryptographically signing logs with an HMAC using a secret key stored on the file system. While this seemed robust in isolation, the combination of the user namespace vulnerability (allowing key access) and the ability to write logs meant that a malicious agent could read the secret key, resign its own nefarious logs, and effectively make them appear legitimate. This demonstrated a critical failure in the overall security posture, as the integrity of audit trails could be completely compromised.

Finally, the concept of graceful degradation, where the sandbox falls back to less secure configurations (a "ladder-type system"), proved to be a significant weakness. Cuthbert noted that "the vast majority of harnesses that we've tested today are sitting on that bottom rung," meaning they operated in "YOLO mode" with virtually no sandboxing. While initial startup checks might pass, subsequent agent calls could still abuse functionalities, indicating that a fallback strategy must be carefully re-evaluated, potentially favoring outright refusal over insecure degradation. This led to a massive increase in testing efforts, from 250 tests to 3,656, to rigorously validate every possible escape route.

Technical Deep Dive

▶ Watch: Most bothersome bug: Chaining vulnerabilities to resign logs (13:00)

Raptor's sandbox was architected with a multi-layered approach, primarily focusing on Linux and macOS environments. On Linux, the full stack integrated namespaces (providing isolated views of processes and networks), a private file system, a fake home directory (to prevent access to sensitive user files), Landlock, and seccomp. A proxy was also included to mediate external network calls, acknowledging the potential risks of agent-initiated internet communication.

The core process isolation model relied on a double-forking mechanism:

  1. Parent Process: This initial process holds sensitive information like session keys and credentials, designed to remain outside the untrusted execution environment.
  2. Child Process (Factory Worker): Forked from the parent, this process is responsible for setting up the sandbox environment, including creating namespaces and configuring networking.
  3. Grandchild Process: Forked from the child, this is where the "ugly payload" (the untrusted code generated by the agent) is executed. The intention was for this grandchild process to be completely isolated from the parent's sensitive data.

The "graceful fallback" or "ladder" system was designed to adapt to varying host capabilities. It ranked sandboxing levels from the full Linux stack down to "just vibes" (no sandbox), depending on the availability of features like private file systems, namespaces, Landlock, and seccomp.

However, this elegant design was undermined by several critical technical flaws:

1. User Namespace and Credential Leakage (The "Assumption Has a Hole" Bug):

The initial implementation for isolating procfs involved mounting a fresh /proc with Landlock and seccomp. The critical oversight occurred because the child process, which sets up the user namespace for the grandchild, inadvertently joined the parent's user namespace. This meant that the grandchild, despite its intended isolation, inherited the parent's environmental variables, including API tokens and session credentials. Linux, contrary to the team's assumption, did not deny access to these host processes because the payload's user namespace was still effectively connected to the parent's environment. This allowed the untrusted payload to directly read sensitive data from the parent process.

2. API Key Management Flaws:

Raptor supported various front-end and open-weight LLM models, often requiring API keys. While the design included an opt-in mechanism for passing these keys, the default flag for the LLM worker allowed it to carry API keys even when not explicitly opted in. Crucially, the architecture lacked a robust mechanism to determine if these keys were actually used by the agent, creating a blind spot for potential misuse or leakage.

3. Fail-Open Network Blocking:

The network blocking feature, activated by block_network=true, intended to utilize network namespaces or Landlock's TCP deny capabilities. The flaw was that if both of these primary mechanisms were unavailable or failed to apply correctly, the system would fail open, meaning network access was granted by default. Furthermore, a specific bug related to supplying a port_list (e.g., --allow-ports 443) would completely bypass the entire network blocking logic, leaving all ports open. The team also observed inconsistent behavior where the first agent query received a response, but subsequent agents did not, indicating deeper issues with network state management.

4. Sandbox Bypass Routes:

Beyond network issues, several other bypasses were discovered:

  • Landlock Check Bypass: The initial Landlock enforcement check at startup could be bypassed through five different execution routes.
  • Binary Execution Bypass: If an agent specified a binary different from the one explicitly allowed, the sandbox checks were ignored.
  • Output Directory Bypass: Similarly, writing to an output directory not explicitly allowed could bypass restrictions.

5. Compromised Log Integrity:

To ensure auditability, Raptor cryptographically signed its logs using HMAC with a secret key. This key, however, was stored on the file system, not in a hardware security module (HSM). The critical vulnerability here was the ability to chain exploits: the user namespace flaw allowed a malicious agent to read this secret key. Once the key was compromised, the agent could then resign its own malicious logs, making them indistinguishable from legitimate ones and completely undermining the integrity of the audit trail.

These technical challenges underscored the immense difficulty of writing secure sandboxes, particularly when dealing with the dynamic and unpredictable nature of agentic systems and the subtle interactions between various OS security primitives.

Demo / Proof of Concept

▶ Watch: Future plans: Agent run receipts and canary tokens (17:30)

While Daniel Cuthbert's talk did not feature a live demonstration of an agent actively exploiting a vulnerability, it did present several key scenarios and observed behaviors that served as proofs of concept for the sandbox's challenges and failures. The talk was inherently a "humility talk," focusing on the discovery of vulnerabilities during development and testing rather than showcasing active exploitation.

One notable "test" or demonstration involved attempting to run Raptor on a macOS machine. Cuthbert recounted, "on this Mac running Raptor, I've already got a sandbox. I tried to run it and amazingly sandbox exec, which is seatbelt's profile, could not be applied because there was already a sandbox and the whole lot failed." This specific outcome, where the host's existing macOS sandbox (sandbox exec) prevented Raptor's own sandbox from being applied, highlights a complex interaction between multiple sandboxing layers and the challenges in orchestrating them. While not an exploit of Raptor's vulnerabilities, it demonstrated an unexpected refusal state due to conflicting security policies.

Further proof-of-concept scenarios were derived from Raptor's extensive CI/CD pipeline testing. The team implemented around 500 tests initially, growing to 3,656 tests, specifically designed to identify sandbox escapes. Cuthbert shared an example where a test involving creating user isolation followed by a pause, and then process isolation, resulted in denials even for legitimate actions on a real runner. This timing-dependent failure was significant, with "10 failures out of three runs" observed in real-world CI/CD environments (e.g., Ubuntu on GitHub or GitLab with AppArmor). This demonstrated how subtle timing issues could lead to unexpected behavior and security gaps, forcing a substantial redesign of Raptor's development process.

The "demo" aspect of this talk was therefore less about a theatrical exploit and more about a rigorous, developer-centric approach to identifying and validating sandbox weaknesses through extensive, automated testing and real-world deployment observations. These findings served as concrete evidence of the vulnerabilities and the profound difficulty in achieving truly robust isolation.

Defensive Implications

▶ Watch: Key takeaways and call for more sandbox research (20:00)

The insights gained from Raptor's sandbox development offer critical defensive implications for any organization or individual dealing with untrusted code execution, especially in the context of AI agents. The overarching message is clear: assume your sandbox is flawed until proven otherwise through exhaustive testing.

  1. Prioritize Refusal Over Graceful Degradation: The "YOLO mode" of sandboxing, where a system defaults to no isolation if robust controls aren't available, is a severe risk. Defenders should adopt a fail-safe approach: "if you can't enforce the protection, just refuse. Drop it out straight away." This means if the required sandboxing primitives (e.g., Landlock, namespaces) are not fully supported or correctly configured, the untrusted code execution should be aborted rather than allowed to run with degraded security.
  1. Implement Comprehensive and Continuous Testing: The exponential growth in Raptor's test suite (from 250 to 3,656 tests) underscores the necessity of continuous, adversarial testing. Organizations must invest in building extensive test cases that cover "every possible way that an agent could break out of our sandbox," including various execution paths, file system interactions, and network behaviors. Testing should include timing-dependent scenarios, as demonstrated by the CI/CD failures.
  1. Strict Isolation of Sensitive Data: The "assumption has a hole" bug highlighted the danger of parent processes leaking environmental variables and credentials to child processes. All sensitive information—API keys, session tokens, signing keys—must be strictly isolated and never accessible to the untrusted execution environment. If keys are necessary for agent functions, they should be provided through secure, one-time mechanisms or proxies, rather than inherited environments. Storing cryptographic keys (e.g., for log signing) on the file system, even in "safe" places, is risky if other vulnerabilities allow access.
  1. Fail-Closed Network Policies: Network blocking mechanisms must be designed to fail closed. If network isolation cannot be fully established, all outbound network access should be denied by default. Specific allowance of ports should be meticulously validated and not bypass broader network blocking logic.
  1. Enhanced Visibility into Agent Actions: Defenders need granular insight into what agents are attempting to do. Implementing "run receipts" (as planned for Raptor 3.2) to capture a full breakdown of agent actions (e.g., attempted SSH key access, writes to forbidden directories, network calls) is crucial. The use of canary tokens—fake credentials (database URLs, SSH keys, environment variables) provided to agents—can serve as an early warning system for unauthorized access attempts.
  1. Dedicated Isolation Environments: For truly untrusted code, the most robust defense is dedicated virtualization. The future vision for Raptor involves running agents within "throwaway VMs" (e.g., Firecracker or KVM) per job. This provides a clean, ephemeral, and hardware-isolated environment that minimizes the risk of host compromise. Cloud-native containerization technologies can also offer strong isolation if configured correctly.
  1. "Set It Up First, Then Lockdown Second": Ensure the sandboxing environment is correctly configured and instantiated before any untrusted code is allowed to run. Initial checks are not enough; continuous enforcement and validation throughout the agent's lifecycle are necessary.
  1. Renewed Research in Sandboxing: The talk emphasizes that sandboxing research "has kind of just fallen off the face of the earth" in recent years. The industry needs a renewed focus on foundational sandboxing technologies, especially for macOS, and innovative approaches that move beyond the current "ladder" system towards OS-level capabilities that automatically enforce protection based on agent descriptions.

Key Takeaways

  • Sandboxing is Hard: Building robust sandboxes for agentic systems is an extremely complex undertaking, prone to subtle flaws and bypasses that even experienced security researchers can overlook.
  • Refuse, Don't Degrade: When strong security controls cannot be fully enforced, it is safer to outright refuse execution of untrusted code rather than "gracefully degrading" to an insecure "YOLO mode."
  • Test Everything, Continuously: Comprehensive, adversarial testing is paramount. Developers must anticipate every possible escape route and continuously validate sandbox integrity throughout the development and deployment lifecycle.
  • Isolate Sensitive Data Rigorously: Critical assets like API keys, session credentials, and cryptographic signing keys must be strictly isolated and never accessible to untrusted execution environments, preventing vulnerability chaining.
  • Monitor Agent Intent and Actions: Implement mechanisms like "run receipts" and "canary tokens" to gain deep visibility into what AI agents are attempting to do, enabling early detection of malicious or unintended behavior.
  • Embrace Virtualization for Untrusted Code: For the highest level of security, execute untrusted agent code in dedicated, ephemeral virtualized environments (e.g., Firecracker, KVM) to achieve robust hardware isolation.

About the Speaker(s)

Daniel Cuthbert is a distinguished Security Researcher, introduced by Gadi as a person of "endless energy" who "was there when the deep magic was written" and "when hacking culture was young." He is celebrated for his willingness to assist others with technical challenges, Black Hat submissions, and various projects. Daniel is a co-creator of Raptor, the open-source security tool central to this talk, and played a pivotal role in its development, particularly in architecting and securing its sandbox. His candid presentation style, openly sharing the team's failures and learnings, underscores his commitment to advancing community knowledge in security.

The talk also highlighted the contributions of Gadi, who initially conceived the idea of leveraging LLMs for bug finding in Raptor, steering the project's innovative direction. JC was another key collaborator, working closely with Daniel on building the sandbox and diligently identifying numerous bugs. Additionally, Michael contributed to the code development of the sandbox, rounding out the core team behind Raptor's challenging but ultimately illuminating journey.

Reviews

  • Dr. Zero (Offensive Security Researcher) — MUST SEE ★★★★★

→ Top-rated talks at [un]prompted II 2026 — The AI Security Practitioner Conference

All talks from [un]prompted II 2026 — The AI Security Practitioner Conference