Get the free coreGet core

The Nx malware attack (s1ngularity): what happened and what to check

Updated 5 min readSection 05 / Threats
SHORT ANSWER

The Nx malware was code inside malicious Nx versions published to npm, the public registry JavaScript projects install from. It searched the Mac for wallets, key files, .env files and SSH keys, took the GitHub login token, and posted what it found to GitHub under the victim's own account. It ran only on Linux and macOS. It also asked the AI command-line tools on the machine to search files for it. Only the malicious versions matter: check which Nx version your projects installed, and look in your GitHub account for repositories you did not create.

Nx is a widely used build system published on npm; the malicious versions appeared there on August 26, 2025. The Nx malware is a supply-chain attack: the attacker does not break into your Mac, they put bad code into a package you trust, and your own install brings it in. The wider pattern is on npm supply chain attack. This page covers one incident, known as s1ngularity after the name of the GitHub repositories it created.

01What the Nx malware did

StepWhat happened
PublishMalicious Nx versions, and some @nx/ plugin packages, were published to npm
RunA postinstall script ran the code when the package was installed
SearchThe code scanned the file system for wallets, keystores, .env files and SSH keys
CollectIt took credentials, among them the GitHub CLI token and the contents of the npm config file
SendIt posted them to GitHub as a repository under the victim's account, with s1ngularity-repository in its name
PlatformsThe payload ran only on Linux and macOS

A keystore is a file that holds wallet keys. The npm config file (.npmrc) can hold your npm login token, the _authToken setting. A token is a secret string that lets a program act as your account, so whoever has it can publish packages or push code as you.

The stolen data did not go to a server the attacker owned. It was posted to GitHub under the victim's account. That is why your own GitHub repository list is evidence.

02The AI tools part

The campaign did not only read files itself. It prompted the AI command-line tools installed on the machine with flags that skip their permission questions, to collect file contents. This succeeded in hundreds of cases, although AI provider guardrails at times interceded. The best-known of those flags has its own page: --dangerously-skip-permissions.

AI agents are also one of the ways npm packages get installed without anyone typing a command. The Nx advisory lists transitive dependencies (packages pulled in by other packages), AI agents, editors, editor extensions and scripts as the first routes that come to mind. So the question is not only what you installed, but what was installed for you.

03Is the Nx advisory still active?

No. The GitHub advisory GHSA-cxm3-wv7p-598c, CVE-2025-10894, was published on 2025-08-27 and later withdrawn. A withdrawn record does not undo what the code did. If an affected version ran on your Mac, the secrets it reached may already be copied.

04How to check if the Nx malware reached your Mac

Go from the cheap checks to the costly ones.

  1. Find Nx in your projects. A lockfile (package-lock.json for npm) describes the exact tree of packages a project installed. In each project where you or an agent ran an install, run npm ls nx to see the Nx version in use, or look for nx in the lockfile. A plain nx entry is not a verdict: only some Nx versions were malicious. The malicious nx versions were 21.5.0, 20.9.0, 20.10.0, 21.6.0, 20.11.0, 21.7.0, 21.8.0 and 20.12.0, and they have since been removed from npm. Some @nx/ plugin packages were hit too; their versions are listed in the advisory.
  2. Look at your GitHub account. The malware posted collected data as a repository under the victim's account, with s1ngularity-repository in the name. Open your repository list on github.com and look for repositories you did not create. GitHub has since deactivated or archived many of these repositories, so check your recent activity too.
  3. Look at your shell startup files. The same script added sudo shutdown -h 0 to .zshrc and .bashrc, which run whenever a terminal opens. Remove that line if you find it.
  4. List what the code could reach. The payload went after wallets, keystores, .env files, SSH keys, the GitHub CLI token and the npm config contents. Whatever sat in those places on the Mac is your list of secrets to replace.

If no Nx version in your projects matches and your repository list is clean, stop there. If a matching version was installed, or you cannot tell, treat the secrets in the fourth check as copied.

05What to do if you were hit

Replace the secrets from a clean device, one the code never touched: SSH keys, npm tokens, everything from your .env files, and wallet keys if you held any on the Mac. The step-by-step version is on leaked API key.

One trap sits in the GitHub token step. Before you revoke it, look for ~/Library/LaunchAgents/com.user.gh-token-monitor.plist. It belongs to a different campaign that reacts when a token is revoked. If the file is there, do not revoke the GitHub token yet, not even from another device. Stop that program first, or wait until it exits by itself after 24 hours, then revoke. The commands are on the Shai-Hulud page. If the file is not there, revoke right away.

If your GitHub account may have been used, the GitHub account hacked page lists what to look at. If you are unsure whether anything is still running on the Mac, start with the infostealer check.

06How to lower the odds next time

Nothing here makes a malicious package safe. These settings give it less room.

npm 11 runs preinstall, install and postinstall scripts by default, after it places modules into node_modules. In npm 12, install scripts of dependencies are blocked by default. On npm 11, the ignore-scripts option set to true stops npm from running the scripts in package.json files. Test your build afterwards, since some honest packages need their scripts.

The min-release-age option installs only versions that were available more than a set number of days ago. A malicious version that is pulled quickly never reaches you. The full list of checks is in check an npm package for malware, and signs of a bad package are on npm malware.

07What the Nx malware shows

The Nx malware went after the files developers keep next to their code, and it used the AI tools developers had set up to work faster. The practical answer is the same each time: know which versions your projects installed, and replace secrets in the safe order.

The Nx payload ran through AI command-line tools already on the Mac; Artificial Immunity's free, open-source core watches agent sessions and program starts and reports what it finds.

FAQ

What is the Nx malware?

Malicious versions of Nx were published to npm. The code scanned the file system, collected credentials and posted them to GitHub as a repository under the victim's account.

What did the Nx malware steal?

It searched for wallets, keystores, .env files and SSH keys, and took the GitHub CLI token and the contents of the npm config file.

Did the Nx malware run on a Mac?

Yes. The payload ran only on Linux and macOS.

Did Nx malware use AI coding tools?

Yes. The campaign prompted installed AI command-line tools with flags that skip their permission questions to read files for it. This worked in hundreds of cases, although AI provider guardrails at times interceded. The story of the main flag is on the flag page.

Is the Nx advisory still active?

No. The GitHub advisory GHSA-cxm3-wv7p-598c (CVE-2025-10894) was published on 2025-08-27 and later withdrawn. Withdrawn does not mean harmless: if an affected version ran on your Mac, the secrets it reached may already be copied.

Should I revoke my GitHub token right away?

First check for ~/Library/LaunchAgents/com.user.gh-token-monitor.plist. If it exists, do not revoke the token yet, not even from another device. Stop that program first, or wait until it exits by itself after 24 hours, then revoke. If the file is not there, revoke right away.

Sources

  1. GitHub advisory GHSA-cxm3-wv7p-598c
  2. Wiz, s1ngularity supply chain attack
  3. Wiz, Mini Shai-Hulud
  4. Apple, launchd script management
  5. npm docs, scripts
  6. npm docs, approve-scripts (v11 and v12)
  7. npm docs, config
  8. Cursor, extension security notice
  9. Artificial Immunity
Agents install packages for you. Artificial Immunity watches the Mac where your agents work.Get the free core