Claude Code Source Leak Exposes Anthropic Architecture and Triggers Security Crisis
TECH

Claude Code Source Leak Exposes Anthropic Architecture and Triggers Security Crisis

37+
Signals

Strategic Overview

  • 01.
    On March 31, 2026, Anthropic accidentally exposed approximately 513,000 lines of Claude Code source code through a 59.8 MB JavaScript source map file bundled in npm package @anthropic-ai/claude-code version 2.1.88, caused by the Bun runtime generating source maps by default and the file not being excluded from the published package.
  • 02.
    The leaked code revealed 44 unreleased feature flags including KAIROS autonomous daemon mode, Dream mode for background thinking, and references to a next-generation model family codenamed Mythos/Capybara, while a critical security vulnerability involving command overload bypass was subsequently discovered by Adversa AI.
  • 03.
    Threat actors rapidly weaponized the leak, distributing Vidar v18.7 infostealer and GhostSocks proxy malware through trojanized GitHub repositories disguised as Claude Code, while malicious axios packages containing a remote access trojan were briefly available on npm.
  • 04.
    Anthropic initially issued DMCA takedowns against approximately 8,100 GitHub repositories before retracting to just one repository and 96 forks, with CCO Paul Smith attributing the overbroad action to process errors.

Deep Analysis

Why This Matters

The Claude Code source leak is significant not merely because proprietary code was exposed, but because it revealed the inner workings of one of the most widely used AI coding agents at a moment when Anthropic is approaching an IPO and operating at a $19 billion annualized revenue run-rate. The exposure of 44 unreleased feature flags, internal model codenames, and the full agent architecture provides competitors with a detailed blueprint of Anthropic's product strategy and technical approach. For an industry built on competitive moats around model capabilities and tooling, this level of transparency was involuntary and potentially consequential.

Beyond competitive intelligence, this incident represents the third source leak for Anthropic in under a year, following an early Claude Code exposure in February 2025 and a Mythos documentation leak just days prior. This pattern raises fundamental questions about Anthropic's operational maturity and internal security controls. As security researcher Roy Paz noted, large companies typically have "strict processes and multiple checks before code reaches production, like a vault requiring several keys to open." The recurrence suggests systemic gaps in release engineering and build pipeline governance rather than isolated accidents.

How It Works

The root cause of the leak was a build configuration oversight involving the Bun JavaScript runtime. When Anthropic compiled Claude Code for distribution via npm, the Bun bundler generated a source map file by default. Source maps are development tools that map minified or transpiled production code back to the original source, and they are never intended for public distribution. The critical failure was that neither the .npmignore file nor the package.json files field excluded *.map files from the published package. The result was a 59.8 MB source map embedded directly in @anthropic-ai/claude-code version 2.1.88, containing 513,000 lines of unobfuscated TypeScript across 1,906 files.

Once the source map was discovered, the code spread with extraordinary speed. Within hours, the leaked repository accumulated over 84,000 GitHub stars and 82,000 forks. Security researcher Chaofan Shou's initial post on X received 28.8 million views, ensuring that the code was widely disseminated before any containment was possible. The exposed codebase revealed not only the agent's architecture and multi-agent workflow orchestration but also internal guardrail implementations. Adversa AI subsequently identified a command overload bypass vulnerability: when an instruction chain exceeds 50 subcommands, the system downgrades from automatic rejection to merely prompting the user, creating a potential vector for adversarial manipulation of the agent's safety controls.

By The Numbers

The scale of this incident is captured in a series of striking figures. The source map contained 513,000 lines of code across 1,906 files, packaged in a single 59.8 MB file that anyone could download from npm. The leaked GitHub repository drew 84,000 stars and 82,000 forks. The initial disclosure post on X by Chaofan Shou reached 28.8 million views, ensuring near-instantaneous global awareness.

The fallout numbers are equally notable. Anthropic's initial DMCA sweep targeted approximately 8,100 GitHub repositories before being retracted to just one repository and 96 forks. Five typosquat npm packages were registered to exploit developer confusion. On the malware front, threat actors distributed Vidar v18.7 infostealer and GhostSocks proxy malware through trojanized repositories disguised as Claude Code source. Meanwhile, malicious versions of the popular axios library (versions 1.14.1 and 0.30.4) containing a remote access trojan were briefly available on npm during the initial chaos. The 50-subcommand threshold for the security guardrail bypass represents a concrete, exploitable vulnerability discovered through the exposed source.

Impacts and What's Next

The immediate impacts span intellectual property exposure, active security threats, and reputational damage. Anthropic's full agent architecture, including multi-agent workflows and internal guardrail logic, is now effectively public knowledge. The 44 unreleased feature flags reveal strategic product direction, including autonomous daemon capabilities (KAIROS) and background reasoning (Dream mode). References to the Mythos/Capybara model family expose future model roadmap details that competitors can now factor into their own planning.

