Malicious Nx releases on npm stole credentials (s1ngularity)
Malicious Nx versions on npm stole GitHub and npm tokens.
Are you affected?
The free scanner that answers this opens soon. Until then, the steps below work by hand.
What happened
Malicious Nx releases on npm stole credentials. Nx's advisory says an attacker used a command injection in a pull_request_target GitHub Actions workflow to obtain the npm publish token, then published malicious versions of nx and several @nx plugins from 2025-08-26 22:32 UTC. A postinstall script scanned the file system for text files, collected file paths and credentials, and posted them encoded to a public GitHub repository named s1ngularity-repository created in the victim's account. It also added sudo shutdown -h 0 to .zshrc and .bashrc. The nx versions were removed by 2025-08-27 02:44 UTC and @nx/key and @nx/enterprise-cloud by 10:20 UTC.
- Exposure starts
- 2025-08-26
- Exposure ends
- 2025-08-27
- Confidence
- high
- Scope
- every credential readable on a machine or CI runner that installed a malicious Nx version, including through Nx Console for VS Code
What to do, in this order
- Uninstall the malicious versions, clear the npm, yarn and pnpm caches and the npx cache, and remove added lines from .zshrc and .bashrc
The advisory's cleanup steps; a cached copy reinstalls the payload.
- GitHub tokens, including the gh CLI token, and the GitHub password
The payload wrote stolen data to a repository in the victim's GitHub account; the advisory says to revoke the GitHub CLI OAuth app, re-authenticate and rotate GitHub tokens and passwords.
github_pat, github_oauth_token, github_fine_grained_pat
- npm tokens
The advisory names npm tokens for rotation; a stolen publish token is how this attack itself started.
npm_token
- Every secret in environment variables, and passwords for other services
The advisory says to rotate anything in environment variables and passwords for other services.
anything else stored there
Notes
- Nx Console for VS Code installed nx@latest to check versions, so the advisory lists Nx Console 18.6.30 through 18.65.1 as able to pull the malicious package without a project dependency; 18.66.0 fixed it.
- The advisory says 21.4.1 was restored as the latest nx release.
- The advisory does not give a removal time for @nx/devkit, @nx/js, @nx/workspace or @nx/node; the exposure window ends on 2025-08-27, the day the last removal it does give.
How to tell if you’re affected
- A repository whose name contains s1ngularity-repository in your GitHub account (audit log action repo.create)
- The file /tmp/inventory.txt
- sudo shutdown -h 0 appended to .zshrc or .bashrc
Sources
- Nx advisory GHSA-cxm3-wv7p-598c: malicious versions of Nx and some supporting plugins were published
- GitHub Advisory Database GHSA-cxm3-wv7p-598c
Rotating the keys
Pro, $49 a year when it opens, plans the rotation of each affected key for this incident, in this order. Automatic rotation is in testing and included.
By hand, free: the steps above.