CVE-2026-21852
Claude Code Leaks Data via Malicious Environment Configuration Before Trust Confirmation
In short
Claude Code loaded malicious project settings before asking users for permission, allowing attackers to steal API keys by redirecting requests to fake servers. This happened automatically when opening a repository, before any trust confirmation.
Technical detail
CWE-522 (Insufficient Logging) manifests as premature API credential exposure: malicious repository configuration files could redirect ANTHROPIC_BASE_URL to attacker-controlled endpoints, causing Claude Code to leak API keys in requests before displaying the trust prompt. The attack requires the victim to open an attacker-controlled repository, but exploitation occurs automatically during project initialization without user interaction.
Summary generated and translated by AI from the official 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.
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N
Affected products
anthropics · claude-codeWant to know if your infrastructure is exposed to this?
Talk to TrueHacking →