High severity · published May 5, 2026
CVE-2026-40068
Claude Code arbitrary code execution via git worktree commondir trust dialog bypass
8.8
CVSS
0.3%
EPSS
No
On KEV
Description
In versions 2.1.63 through 2.1.83 of Claude Code, the folder trust determination logic used the git worktree commondir file without validating its contents. An attacker could craft a malicious repository with a commondir file pointing to a path the victim had previously trusted, causing Claude Code to bypass its trust confirmation dialog and immediately execute hooks defined in `.claude/settings.json`. Exploitation requires the victim to clone the malicious repository and run Claude Code within it, and the attacker must know or guess a path the victim had already trusted. This issue has been fixed in version 2.1.84.
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Attack vector
Network
Complexity
Low
Privileges
None
User interaction
Required
Confidentiality
High
Integrity
High
Availability
High
Scope
Unchanged
Exploitation
Is it being used?
Exploit prediction (EPSS)0.3% · higher than 24% of CVEs
Exploited in the wildNo evidence yet
CISA KEVNot listed
Ransomware campaign useNot known
Affected products
Which versions
CL
claude-code · anthropics
>= 2.1.63, < 2.1.84 · source: vendor
CC
Claude Code · Anthropic
2.1.63 before 2.1.84 · source: NVD
References
NVD
https://nvd.nist.gov/vuln/detail/CVE-2026-40068
CVE.org
https://www.cve.org/CVERecord?id=CVE-2026-40068
Vendor Advisory
https://github.com/anthropics/claude-code/security/advisories/GHSA-q5hj-mxqh-vv77
More from claude-code
10.0
CVE-2026-39861
Claude Code: Sandbox Escape via Symlink Following Allows Arbitrary File Write Outside Workspace
10.0
CVE-2026-25725
Claude Code Has Sandbox Escape via Persistent Configuration Injection in settings.json
9.8
CVE-2025-66032
Claude Code Command Validation Bypass Allows Arbitrary Code Execution
9.8
CVE-2025-64755
@anthropic-ai/claude-code has Sed Command Validation Bypass that Allows Arbitrary File Writes
9.8
CVE-2025-65099
Claude Code vulnerable to command execution prior to startup trust dialog
