Severity by source
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
Malicious repo is network-delivered (AV:N) but needs symlink/fsmonitor chaining (AC:H) and the victim to clone and run the tool (UI:R); the sandbox escape changes scope (S:C) with full host code execution (C/I/A:H).
Primary rating from Vendor (GitHub_M).
CVSS VectorVendor: GitHub_M
Lifecycle Timeline
2DescriptionCVE.org
Claude Code is an agentic coding tool. From 2.1.38 until 2.1.163, 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. This vulnerability is fixed in 2.1.163.
AnalysisAI
Sandbox escape and code execution in Anthropic's Claude Code CLI (versions 2.1.38 through 2.1.162) lets a malicious repository break out of the macOS seatbelt sandbox by abusing git worktree handling. By creating a worktree named ".git" and combining symlink manipulation with git fsmonitor execution, an attacker can overwrite files in the user's home directory such as .zshenv to achieve code execution outside the sandbox. There is no public exploit identified at time of analysis and the issue is not in CISA KEV, but exploitation is realistic since it only requires a user to clone and open a booby-trapped repo; it is fixed in 2.1.163.
Technical ContextAI
Claude Code is an agentic command-line coding assistant that runs untrusted repository content inside a macOS seatbelt sandbox to contain side effects. The flaw is a CWE-22 path traversal / git directory confusion in the tool's git worktree feature: git resolves the special ".git" path to locate repository metadata and hooks, so allowing a worktree named ".git" and permitting navigation to worktrees outside the sandboxed context lets an attacker control which directory git treats as the repo. The exploit weaponizes git's fsmonitor mechanism (a configurable program git runs automatically during worktree operations) together with symlinks, so file writes intended for the worktree are redirected into the user's home directory. Shells source startup files such as .zshenv on launch, turning an arbitrary file overwrite into host code execution outside the seatbelt confinement. Per the supplied CPE (cpe:2.3:a:anthropics:claude-code), the affected component is the Claude Code application itself rather than git.
RemediationAI
Vendor-released patch: 2.1.163 - upgrade Claude Code to 2.1.163 or later, which fixes the worktree handling, per advisory GHSA-7835-87q9-rgvv (https://github.com/anthropics/claude-code/security/advisories/GHSA-7835-87q9-rgvv). Until patched, the most effective compensating control is to avoid cloning or running Claude Code against untrusted or unfamiliar repositories, since exploitation requires opening a malicious repo; treat third-party repos as hostile and inspect them (especially for unusual worktrees, symlinks, and git core.fsmonitor configuration or hooks) before pointing the tool at them. Where feasible, run Claude Code on disposable or strongly isolated machines or containers so a sandbox escape does not reach a trusted home directory, accepting the trade-off of reduced convenience and added setup overhead. Do not rely on the seatbelt sandbox alone as a trust boundary for untrusted code on vulnerable versions.
More in Claude Code
View allOS command injection in Anthropic Claude Code CLI and Agent SDK for Python allows remote, unauthenticated attackers to e
OS command injection in Anthropic Claude Code CLI and Claude Agent SDK for Python allows local attackers to execute arbi
OS command injection in Anthropic Claude Code CLI and Claude Agent SDK for Python enables arbitrary command execution vi
Claude Code prior to version 2.1.2 has a CVSS 10.0 sandbox escape in the bubblewrap sandboxing mechanism, allowing code
Claude Code is an agentic coding tool. Prior to 1.0.93, Due to errors in parsing shell commands related to $IFS and shor
Claude Code prior to version 2.0.57 failed to properly validate MCP tool inputs, allowing malicious MCP servers to injec
Claude Code is an agentic coding tool. Versions before 1.0.111 were vulnerable to Code Injection due to a bug in the sta
Claude Code versions before 2.0.72 allow authenticated attackers to execute arbitrary commands by exploiting a command p
Sandbox escape in Claude Code versions prior to 2.1.64 enables arbitrary file writes outside the workspace by exploiting
Claude Code is an agentic coding tool. Rated high severity (CVSS 7.7), this vulnerability is remotely exploitable, no au
Claude Code versions prior to 2.0.65 allow attackers to steal Anthropic API keys from users by crafting malicious reposi
Claude Code versions prior to 1.0.111 fail to properly validate trusted domains for WebFetch requests, allowing attacker
Same weakness CWE-22 – Path Traversal
View allVendor StatusVendor
Share
External POC / Exploit Code
Leaving vuln.today
EUVD-2026-40117
GHSA-7835-87q9-rgvv