IncidentSupply chain
Nx s1ngularity: malicious releases turned local AI CLIs into secret hunters
CriticalNx
Attackers stole the npm publishing token for the Nx build tool and released versions that stole developers' secrets. The malware also ran AI coding CLIs already on the machine, with their safety checks turned off, to search the disk for sensitive files.
Replay the attack step by step in the Learning Center
How it happened
- A GitHub Actions workflow put pull request titles straight into a shell command, so a crafted title ran code with elevated permissions.
- The attacker used it to steal Nx's npm token and publish malicious versions.
- A postinstall script hunted for tokens, keys and wallets and ran any installed Claude, Gemini or Q CLI with permission-bypass flags.
- Findings were pushed to a public repository in the victim's own GitHub account.
Impact
More than 2,000 secrets leaked from over 1,700 users, and stolen tokens exposed over 6,700 private repositories.
The fix
npm removed the versions within about four hours; Nx moved to 2FA and trusted publishing and requires approval for outside workflows.
Lessons
- Never paste pull request text into shell commands in CI, and avoid pull_request_target on untrusted input.
- Publish with short-lived OIDC trusted publishing instead of long-lived tokens.
- Local AI coding CLIs are an attacker tool now: avoid permanent permission-bypass modes.