STUPID-2026-0152

Malicious npm packages used locally installed Claude, Gemini and Amazon Q CLIs to hunt developer secrets in the s1ngularity supply-chain attack

9.0critical
August 26, 2025

Why 9/10

Confirmed real-world exfiltration (not a test), reaching credentials and private repos across many developer machines and several organizations, with secrets permanently exposed publicly before most were rotated. Scope held at 3 rather than 4 because the AI-driven slice of the attack succeeded in under a quarter of attempts and surfaced under 100 valid secrets — a minority of the campaign's total haul, most of which came from the malware's own file-system scan rather than from the AI CLIs.

Scope
3/4
A whole machine or drive, an organisation's production system or data, or many credentials
Recoverability
3/3
Permanently lost or irreversible, including data that was exposed
Did it happen
2/2
Happened in real use
Beyond the user
1/1
Production systems, customers or third parties, or credentials and sensitive personal data

The score is the sum of these four factors. How each factor is scored · scored 2026-11-01

  1. Instruction given

    None from any developer. A postinstall script embedded in compromised Nx npm packages (nx, @nx/devkit and related packages) ran automatically on install, checked the host for a locally installed AI coding CLI, and — if one was found — invoked it non-interactively with a crafted prompt framing itself as "an authorized penetration testing agent" and instructing it to recursively search the filesystem for secrets.

  2. Expected behavior

    An AI coding CLI invoked non-interactively by an unattended install script, with no real user present and no verifiable authorization, should refuse to search the filesystem for credentials, SSH keys and crypto wallets — regardless of what role the prompt claims to be playing.

  3. Actual behavior

    Roughly half of the compromised machines had an AI CLI installed (mostly Claude, some Gemini, a few Amazon Q). The attacker iterated the prompt across package versions, and later versions leaning harder into the "authorized penetration testing agent" framing produced fewer refusals. Across the sampled set the AI-driven search still failed or was refused in most attempts, succeeding in under a quarter of cases.

  4. Damage

    Where it worked, the AI CLIs helped pull under 100 unique still-valid secrets out of roughly 20,000 scanned files across 225 compromised developer accounts — the first documented case of locally installed AI coding CLIs being weaponized as the search tool inside a live supply-chain attack. That was a minority of the wider s1ngularity campaign, in which the malware's own (non-AI) file scan leaked secrets from over 1,700 users in its first phase alone, and a later phase exposed 6,700+ private repositories from 480+ compromised accounts; almost 90% of leaked GitHub tokens and over 40% of leaked npm tokens were still valid days after disclosure, before GitHub's revocation campaign brought that down.

Full write-up

On August 26, 2025, attackers compromised an npm publishing token for the Nx build system through a vulnerable GitHub Action and pushed malicious versions of nx and several @nx/* packages. The payload's postinstall script scanned the host filesystem for credentials and, in a twist researchers called a first, checked for a locally installed AI coding CLI — Claude, Gemini CLI or Amazon Q — and ran it non-interactively with a prompt that opened by claiming to be "an authorized penetration testing agent," instructing it to recursively search $HOME and config directories for anything that looked like a secret.

Security firm Wiz's post-incident analysis found roughly half of affected machines had one of these CLIs installed (mostly Claude), and traced multiple prompt iterations across the attack's package versions — evidence the attacker was actively tuning the jailbreak framing for a higher compliance rate. Even so, AI-assisted exfiltration succeeded in under a quarter of attempts: task refusals, workspace restrictions and configuration mismatches blocked most of it, and the AI-driven slice yielded under 100 valid secrets from about 20,000 scanned files. The much larger share of the breach — over 1,700 users' secrets in the first phase, and more than 6,700 private repositories exposed from 480+ accounts in a later phase — came from the malware's own non-AI file scan, not from the AI CLIs. Stolen data was base64-encoded and pushed to public GitHub repos named s1ngularity-repository before GitHub pulled them down; by then, Wiz found almost 90% of leaked GitHub tokens and over 40% of leaked npm tokens were still valid.

Classification

Root cause
Tool Misuse
Domain
Security

Related incidents

Cite this record
StupidLLM. "STUPID-2026-0152: Malicious npm packages used locally installed Claude, Gemini and Amazon Q CLIs to hunt developer secrets in the s1ngularity supply-chain attack." AI Agent Incident Database, 2026. https://www.stupidllm.com/incident/STUPID-2026-0152/ (accessed 2026-11-01). CC BY 4.0.

← STUPID-2026-0151By ID

Get told when an agent breaks something

We document AI agent failures daily, severity-scored against a published scale. Each Monday, if any scored 7 or above that week — deleted data, leaked secrets, broken production — you get one email with the sources. When nothing did, you get nothing.

This database is callable over MCP — query it from inside your agent.