{"id":"CVE-2026-40068","aliases":["CVE-2026-40068","GHSA-q5hj-mxqh-vv77"],"related":[],"kind":"vulnerability","state":"published","title":"Claude Code arbitrary code execution via git worktree commondir trust dialog bypass","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"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.","format":"markdown","source":"ghsa"},{"lang":"es","text":"En las versiones 2.1.63 a 2.1.83 de Claude Code, la lógica de determinación de confianza de carpetas utilizaba el archivo git worktree commondir sin validar su contenido. Un atacante podría crear un repositorio malicioso con un archivo commondir apuntando a una ruta en la que la víctima había confiado previamente, lo que haría que Claude Code omitiera su diálogo de confirmación de confianza y ejecutara inmediatamente los hooks definidos en '.claude/settings.json'. La explotación requiere que la víctima clone el repositorio malicioso y ejecute Claude Code dentro de él, y que el atacante conozca o adivine una ruta en la que la víctima ya había confiado. Este problema ha sido solucionado en la versión 2.1.84.","source":"nvd"}],"published":"2026-04-24T16:34:03.000Z","modified":"2026-07-24T21:10:00.143Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"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","score":7.7,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"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","score":7.7,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"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","rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","score":8.8,"rating":"HIGH"}],"cwes":["CWE-20","CWE-77"],"affected":[{"ranges":[{"version":">= 2.1.63, < 2.1.84","status":"affected"}],"vendor":"anthropics","product":"claude-code","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"2.1.63","status":"affected","fixed":"2.1.84"}],"ecosystem":"npm","package":"@anthropic-ai/claude-code","purl":"pkg:npm/%40anthropic-ai/claude-code","source":"ghsa"},{"ranges":[{"status":"affected","introduced":"2.1.63","fixed":"2.1.84"}],"vendor":"anthropic","product":"claude_code","cpe":"cpe:2.3:a:anthropic:claude_code:*:*:*:*:*:node.js:*:*","source":"nvd"}],"references":[{"url":"https://github.com/anthropics/claude-code/security/advisories/GHSA-q5hj-mxqh-vv77","tags":["vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-40068","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/anthropics/claude-code","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"total","date":"2026-05-06T14:50:01.382Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-40068","url":"https://www.cve.org/CVERecord?id=CVE-2026-40068","licence":"CVE Terms of Use","modified":"2026-05-06T15:24:52.454Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-q5hj-mxqh-vv77","url":"https://github.com/advisories/GHSA-q5hj-mxqh-vv77","licence":"CC-BY-4.0","modified":"2026-05-08T15:50:36.976Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-40068","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-40068","licence":"Public domain","modified":"2026-07-24T21:10:00.143Z"}],"updatedAt":"2026-11-25T22:59:20.648Z","epss":{"score":0.00314,"percentile":0.26247,"date":"2026-12-01T12:00:22.000Z"}}