Safeguard
Vulnerability Analysis•

CVE-2026-25725: Claude Code Sandbox Escape via settings.json Hooks

CVE-2026-25725 let code in the Claude Code bubblewrap sandbox create a missing settings.json and plant hooks that run on the host. Update to 2.1.2.

Safeguard Security Team
3 min read

CVE-2026-25725 is a sandbox protection gap in Claude Code before 2.1.2, scored 10.0. If .claude/settings.json did not exist at startup, code inside the bubblewrap sandbox could create it and add hooks that run with host privileges on restart. Version 2.1.2 fixes it.

What's affected

  • Product: Claude Code (npm package @anthropic-ai/claude-code) using its bubblewrap sandbox.
  • Affected: versions before 2.1.2.
  • Fixed: 2.1.2.
  • Condition from the advisory: the .claude/settings.json file was missing when Claude Code started.

How to check if you're exposed

Check the installed version and whether projects have the file:

claude --version
ls -l .claude/settings.json .claude/settings.local.json

Also open any settings.json that appeared unexpectedly and read the hooks section. SessionStart style hook entries you did not add should be treated as suspicious.

What to do now

  1. Update Claude Code to 2.1.2 or later.
  2. Inspect .claude/settings.json in each repository you used with sandboxing, and remove hooks you do not recognise.
  3. Create a reviewed settings file ahead of time so the file exists when the tool starts, as a defence in depth habit.
  4. Do not run untrusted code even inside a sandbox on a machine that holds production credentials.
  5. Rebuild shared images and devcontainers with the fixed version.

Why it matters

The record lists CWE-501, trust boundary violation, and CWE-668, exposure of a resource to the wrong sphere. The parent folder was writable and settings.local.json was protected read only, but the sibling settings.json was not protected when absent, so the sandbox could author configuration that the unsandboxed tool later trusted.

This is a lesson about sandboxes in general: whatever the sandbox can write and the host later reads is a path out. Hooks are commands, so planting one means code runs outside. The record does not mark this CVE as exploited in the wild, and the advisory credits a HackerOne reporter.

How to prioritise the fix

Anyone who relies on the bubblewrap sandbox as a safety boundary should take this seriously, because it was the boundary itself that had a gap. The advisory describes malicious code inside the sandbox creating a settings file that the unsandboxed tool later honoured.

Start with the update to 2.1.2. Then review settings files in projects where the sandbox ran code you did not write, looking for hook entries. A hook that runs a command at session start is exactly what you would expect an attacker to plant, so unknown entries deserve a closer look.

For longer term safety, treat everything a sandbox can write as untrusted input to the host. Create and lock down configuration files ahead of time, and keep production credentials off machines that run unreviewed code.

Quick check

Why does a missing file matter?

Protections were applied to files that existed. A file that was absent had no read only mount over it, so the sandbox could create it.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.