CVE-2026-40068: Claude Code Trust Dialog Bypass Vulnerability
HIGHCVE-2026-40068 is a HIGH trust dialog bypass vulnerability (CWE-20: Improper Input Validation) affecting Claude Code libraries in the npm ecosystem. The issue involves trust dialog bypass via git worktree spoofing allows arbitrary code execution. Remediation is available by upgrading affected packages to version 2.1.84.
CVE-2026-40068 at a Glance
How to Fix CVE-2026-40068
To remediate this vulnerability, upgrade all affected Claude Code dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install @anthropic-ai/claude-code@2.1.84
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls @anthropic-ai/claude-code
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2026-40068, inspect your project dependencies using npm:
npm ls @anthropic-ai/claude-code
Analyze the terminal output to locate any version of Claude Code in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.1.84), your application is affected.
Note: The npm ls @anthropic-ai/claude-code command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. In Claude Code, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-40068 Affected Claude Code Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
@anthropic-ai/claude-code
|
npm |
≥ 2.1.63
< 2.1.84
|
2.1.84
|
References
Frequently Asked Questions
What is CVE-2026-40068?
Which Claude Code versions are affected?
What version fixes CVE-2026-40068?
Is @anthropic-ai/claude-code affected?
What CWE is associated with CVE-2026-40068?
How can I check npm dependencies for CVE-2026-40068?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-q5hj-mxqh-vv77",
"modified" : "2026-05-08T15:31:35Z",
"published" : "2026-04-24T16:34:03Z",
"aliases" : [ "CVE-2026-40068" ],
"summary" : "Claude Code: Trust Dialog Bypass via Git Worktree Spoofing Allows Arbitrary Code Execution",
"details" : "Claude Code used the git worktree `commondir` file when determining folder trust but did not validate its contents. By crafting a repository with a `commondir` file pointing to a path the victim had previously trusted, an attacker could bypass the trust dialog and immediately execute malicious hooks defined in `.claude/settings.json`. Exploiting this required the victim to clone a malicious repository and run Claude Code within it, and for the attacker to know or guess a path the victim had already trusted.\n\nUsers on standard Claude Code auto-update have received this fix already. Users performing manual updates are advised to update to the latest version.\n\nClaude Code thanks [hackerone.com/masato_anzai](https://hackerone.com/masato_anzai) for reporting this issue.",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "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"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "@anthropic-ai/claude-code"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.1.63"
}, {
"fixed" : "2.1.84"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/anthropics/claude-code/security/advisories/GHSA-q5hj-mxqh-vv77"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-40068"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/anthropics/claude-code"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-20", "CWE-77" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-04-24T16:34:03Z",
"nvd_published_at" : "2026-05-05T21:16:23Z"
}
}