CVE-2026-40068: CWE-20: Improper Input Validation in anthropics claude-code
CVE-2026-40068 is a high-severity vulnerability in anthropics claude-code versions 2. 1. 63 through 2. 1. 83. The issue arises from improper input validation of the git worktree commondir file used in folder trust determination logic. An attacker can craft a malicious repository with a commondir file referencing a path the victim previously trusted, causing claude-code to bypass its trust confirmation dialog and execute hooks defined in . claude/settings. json without user approval. Exploitation requires the victim to clone the malicious repository and run claude-code within it, and the attacker must know or guess a trusted path.
AI Analysis
Technical Summary
In anthropics claude-code versions 2.1.63 to 2.1.83, the folder trust determination logic does not validate the contents of the git worktree commondir file. This allows an attacker to craft a malicious repository with a commondir file pointing to a previously trusted path, bypassing the trust confirmation dialog. As a result, hooks defined in .claude/settings.json execute immediately upon running claude-code in the malicious repository. The vulnerability requires user interaction (cloning and running the repository) and knowledge or guessing of a trusted path. The issue is addressed in version 2.1.84.
Potential Impact
Successful exploitation allows an attacker to bypass the trust confirmation dialog and execute arbitrary hooks defined in the .claude/settings.json file. This could lead to execution of malicious code within the context of claude-code, potentially compromising the user's environment. The attack requires user action and some knowledge about the victim's trusted paths. There are no known exploits in the wild at this time.
Mitigation Recommendations
This vulnerability has been fixed in anthropics claude-code version 2.1.84. Users should upgrade to version 2.1.84 or later to remediate this issue. Until upgrading, users should avoid cloning and running claude-code in untrusted repositories, especially those that might contain manipulated commondir files. Patch status is not explicitly stated in the vendor advisory, but the fix is included in version 2.1.84.
CVE-2026-40068: CWE-20: Improper Input Validation in anthropics claude-code
Description
CVE-2026-40068 is a high-severity vulnerability in anthropics claude-code versions 2. 1. 63 through 2. 1. 83. The issue arises from improper input validation of the git worktree commondir file used in folder trust determination logic. An attacker can craft a malicious repository with a commondir file referencing a path the victim previously trusted, causing claude-code to bypass its trust confirmation dialog and execute hooks defined in . claude/settings. json without user approval. Exploitation requires the victim to clone the malicious repository and run claude-code within it, and the attacker must know or guess a trusted path.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
In anthropics claude-code versions 2.1.63 to 2.1.83, the folder trust determination logic does not validate the contents of the git worktree commondir file. This allows an attacker to craft a malicious repository with a commondir file pointing to a previously trusted path, bypassing the trust confirmation dialog. As a result, hooks defined in .claude/settings.json execute immediately upon running claude-code in the malicious repository. The vulnerability requires user interaction (cloning and running the repository) and knowledge or guessing of a trusted path. The issue is addressed in version 2.1.84.
Potential Impact
Successful exploitation allows an attacker to bypass the trust confirmation dialog and execute arbitrary hooks defined in the .claude/settings.json file. This could lead to execution of malicious code within the context of claude-code, potentially compromising the user's environment. The attack requires user action and some knowledge about the victim's trusted paths. There are no known exploits in the wild at this time.
Mitigation Recommendations
This vulnerability has been fixed in anthropics claude-code version 2.1.84. Users should upgrade to version 2.1.84 or later to remediate this issue. Until upgrading, users should avoid cloning and running claude-code in untrusted repositories, especially those that might contain manipulated commondir files. Patch status is not explicitly stated in the vendor advisory, but the fix is included in version 2.1.84.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-04-09T00:39:12.204Z
- Cvss Version
- 4.0
- State
- PUBLISHED
- Remediation Level
- null
Threat ID: 69fa5fd1cbff5d8610282e49
Added to database: 5/5/2026, 9:23:29 PM
Last enriched: 5/5/2026, 9:36:30 PM
Last updated: 5/5/2026, 10:29:06 PM
Views: 2
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
External Links
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.