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 that points to a path the victim has previously trusted, causing Claude Code to bypass its trust confirmation dialog and execute hooks defined in . claude/settings.json without user consent. 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 on the victim's system.
AI Analysis
Technical Summary
In versions 2.1.63 through 2.1.83 of Claude Code, the folder trust determination logic improperly trusts the contents of the git worktree commondir file without validation. This allows an attacker who can supply a malicious repository with a crafted commondir file to cause Claude Code to bypass the trust confirmation dialog and immediately execute hooks defined in .claude/settings.json. Successful exploitation requires the victim to clone the malicious repository and run Claude Code within it, and the attacker must know or guess a path previously trusted by the victim. The vulnerability is addressed in version 2.1.84.
Potential Impact
An attacker can bypass the trust confirmation dialog in Claude Code and cause automatic execution of potentially malicious hooks, leading to unauthorized code execution within the context of the victim's environment. This could result in compromise of the victim's system or data if the attacker successfully exploits the vulnerability. No known exploits in the wild have been reported at this time.
Mitigation Recommendations
This vulnerability has been fixed in 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 within repositories from untrusted sources, especially if the attacker might know or guess trusted paths on the system. Patch status is confirmed fixed 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 that points to a path the victim has previously trusted, causing Claude Code to bypass its trust confirmation dialog and execute hooks defined in . claude/settings.json without user consent. 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 on the victim's system.
CVSS v4.0
Score 7.7high
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
In versions 2.1.63 through 2.1.83 of Claude Code, the folder trust determination logic improperly trusts the contents of the git worktree commondir file without validation. This allows an attacker who can supply a malicious repository with a crafted commondir file to cause Claude Code to bypass the trust confirmation dialog and immediately execute hooks defined in .claude/settings.json. Successful exploitation requires the victim to clone the malicious repository and run Claude Code within it, and the attacker must know or guess a path previously trusted by the victim. The vulnerability is addressed in version 2.1.84.
Potential Impact
An attacker can bypass the trust confirmation dialog in Claude Code and cause automatic execution of potentially malicious hooks, leading to unauthorized code execution within the context of the victim's environment. This could result in compromise of the victim's system or data if the attacker successfully exploits the vulnerability. No known exploits in the wild have been reported at this time.
Mitigation Recommendations
This vulnerability has been fixed in 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 within repositories from untrusted sources, especially if the attacker might know or guess trusted paths on the system. Patch status is confirmed fixed 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/13/2026, 3:47:58 AM
Last updated: 6/20/2026, 5:22:43 AM
Views: 209
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.