CVE-2026-21852: Claude Code Leaks Data via Malicious Environment Configuration Before Trust Confirmation

Published Jan 21, 2026
·
Updated

A vulnerability in Claude Code's project-load flow allowed malicious repositories to exfiltrate data including Anthropic API keys before users confirmed trust. If a user started Claude Code in an attacker-controller repository, and the repository included a settings file that set ANTHROPICBASEURL to an attacker-controlled endpoint, Claude Code would issue API requests before showing the trust prompt, including 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 the latest version.

Other sources

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 ANTHROPICBASEURL 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.

MITRE

Affected Software

2 affected componentsFixes available
npm/@anthropic-ai/claude-code<2.0.65
2.0.65
Anthropic Claude Code Node.js<2.0.65

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade npm/@anthropic-ai/claude-code to a version that resolves this vulnerability.

    Fixed in 2.0.65
  2. Upgrade

    Upgrade Claude Code to a version that resolves this vulnerability.

    Fixed in 2.0.65

Event History

Jan 21, 2026
Advisory Published
via GitHub·01:00 AM
Data Sourced
via GitHub·01:00 AM
DescriptionWeaknessAffected Software
CVE Published
via MITRE·08:42 PM
Data Sourced
via MITRE·08:42 PM
DescriptionWeakness
Data Sourced
via NVD·09:16 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·09:16 PM
Affected Software
Feb 26, 2026
News Published
via The Register·12:33 AM
News Published
via The Register·12:35 AM
May 7, 2026
News Published
via Dark Reading·01:00 PM
May 12, 2026
News Published
via Dark Reading·01:07 PM
Jun 29, 2026
News Published
via Dark Reading·11:44 AM
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2026-21852?

CVE-2026-21852 is considered a high severity vulnerability due to its potential for data exfiltration.

2

How do I fix CVE-2026-21852?

To fix CVE-2026-21852, upgrade to version 2.0.65 or later of the @anthropic-ai/claude-code package.

3

What kind of data can be exfiltrated due to CVE-2026-21852?

CVE-2026-21852 allows for the exfiltration of sensitive data including Anthropic API keys.

4

Who is affected by CVE-2026-21852?

Developers using versions of the @anthropic-ai/claude-code package prior to 2.0.65 are affected by CVE-2026-21852.

5

What specific conditions lead to exploitation of CVE-2026-21852?

Exploitation of CVE-2026-21852 occurs when users run Claude Code in a malicious repository that has a settings file configured with the ANTHROPIC_BASE_URL.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203