← Google News

Claude Code is leaking API keys into public package registries - TechTalks

Google News · April 27, 2026
Claude Code is leaking API keys into public package registries TechTalks [truncated: Google News RSS provides only a snippet, not full article

Detailed Analysis

Anthropic's Claude Code developer tool became the subject of a significant multi-layered security incident beginning March 31, 2026, when version 2.1.88 of the `@anthropic-ai/claude-code` npm package was published containing a 59.8 MB source map file that exposed approximately 512,000 lines of unobfuscated TypeScript source code across nearly 1,900 files. The root cause was straightforward but consequential: Claude Code is built on the Bun runtime, which generates `.map` files by default, and Anthropic's packaging process failed to exclude them via standard mechanisms such as `.npmignore` entries or an explicit file whitelist in `package.json`. The source map also referenced an Anthropic-owned R2 cloud storage bucket from which the complete codebase could be downloaded as a ZIP archive, compounding the exposure. Security researcher Chaofan Shou discovered and publicly disclosed the leak on X, where it attracted over 28 million views; within hours, the codebase had been archived to GitHub and accumulated tens of thousands of stars and forks.

The source code exposure itself was only the first layer of the incident. Separately catalogued as CVE-2026-21852, a distinct vulnerability allowed malicious repositories to redirect Claude Code's network traffic to attacker-controlled endpoints, causing API keys to be transmitted before users had confirmed trust in the repository. A further vulnerability permitted malicious project configuration files to trigger operating system command execution through lifecycle events the moment a developer opened a repository with Claude Code active — a remote code execution vector requiring no additional user interaction. Anthropic stated publicly that no customer data or credentials were directly exposed in the source code release itself, but this framing does not fully account for the downstream attack surface the leak created.

The practical consequences of the source leak extended well beyond its immediate disclosure. With full access to Claude Code's internal data flows and security logic, adversaries were positioned to craft sophisticated payloads specifically designed to circumvent its controls. Within weeks, the leaked source code had been incorporated into malicious forks distributed through supply chain attack vectors, with some variants bundled with commodity malware families including Vidar and GhostSocks. Anthropic began issuing DMCA takedown notices to limit redistribution, though the breadth of the initial forking activity made comprehensive containment difficult. The incident is also notable for reportedly not being Anthropic's first such packaging error — earlier 2025 releases of the package also shipped with source maps before being quietly corrected.

The Claude Code incident sits within a broader and accelerating pattern of security failures specific to AI-integrated developer tooling. As AI coding assistants are granted deeper access to local filesystems, network configurations, and shell environments, their attack surface expands considerably beyond that of traditional software packages. Tools like Claude Code operate with elevated implicit trust — developers routinely clone unfamiliar repositories and immediately invoke AI assistants against them — making lifecycle-event-triggered execution a particularly potent vector. The incident illustrates how the supply chain risks of AI tooling compound: a packaging oversight exposes source code, that source code enables targeted vulnerability research, and the resulting exploits are then redistributed via the same package ecosystems developers depend on daily.

For Anthropic specifically, the incident arrives at a sensitive moment. Claude Code has been positioned as a flagship agentic product, and its security posture directly reflects on the company's broader claims about responsible AI deployment. The combination of an operational security lapse (the source map inclusion), a credential-handling vulnerability (the API key exfiltration path), and a code execution flaw (the lifecycle event vector) suggests that the security review processes surrounding Claude Code's release pipeline were insufficiently rigorous relative to the tool's privileged position in developer workflows. The industry-wide lesson is increasingly clear: AI developer tools that interact with external repositories, manage authentication tokens, and execute environment commands require the same adversarial security review standards applied to production infrastructure — standards that, in this case, were not met.

Read original article →