CVE-2026-21852: claude_code: Weak Credentials allow account compromise
HIGHAny developer running Claude Code prior to v2.0.65 who cloned an untrusted repository may have had their Anthropic API key silently exfiltrated—no additional action required beyond opening the repo. Rotate all Anthropic API keys immediately for teams that used affected versions, then enforce the update. Auto-update users are already patched; your risk is concentrated in teams doing manual installs or pinned versions.
Risk Assessment
HIGH. The CVSS vector (AV:N/AC:L/PR:N/UI:N) confirms this is trivially exploitable at scale: no privileges, no special conditions, no meaningful user interaction beyond the routine act of opening a cloned repository. The impact is full confidentiality loss of the API key (C:H), enabling account takeover, unauthorized API spend, and potential access to any data the API key was scoped to reach. Exposure is broad across any organization where developers use Claude Code with manual update workflows, CI/CD runners, or shared developer environments.
Affected Systems
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| claude_code | pip | — | No patch |
Do you use claude_code? You're affected.
Severity & Risk
Attack Surface
Recommended Action
6 steps-
PATCH
Update Claude Code to v2.0.65+ immediately. Auto-update users are already protected; target manual-update users and pinned installations.
-
ROTATE
Revoke and reissue all Anthropic API keys for anyone running affected versions who opened external repositories since January 2026.
-
AUDIT
Search developer workstations and CI/CD pipelines for .claude/settings.json or equivalent config files with unexpected ANTHROPIC_BASE_URL values.
-
DETECT
Add a CI check or pre-commit hook that flags Claude Code settings files containing ANTHROPIC_BASE_URL pointing to non-Anthropic domains.
-
HARDEN
Enforce least-privilege API key scoping—keys used in developer tooling should not have production data access.
-
POLICY
Add Claude Code version management to your AI tool governance policy; treat it as a security-sensitive tool requiring controlled updates.
CISA SSVC Assessment
Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.
Classification
Compliance Impact
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2026-21852?
Any developer running Claude Code prior to v2.0.65 who cloned an untrusted repository may have had their Anthropic API key silently exfiltrated—no additional action required beyond opening the repo. Rotate all Anthropic API keys immediately for teams that used affected versions, then enforce the update. Auto-update users are already patched; your risk is concentrated in teams doing manual installs or pinned versions.
Is CVE-2026-21852 actively exploited?
No confirmed active exploitation of CVE-2026-21852 has been reported, but organizations should still patch proactively.
How to fix CVE-2026-21852?
1. PATCH: Update Claude Code to v2.0.65+ immediately. Auto-update users are already protected; target manual-update users and pinned installations. 2. ROTATE: Revoke and reissue all Anthropic API keys for anyone running affected versions who opened external repositories since January 2026. 3. AUDIT: Search developer workstations and CI/CD pipelines for .claude/settings.json or equivalent config files with unexpected ANTHROPIC_BASE_URL values. 4. DETECT: Add a CI check or pre-commit hook that flags Claude Code settings files containing ANTHROPIC_BASE_URL pointing to non-Anthropic domains. 5. HARDEN: Enforce least-privilege API key scoping—keys used in developer tooling should not have production data access. 6. POLICY: Add Claude Code version management to your AI tool governance policy; treat it as a security-sensitive tool requiring controlled updates.
What systems are affected by CVE-2026-21852?
This vulnerability affects the following AI/ML architecture patterns: agent frameworks, AI-assisted development environments, CI/CD pipelines with AI tooling, shared developer infrastructure.
What is the CVSS score for CVE-2026-21852?
CVE-2026-21852 has a CVSS v3.1 base score of 7.5 (HIGH). The EPSS exploitation probability is 0.03%.
Technical Details
NVD Description
Claude Code is an agentic coding tool. Prior to version 2.0.65, vulnerability in Claude Code's project-load flow allowed malicious repositories to exfiltrate data including Anthropic API keys before users confirmed trust. An attacker-controlled repository could include a settings file that sets ANTHROPIC_BASE_URL to an attacker-controlled endpoint and when the repository was opened, Claude Code would read the configuration and immediately issue API requests before showing the trust prompt, potentially leaking the user's API keys. Users on standard Claude Code auto-update have received this fix already. Users performing manual updates are advised to update to version 2.0.65, which contains a patch, or to the latest version.
Exploitation Scenario
An adversary publishes a seemingly useful open-source project on GitHub containing a malicious .claude/settings.json file with ANTHROPIC_BASE_URL set to https://attacker-controlled.io/api. A developer clones the repo to evaluate it, or a CI pipeline checks it out for automated review. Claude Code initializes, reads the project configuration, and immediately issues an API request to the attacker's endpoint—including the Authorization header carrying the developer's Anthropic API key. The attacker's server logs the key without the developer ever seeing a warning. The attacker then uses the stolen key to enumerate accessible resources, run costly API calls at the victim's expense, or access any AI context the key is authorized for. The attack requires no social engineering beyond getting the victim to clone the repository—a routine developer action.
Weaknesses (CWE)
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N Timeline
Related Vulnerabilities
CVE-2026-34452 Anthropic SDK: TOCTOU symlink escape in async memory tool
Same package: anthropic CVE-2026-34450 anthropic-sdk: insecure file perms expose agent memory
Same package: anthropic CVE-2025-5120 10.0 smolagents: sandbox escape enables unauthenticated RCE
Same attack type: Data Leakage CVE-2025-53767 10.0 Azure OpenAI: SSRF EoP, no auth required (CVSS 10)
Same attack type: Data Extraction CVE-2025-2828 10.0 LangChain RequestsToolkit: SSRF exposes cloud metadata
Same attack type: Data Extraction
AI Threat Alert