Supply chainNx build system (npm)

Malicious Nx packages turned developers’ AI CLIs into secret hunters

Poisoned versions of the Nx build system ran an install script that stole credentials and, where it could, drove Claude Code, Gemini CLI or Amazon Q with permission checks switched off to find more.

By the NoFly team

What NoFly would decideIllustrative
Allowed, with a flagDiscover · advisory check
nx (a version on the 26 August advisory) in ~/work/app
Agent
Developer laptop lt-22
Came from
An npm install
Rule
Package version on a malicious-package advisory
Why
This machine also runs Claude Code and holds a GitHub token in plain text. Rotate the token.

What happened

On 26 August 2025, attackers who had stolen Nx’s npm publishing token through a GitHub Actions workflow published eight malicious versions of nx and several plugins. They were removed about four hours later.

On macOS and Linux the install script looked for the claude, gemini and q command-line tools and ran them with flags that skip permission checks, asking them to search the disk for wallet, key and .env files and write the paths to a file. The script itself then collected environment variables, GitHub and npm tokens and the listed files, and uploaded them to a new public repository under the victim’s own GitHub account.

Wiz counted more than 2,000 verified secrets leaked in the first wave. In a second wave, attackers used leaked tokens to make victims’ private repositories public. Wiz also found that Claude refused the task in almost a quarter of attempts.

  1. 01

    A workflow flaw leaks Nx’s npm publishing token.

  2. 02

    Poisoned versions run an install script on developer machines.

  3. 03

    The script asks local AI CLIs, with checks off, to find secret files.

  4. 04

    The script uploads what it finds to a public repository.

Why it worked

Probable cause

A package install could run arbitrary code, and AI CLIs on the machine could be started non-interactively with every permission check disabled.

How NoFly stops it

  • Discover

    Packages and versions on each machine are matched against advisories as they land, and checked backwards, so the machines that installed the bad Nx versions, and the keys sitting on them, are one list. Agent settings that switch permission checks off are flagged on every machine.

  • Govern

    An automation can revoke the exposed keys and open a ticket for each owner the moment an advisory matches your estate.

What to do this week

This week3 actions
  1. Find the machines that installed the affected Nx versions on 26 August 2025, and rotate every credential on them.
  2. Look for public repositories named s1ngularity-repository under your organization’s accounts.
  3. Do not let scripts start AI CLIs with permission checks disabled on machines that hold credentials.
Keep reading

More from the blog.

Find out what your AI is allowed to do today.

Book a call and we will map your agents, MCP servers and keys with you, or start on one laptop with the free scan.

Book a demo
npm i -g @nofly/agent