AIDEFEND in Action AIA-0195 Validated Research

Claude Code Sandbox Fail-Open: Allowing No Network Domains Switched Network Restriction Off

Claude Code can run commands in a sandbox. Its network allowlist was supposed to block every connection when left empty. A bug in older versions of the sandbox library instead disabled the network restriction. A researcher reproduced the problem in Claude Code. The library was fixed in 0.0.16, and Claude Code included the fix in 2.0.55.

Data ExfiltrationRuntime IsolationAI Coding Agent
3 applicable AIDEFEND defenses
Source: Network Sandboxing Escape (@anthropic-ai/sandbox-runtime, GHSA-9gqj-5w7c-vx47) 
Authors: @ddworken (Anthropic); reporter credited: bendrucker
Original article: Dec 4, 2025

Threat Analysis

  • What the sandbox is supposed to do. Claude Code runs shell commands on the developer's machine to build, test and change code. With sandboxing turned on, those commands and the processes they start run inside an operating-system boundary (Seatbelt on macOS, bubblewrap on Linux), and their network traffic is meant to pass through a proxy outside the sandbox that only lets through allowed domains. Anthropic's engineering post introducing the feature explains why the network half matters: without network isolation, an agent that has been compromised, for example through prompt injection (instructions hidden in content the agent reads), could send sensitive files such as SSH keys to an outside server. The open-source library that implements the boundary, @anthropic-ai/sandbox-runtime, documents its network policy as allow-only: all network access is denied by default, a domain is reachable only if it is listed in allowedDomains, and an empty list means no network access.
  • How an empty list became no restriction. Before version 0.0.16, the library decided whether to restrict a command's network by checking whether the allowlist had any entries. A list with entries started the filtering proxy and confined the command to it. An empty list was read as nothing to filter, so the command was launched with no network restriction at all and no proxy decision was involved. The strictest setting produced the weakest result, on macOS and Linux alike: a sandbox meant to allow no network could reach any host, internal or external. Nobody had to get around anything; the restriction was simply not applied, which makes this a fail-open flaw (a security check that, faced with an edge case, lets everything through instead of blocking). The fix, committed on November 24, 2025 and released as 0.0.16, separates whether to restrict the network from whether to start the proxy: a configured allowlist, even an empty one, now turns network restriction on, and the proxy starts only when there are domains to allow.
  • Who was exposed, and what was shown. Only sandboxes whose network policy allowed no domains were affected; a policy listing at least one domain was still filtered through the proxy. Those are the users who had asked for the strictest isolation. GitHub user bendrucker noticed the problem while testing Claude Code's sandbox in a container whose settings were much sparser than his usual ones: with strict sandboxing turned on, he got no permission prompts for network access, and reading the library's code showed why. Researcher Aonan Guan, who reported the same flaw separately, set an empty allowlist in Claude Code 2.0.50 on Linux and reports that in his controlled test, commands inside the sandbox could scan the internal network and send data to an external server. For that to cause harm, something running in the sandbox has to open the connection, such as a command the agent was steered into by prompt injection or untrusted code the agent was asked to run. No public information currently shows the flaw being used in a real attack, and the CISA assessment attached to the CVE record lists no known exploitation.
  • Disclosure, fix and credit. bendrucker opened public pull request #45 on November 18, 2025 (US time), pointing out that the code did not match the documentation; Guan reported the flaw to Anthropic through HackerOne on November 21. Anthropic fixed it in its own commit on November 24 and closed the pull request without merging it. Claude Code 2.0.55, released on November 26, includes the fix (Guan found 2.0.54 still affected), yet its release note says only that proxy DNS resolution is no longer forced on by default. The GitHub advisory GHSA-9gqj-5w7c-vx47 and CVE-2025-66479 (a CVE number identifies a publicly disclosed vulnerability) were published on December 4. They cover only @anthropic-ai/sandbox-runtime versions earlier than 0.0.16, credit bendrucker, and rate the flaw 1.8 (Low) under CVSS v4, a score that assumes a local attacker with high privileges and specific preconditions. Claude Code received no CVE or advisory of its own; Anthropic told Guan that the root cause was in the library. Guan argues that the score understates the risk for users who relied on the documented isolation.
  • A second network bypass in 2026. SecurityWeek reported on May 20, 2026 that Guan later found a separate way around the Claude Code network sandbox and reported it on April 3, 2026. Anthropic said its security team had already found and fixed the issue, in a public sandbox-runtime commit on March 27 that shipped in Claude Code 2.1.88 on March 31, and marked the report as a duplicate; Guan says the problem remained until version 2.1.90 in April. That bypass received no CVE and was not mentioned in release notes. Two separate failures of the same boundary were fixed about four months apart, and neither came with a prominent notice to Claude Code users, so release notes alone would not have told a team that its sandbox's network restriction had a gap.
  • Why reading the configuration was not enough. Anyone reviewing a settings file with an empty allowlist would conclude that the sandbox blocks all network access. The flaw lived in how the runtime interpreted that value, so a configuration review, a policy check on the settings file or a drift monitor would all have reported the intended state. Only a test run from inside the sandbox, trying to reach a host that should be refused, would have shown the difference between what the configuration said and what the sandbox did.

Applicable AIDEFEND Defenses (3)

