{"answers":{"affected":"2 open source packages ship an affected version, including @anthropic-ai/claude-code. It affects 1 product.","exploited":"There is no known exploitation of CVE-2026-21852 in the wild and no public exploit code.","fix":"Upgrade @anthropic-ai/claude-code to 2.0.65 or later.","what":"CVE-2026-21852 is a medium-severity vulnerability in anthropics claude-code, published on 21 Jan 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link."},"fix_prompt":"Check this codebase for CVE-2026-21852 and fix it if it is affected.\n\nWhat it is: CVE-2026-21852 is a medium-severity vulnerability in anthropics claude-code, published on 21 Jan 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.\nExploitation: There is no known exploitation of CVE-2026-21852 in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- @anthropic-ai/claude-code (npm): affected all versions; fixed in 2.0.65\n- @anthropic-ai/claude-code (npm): affected all versions; fixed in 2.0.65\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/CVE-2026-21852/ (Markdown: https://insights.sbomify.com/CVE-2026-21852/index.md)","id":"CVE-2026-21852","markdown":"https://insights.sbomify.com/CVE-2026-21852/index.md","name":"CVE-2026-21852","record":{"aliases":["GHSA-jh7p-qr78-84p7"],"analysis":{"component_type":"developer_tool","fix_type":"upgrade","impacts":["data_read","security_bypass"],"network_reachable":"yes","non_default_config":false,"product_category":"AI coding assistant","requires_auth":"none","summary":"Malicious repositories can leak Anthropic API keys by triggering API requests before user trust confirmation in Claude Code.","user_interaction":"required","vuln_class":"information_disclosure"},"analysis_generated_by":"qwen3.8-flash-next","assigner":"GitHub_M","cpe":[{"product":"claude_code","vendor":"anthropic"}],"cvss":{"score":5.3,"severity":"medium","source":"cna","vector":"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","version":"4.0"},"cwes":[{"id":"CWE-522","name":"Insufficiently Protected Credentials"}],"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.","ecosystems":["npm"],"exploits":{"exploitdb":0,"first_seen":"2026-02-27","github_poc":4,"max_poc_stars":24,"metasploit":0,"nuclei":0,"refs":[{"date":"2026-02-27T01:13:21Z","kind":"github_poc","ref":"https://github.com/atiilla/CVE-2026-21852-PoC","stars":24,"title":null},{"date":"2026-04-20T06:41:02Z","kind":"github_poc","ref":"https://github.com/TreRB/ai-ide-config-guard","stars":0,"title":"Scan a repo for AI-IDE config files that can trigger RCE via Claude Code hooks, Cursor rules, MCP auto-registration. Detects CVE-2025-59536, CVE-2026-21852, CVE-2026-30615 + Pillar Rules File Backdoor patterns."},{"date":"2026-06-21T11:50:53Z","kind":"github_poc","ref":"https://github.com/Perufitlife/dotclaude-security","stars":0,"title":"Scan a repo's .claude/ config (settings.json hooks, MCP servers, env, allowed-tools) for the RCE \u0026 API-key-exfiltration footguns (CVE-2025-59536, CVE-2026-21852) that fire when you clone+open an untrusted repository. Static, zero-dep, local-first."},{"date":"2026-09-13T12:35:52Z","kind":"github_poc","ref":"https://github.com/abhishek2512mishra/claude-code-security-audit","stars":0,"title":"Security scanner auditing Claude Code environments for CVE-2026-21852 pre-trust execution, hook hijacking, and eBPF lockdown."}],"tier":"poc_unverified"},"has_fix":true,"headline":"Claude Code Leaks Data via Malicious Environment Configuration Before Trust Confirmation","id":"CVE-2026-21852","indexable":true,"kev":null,"kind":"cve","links":{"ecosystem":"npm","product":null,"products":[],"type":"information_disclosure","year":"2026"},"n_packages":2,"n_references":1,"next":{"headline":"AFFiNE: One-click Remote Code Execution through Custom URL Handling","id":"CVE-2026-21853"},"packages":[{"ecosystem":"npm","fixed":["2.0.65"],"introduced":["0"],"last_affected":[],"package":"@anthropic-ai/claude-code","purl":null,"source":"GHSA-jh7p-qr78-84p7"},{"ecosystem":"npm","fixed":["2.0.65"],"introduced":["0"],"last_affected":[],"package":"@anthropic-ai/claude-code","purl":"pkg:npm/%40anthropic-ai/claude-code","source":"GHSA-jh7p-qr78-84p7"}],"prev":{"headline":"MONAI has Path Traversal (Zip Slip) in NGC Private Bundle Download","id":"CVE-2026-21851"},"products":["claude-code"],"published":"2026-01-21","related":[{"cvss_score":8.7,"headline":"Claude Code Command Validation Bypass Allows Arbitrary Code Execution","id":"CVE-2025-66032","kev_date_added":null,"published":"2025-12-03"},{"cvss_score":8.7,"headline":"@anthropic-ai/claude-code has Sed Command Validation Bypass that Allows Arbitrary File Writes","id":"CVE-2025-64755","kev_date_added":null,"published":"2025-11-21"},{"cvss_score":8.7,"headline":"Claude Code's startup trust dialog could lead to Command Execution attack","id":"CVE-2025-59536","kev_date_added":null,"published":"2025-10-03"},{"cvss_score":8.7,"headline":"Claude Code rg command had Command Injection that allowed bypass of user approval prompt for command execution","id":"CVE-2025-58764","kev_date_added":null,"published":"2025-09-10"},{"cvss_score":8.7,"headline":"Claude Code vulnerable to arbitrary code execution caused by maliciously configured git email","id":"CVE-2025-59041","kev_date_added":null,"published":"2025-09-10"},{"cvss_score":8.7,"headline":"Claude Code echo command allowed bypass of user approval prompt for command execution","id":"CVE-2025-54795","kev_date_added":null,"published":"2025-08-05"},{"cvss_score":7.7,"headline":"Claude Code: Sandbox Escape via Git Worktree Path Confusion Allows Unsandboxed Code Execution","id":"CVE-2026-55607","kev_date_added":null,"published":"2026-06-29"}],"sources":[{"class":"attribution","licence":"CVE Terms of Use (MITRE)","name":"CVE List","prefix":"CVE"},{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"},{"class":"attribution","licence":"US public information, NVD API terms","name":"NVD"},{"class":"attribution","licence":"CWE Terms of Use","name":"CWE (MITRE)"},{"class":"attribution","licence":"FIRST CVSS licence","name":"CVSS (FIRST)"},{"class":"open","licence":"CC0","name":"PoC-in-GitHub"}],"ssvc":{"automatable":"yes","exploitation":"none","technical_impact":"partial"},"state":"PUBLISHED","updated":"2026-01-21","vendors":["anthropics"]},"summary":"Malicious repositories can leak Anthropic API keys by triggering API requests before user trust confirmation in Claude Code.","url":"https://insights.sbomify.com/CVE-2026-21852/"}