# Nx "s1ngularity" npm compromise used local AI CLIs to hunt for secrets and leaked them to GitHub

Source: https://botpassword.com/incidents/2025-08-nx-s1ngularity
Disclosed: 2025-08-27 · Type: Supply chain · Status: Resolved · Updated: 2026-10-25

On 26 August 2025 an attacker used a stolen npm token to publish malicious versions of `nx` and several `@nx/*` packages. A `postinstall` script collected GitHub and npm tokens, SSH keys, `.env` files and crypto wallets, and uploaded them, encoded, to a public `s1ngularity-repository` in the victim's own GitHub account. If you installed an affected version, rotate your GitHub, npm and cloud credentials and check your GitHub account for those repositories.

Identifiers: GHSA-cxm3-wv7p-598c

## What was exposed

On Linux and macOS machines that installed an affected version: the GitHub CLI's token (`gh auth token`), the contents of `.npmrc` and npm tokens, SSH keys, `.env` files, cryptocurrency wallets and keystores, and the paths of other files the malware listed. Wiz counted more than 1,000 valid GitHub tokens, dozens of valid cloud credentials and npm tokens, and about 20,000 other files in the first phase. In the second phase, private source code was exposed when stolen tokens were used to make private repositories public. The malware also prompted locally installed AI coding CLIs (Wiz names Claude, Gemini and Amazon Q) with permission-skipping flags to help search the disk.

## Who is affected

You are affected if your machine or CI ran `npm install` (or `npx`) with any of these versions: `nx` 20.9.0, 20.10.0, 20.11.0, 20.12.0, 21.5.0, 21.6.0, 21.7.0 or 21.8.0; `@nx/devkit`, `@nx/js`, `@nx/workspace` or `@nx/node` 20.9.0 or 21.5.0; `@nx/eslint` 21.5.0; `@nx/key` or `@nx/enterprise-cloud` 3.2.0. The Nx Console VS Code extension from 18.6.30 to 18.65.1 could install `nx@latest` when the editor opened, so editor users may be affected without running a command. Signs on disk are `/tmp/inventory.txt` and a `sudo shutdown -h 0` line in `~/.bashrc` or `~/.zshrc`. On GitHub, look for a repository named `s1ngularity-repository`, `-0` or `-1` in your account or organization audit log.

## What to do

1. Run `npm ls nx` (and the `@nx/*` names) in every project, remove affected versions, and clear the npm, yarn, pnpm and `_npx` caches. Remove the versions from any internal registry mirror.
2. Revoke your GitHub CLI token by revoking the GitHub CLI OAuth app in your GitHub settings, then sign in again. Rotate GitHub personal access tokens and your GitHub password.
3. Rotate npm tokens, SSH keys and every secret in `.env` files or environment variables on the affected machine, including cloud and AI provider keys.
4. Check your GitHub audit log for `s1ngularity-repository` repositories and for private repositories that were made public on 2025-08-28 or 2025-08-29. Keep a copy for your records, then delete or re-privatize them.
5. Remove the `sudo shutdown -h 0` line from `~/.bashrc` and `~/.zshrc`, and update Nx Console to 18.66.0 or later.

## Keys to rotate

- [GitHub](https://botpassword.com/keys/github)
- [npm](https://botpassword.com/keys/npm)
- [AWS (IAM access keys)](https://botpassword.com/keys/aws)
- [Google Cloud (service account keys and API keys)](https://botpassword.com/keys/google-cloud)
- [Azure (Microsoft Entra app client secrets)](https://botpassword.com/keys/azure)
- [Anthropic](https://botpassword.com/keys/anthropic)
- [OpenAI](https://botpassword.com/keys/openai)

## Timeline

- 2025-08-26: Malicious versions of `nx` and `@nx/*` packages are published to npm from about 22:32 UTC. The token had been stolen through a GitHub Actions workflow that interpolated pull-request titles into a shell step under `pull_request_target`. ([source](https://github.com/nrwl/nx/security/advisories/GHSA-cxm3-wv7p-598c))
- 2025-08-27: npm removes the `nx` versions (about 02:44 UTC) and the `@nx/key` and `@nx/enterprise-cloud` versions later that day. Nx publishes advisory GHSA-cxm3-wv7p-598c. Wiz reports that GitHub disabled the attacker-created repositories at about 09:00 UTC. ([source](https://github.com/nrwl/nx/security/advisories/GHSA-cxm3-wv7p-598c))
- 2025-08-28: Wiz reports a second phase: leaked GitHub tokens are used to make victims' private repositories public and rename them `s1ngularity-repository-` plus five random letters. Wiz's final count was more than 400 users and organizations and more than 5,500 repositories. ([source](https://www.wiz.io/blog/s1ngularity-supply-chain-attack))
- 2025-09-05: Nx publishes a postmortem and says it has moved publishing to npm trusted publishing with OIDC and manual 2FA approval. ([source](https://nx.dev/blog/s1ngularity-postmortem))

## Indicators

- Affected versions: `nx` 20.9.0–20.12.0 and 21.5.0–21.8.0, `@nx/key` and `@nx/enterprise-cloud` 3.2.0, and the other `@nx/*` versions listed above.
- GitHub repositories named `s1ngularity-repository`, `s1ngularity-repository-0` or `s1ngularity-repository-1` holding encoded data.
- The file `/tmp/inventory.txt`.
- A line `sudo shutdown -h 0` appended to `~/.bashrc` or `~/.zshrc`.

## Sources

- https://github.com/nrwl/nx/security/advisories/GHSA-cxm3-wv7p-598c
- https://nx.dev/blog/s1ngularity-postmortem
- https://www.wiz.io/blog/s1ngularity-supply-chain-attack