AID-I-001.004
Sandbox Network Egress Restrictions
Very High
The sandbox's own network rule failed open, so the outbound block has to sit where the sandbox's configuration logic cannot switch it off. On the container, VM, CI runner or host firewall that encloses Claude Code sessions, block outbound connections by default and allow only the destinations the work needs, such as the model API and approved package mirrors. With that rule in place, a sandboxed command the runtime forgot to restrict still cannot reach other hosts, internal or external. The control also requires a probe from inside the sandbox: show that an unapproved host is reachable from an unrestricted machine, then confirm the sandbox is refused when it tries to reach it, while approved hosts still work. That probe is the check that would have exposed the empty-allowlist flaw before anyone relied on it, and refused attempts at the outer layer leave a log entry. It does not limit what is sent to an approved destination, the Claude Code process still needs its own approved connections, and developer laptops without an outer container or host-level egress rule fall back on the sandbox alone.
AID-H-003.010
Deployed AI Software Vulnerability Remediation Lifecycle
Very High
For the two flaws already known, the fix exists and the work is getting it onto every machine. Update Claude Code on developer machines and rebuild CI and container images with release 2.1.90 or later, which covers both CVE-2025-66479 (fixed in 2.0.55) and the 2026 bypass (2.1.88 by Anthropic's account, 2.1.90 by Guan's); roll the update out in stages and read the version back from each running environment rather than from an install script. Projects that embed @anthropic-ai/sandbox-runtime directly rebuild against 0.0.16 or later and keep the library current. Once the fixed version runs, an empty allowlist turns network restriction on, and the closing check is a connection test from inside the sandbox that must fail. An update removes the flaws that have been fixed and nothing more, which is why the outer egress rule stays in place.
AID-I-001.002
MicroVM & Low-Level Sandboxing
Medium
Network isolation was there to stop files such as SSH keys from leaving, so the second boundary is what sandboxed commands can read. Claude Code's sandbox lets commands read most of the machine by default, including ~/.ssh and ~/.aws/credentials. Listing credential locations such as ~/.ssh, cloud credential directories and .env files as denied paths in the sandbox's credential or read-deny settings keeps those files out of reach of every sandboxed command, so an open network path has less to carry; listing long-lived tokens as variables to unset, or not exporting them in the shell that starts Claude Code, does the same for the environment. Check it by placing a canary file in a denied path and reading it from inside the sandbox; the read must fail. Source code and the rest of the workspace stay readable by design and internal hosts stay reachable, so this is only a compensating control that limits the damage of a network failure.

What Defenders Should Do Now

  • Read the running version, then update. On every developer machine and CI image that runs Claude Code, read the installed version with claude --version. Releases earlier than 2.0.55 carry CVE-2025-66479, and releases earlier than 2.1.88 (2.1.90 by Guan's account) carry the 2026 bypass, so update anything earlier than 2.1.90 to a current release. Claude Code's npm package does not list the sandbox library as a separate dependency, so check the Claude Code version itself rather than a package listing. Projects that build their own sandboxes on @anthropic-ai/sandbox-runtime check the installed library, upgrade anything earlier than 0.0.16 and keep it current. Where a machine cannot be updated yet, do not count on the sandbox to block network access there; run those sessions in a container or VM whose outbound connections are blocked outside the sandbox.
  • Test that no network really means no network. In a test environment that uses the same sandbox settings as production, including an empty allowlist if you use one, have a sandboxed command try to connect to a host that is not on the allowlist. First confirm from an unrestricted machine that this host is reachable, or a failed connection proves nothing. The test passes only if the connection fails; also confirm that a command which ignores proxy settings cannot connect, and that any host on the allowlist still works. Run it again after every Claude Code update and every change to the sandbox settings.
  • Add a network block the sandbox cannot switch off. For agent sessions that work on untrusted repositories, dependencies or web content, and for unattended runs in CI, run Claude Code inside a container, VM or runner whose outbound connections are blocked by default at the host or network layer and allowed only to approved destinations such as the model API and package mirrors. A bug in the sandbox's own configuration logic cannot change that rule. Log refused connections: if the outer layer refuses a connection from a session whose sandbox should already have blocked it, the sandbox did not.
  • Keep credentials out of what sandboxed commands can read. Network isolation exists to stop files such as SSH keys and cloud credentials from leaving, and Claude Code's documentation says the sandbox can read most of the machine by default, including ~/.ssh and ~/.aws/credentials. Deny sandboxed commands access to those paths and to .env files, and do not export long-lived tokens in the shell that starts Claude Code. Then place a canary file in one of the denied paths and read it from inside the sandbox; the read must fail.
  • Look back if you ran an empty allowlist on an affected version. If any machine ran a sandbox with an empty allowlist on Claude Code earlier than 2.0.55, or on an embedded library earlier than 0.0.16, and egress, proxy or endpoint logs for that period still exist, search them for connections from those machines' agent processes to external or internal addresses the work did not need. If those sessions handled untrusted content while credentials were readable, and the logs cannot rule such connections out, revoke the credentials at their issuer, issue replacements and confirm the old values are rejected.

1 additional consideration

Make security settings in your own tools fail closed

Teams that turn policy files into enforcement for their own agents, wrappers or sandboxes can repeat the mistake this library made.
Recommendation: Engineers who build agent platforms or sandbox wrappers, including on top of sandbox-runtime, can make their code apply the documented meaning of an empty list, a missing key and a malformed value, and fall back to blocking, or refuse to start, whenever a security setting cannot be interpreted. Add unit tests that cover each of those three inputs for every allowlist. These tests check the code that interprets the setting; they do not replace a connection test from inside the running sandbox.

Conclusion

An empty allowlist must block outbound traffic. AIDEFEND  points to deploying the fixed build and enforcing a separate network policy that the sandbox cannot turn off. Verify the result with a harmless request to an unapproved destination.

Last updated: