Sandbox Escape via Git Worktree Path Confusion Allows Unsandboxed Code Execution
High7.7CVE-2026-55607 · Published Jun 25, 2026
Claude Code's worktree handling allowed creation of worktrees named ".git" and navigation to worktrees outside the sandbox context, enabling git directory confusion attacks. By exploiting symlink manipulation and git fsmonitor execution during worktree operations, an attacker could overwrite files in the user's home directory (such as .zshenv), leading to code execution outside of seatbelt sandbox restrictions. Reliably exploiting this required the user to clone a malicious repository containing prompt injection content and run Claude Code against it. Users on standard Claude Code auto-update have received this fix automatically. Users performing manual updates are advised to update to the latest version. Thank you to hackerone.com/metnew for reporting this issue.
Affected versions
| Package | Affected | Fixed in |
|---|---|---|
| @anthropic-ai/claude-code npm | >= 2.1.38, < 2.1.163 | 2.1.163 |
Details and references
More Anthropic advisories
All Anthropic| Date | Advisory | Severity | Fixed in |
|---|---|---|---|
| Jul 1 | Memory Exhaustion Denial of Service in decode_unknown_field via Unbounded Allocation | Medium6.3 | 0.8.0+1 more |
| Jul 1 | Use-After-Free in OwnedView via Unsound 'static Lifetime Promotion in Deref | Medium5.9 | 0.7.0 |
| Jun 25 | Insecure Temporary File in /copy Command Enables Response Disclosure and Symlink-Based File Write | Medium4.4 | 2.1.128 |
| Jun 13 | Out-of-Band Data Exfiltration via Pre-Approved HuggingFace Domain in WebFetch | Medium6.0 | 2.1.163 |
| May 20 | Malicious MCP Server Configuration in PRs Enables Remote Code Execution and Secret Exfiltration | Medium5.3 | 1.0.74 |
| May 6 | SSH Host Key Verification Bypass Allows Man-in-the-Middle Attack on Remote Sessions | High7.4 | 1.4304.0 |