Skip to content

AAK-CLAUDECODE-CVE-2026-40068-PIN-001: Anthropic Claude Code below 2.1.251: folder-trust bypass (CVE-2026-40068), write-time symlink following (CVE-2026-103435, CVE-2026-88968) and plugin commit-pin bypass (CVE-2026-86063)

Severity
HIGH
Category
Supply Chain (supply-chain)
Scanner
agent_audit_kit/scanners/supply_chain.py
Auto-fixable
No.
SARIF name
ClaudeCodeFolderTrustBypass

What it detects

Claude Code 2.1.63 → before 2.1.84 derives folder-trust from the git worktree commondir file without validating its contents. A malicious repo with a crafted commondir pointing to a previously-trusted path silently bypasses the trust prompt — every subsequent agent run executes inside that fake-trusted scope (CVE-2026-40068, patched in 2.1.84, published to npm 2026-03-25). Before 2.1.129, Claude Code checked that a target file was inside the project when it asked for permission, then re-resolved the path at write time without checking again, so an attacker who can write to a shared workspace and wins the race swaps the file for a symlink and redirects the write to a file outside the project, such as a shell profile (CVE-2026-103435, CVSS 4.0 7.7, CWE-367, GHSA-5j29-h97v-84ch). From 2.1.14, which added commit pins for marketplace plugins, and before 2.1.179, the plugin install flow ran git checkout on the pinned commit without checking that HEAD then equalled the pinned SHA, so a plugin repository on a Git host that allows SHA-shaped branch names can name a branch after the reviewed commit and have its tip installed instead (CVE-2026-86063, CVSS 4.0 7.5, CWE-494, GHSA-pq7j-f95f-qfcv). Before 2.1.251, the Edit tool validated its target by pathname and symlink resolution that was not bound to the directory's inode or file descriptor, so on macOS code running in the Bash sandbox, such as a malicious repository's or a dependency's script, could swap an in-workspace parent directory for a symlink after the check and have the unsandboxed Edit overwrite a user-writable file outside the workspace (CVE-2026-88968, CVSS 4.0 7.7, CWE-59/CWE-367, GHSA-5xjx-9qx6-jcrv). This pin-only rule fires on the scoped npm package @anthropic-ai/claude-code < 2.1.251 in any consumer manifest, and its evidence names each bug only where it applies. Rule name was pre-allocated in the v0.3.15 triage of issue #181 and shipped in v0.3.16; the floor rose from 2.1.83 on 2026-10-08, from 2.1.129 on 2026-10-16 and from 2.1.179 on 2026-11-11.

How to fix

Bump @anthropic-ai/claude-code to >=2.1.251 in any npm manifest pinning Claude Code. The rule fires only on the pin shape; an unpinned global install is in no file AAK reads, and auto-update has delivered all four fixes to installs that keep it on.

To confirm the finding is gone, report only this rule:

agent-audit-kit scan . --rules AAK-CLAUDECODE-CVE-2026-40068-PIN-001

Limitations

Reads @anthropic-ai/claude-code in the root package.json, package-lock.json, yarn.lock and pnpm-lock.yaml and reports a version it can parse below 2.1.251, so latest and other tags state no version and are not reported. In package-lock.json it reads only a listed dependency ("@anthropic-ai/claude-code": "<version>"): an entry that only a transitive dependency adds under node_modules/@anthropic-ai/claude-code is not read, and neither is a Yarn 2+ yarn.lock, a sub-directory package.json or a versioned npx reference in .mcp.json. It reads the version, not the platform or settings: the advisory describes CVE-2026-88968 for code running in the Bash sandbox on macOS, and from 2.1.179 to 2.1.250 it is the only bug named, so a release there that runs on Linux or Windows, or without the sandbox, is reported too. Claude Desktop, which shares the plugin install flow, is in no file AAK reads. A file over 2 MB, or a lockfile over 32 MiB, is not read.

References


All rules. This page is generated from the rule registry when the documentation is built; to change it, change the rule in agent_audit_kit/rules/builtin.py. To give the rule a hand-written write-up, add docs/rules/AAK-CLAUDECODE-CVE-2026-40068-PIN-001.md: the page then shows that text, with the registry reference appended under it.