The security consequences are ongoing. Trojanized copies of the leaked code are distributing active malware including information stealers and proxy tools. The command overload bypass vulnerability identified by Adversa AI represents a concrete attack vector against Claude Code's safety mechanisms. Supply chain attacks through typosquat npm packages remain a risk, with security researcher Clement Dumas warning that current "empty stubs" follow established attack patterns. For Anthropic's approaching IPO, the pattern of repeated leaks introduces due diligence concerns about operational controls. Anthropic CCO Paul Smith's characterization of these events as "absolutely not breaches or hacks" may be technically accurate, but the distinction between accidental exposure and external breach offers limited comfort when the practical consequences are similar.

The Bigger Picture

This incident illuminates a structural tension in the AI industry: companies building some of the most sophisticated software systems in history are simultaneously operating under startup-speed release cycles that can bypass fundamental security hygiene. A missing line in an .npmignore file exposed half a million lines of proprietary code. The simplicity of the root cause contrasts sharply with the complexity of the system it exposed, and with the sophistication of the threat actors who immediately weaponized the leak.

The DMCA response further highlights the challenges AI companies face in the open-source era. Anthropic's initial sweep of 8,100 repositories reflected a containment reflex that collided with the realities of code distribution on platforms like GitHub. The retraction to 96 targets acknowledged both the impracticality of broad suppression and the community backlash it generated. Reddit discussions revealed a spectrum of reactions, from users pragmatically leveraging the leaked code to fix token consumption issues to speculation that the leak was a deliberate PR stunt. The incident also underscores the expanding attack surface of the AI development supply chain. When a single packaging error can trigger malware campaigns, supply chain poisoning attempts, and exploitation of exposed security mechanisms within hours, the security model for AI tooling distribution requires the same rigor applied to the models themselves.

Historical Context

2025-02
An early version of Claude Code source code was accidentally exposed, marking the first known source leak incident for the product.
2026-03-28
Approximately 3,000 files containing Mythos and Capybara documentation were leaked, constituting the second source exposure incident in under a year.
2026-03-31
A 59.8 MB JavaScript source map file was included in the npm package @anthropic-ai/claude-code version 2.1.88, exposing 513,000 lines of unobfuscated TypeScript across 1,906 files.
2026-03-31
Security researcher Chaofan Shou posted the discovery on X, where the post garnered 28.8 million views and triggered mass forking of the leaked code on GitHub.
2026-04-01
Anthropic issued DMCA takedown requests against approximately 8,100 GitHub repositories, later retracting to just one repository and 96 forks after acknowledging the action was overbroad.
2026-04-02
Security researchers published analyses revealing a command overload bypass vulnerability and documented trojanized repositories distributing Vidar infostealer and GhostSocks malware.

Power Map

Key Players
Subject

Claude Code Source Leak Exposes Anthropic Architecture and Triggers Security Crisis

AN

Anthropic

AI company with $19B annualized revenue run-rate approaching a planned IPO, responsible for Claude Code development and the packaging error that caused the leak

BO

Boris Cherny

Head of Claude Code at Anthropic, acknowledged the overbroad DMCA takedown campaign

PA

Paul Smith

Anthropic Chief Commercial Officer who publicly attributed the leak and DMCA overreach to process errors

AD

Adversa AI

Israeli security firm that discovered the critical command overload bypass vulnerability in Claude Code's guardrail system

GI

GitHub

Code hosting platform that enforced Anthropic's DMCA requests and subsequently restored repositories after the overbroad takedown was retracted

CH

Chaofan Shou

Security researcher whose initial X post about the leak received 28.8 million views, catalyzing widespread awareness and redistribution

THE SIGNAL.

Analysts

"Highlighted the failure of enterprise-grade release controls: "Usually, large companies have strict processes and multiple checks before code reaches production, like a vault requiring several keys to open.""

Roy Paz
Security Researcher

"Warned about typosquat npm packages exploiting the confusion around the leak: "Right now they're empty stubs, but that's how these attacks work," suggesting the supply chain risk was still escalating."

Clement Dumas
Security Researcher

"Assessed that the rapid forking and redistribution of the leaked code significantly increased compromise risk: "That kind of rapid movement increases the chance of opportunistic compromise, especially through trojanized repositories.""

Zscaler ThreatLabz
Security Research Team, Zscaler

"Characterized the incidents as "absolutely not breaches or hacks," framing them as internal process failures rather than external security events."

Paul Smith
Chief Commercial Officer, Anthropic
The Crowd

"Claude code source code has been leaked via a map file in their npm registry!"

@@Fried_rice12000

"SOMEONE DUG THROUGH THE ENTIRE SOURCE CODE FOR CLAUDE CODE THAT JUST LEAKED AND IT IS WAY CRAZIER THAN ANYONE EXPECTED. the full Claude Code source code leaked through a .map file in their npm package."

@@om_patel58800

"You cannot make this up. The Claude Code leak is crazier than I thought. Claude Code source code leaked over the weekend, and this file cyberRiskInstruction.ts stood out to me."

@@berman66346

"Claude Code source code has been leaked via a map file"

@u/unknown3700
Broadcast