how it happened
- whoan attackertook Nx's npm publish token through a CI workflow
- the gapAI coding CLIs already installedrun with permission prompts skipped
- thenthe developer's own GitHub tokencreated a public repository
- the resultsecrets posted in publicthen private repositories opened up
what everyone assumed
An AI coding assistant in the terminal feels like a colleague who sits with one developer. It reads the code that developer points it at, runs the commands that developer approves, and stops when the session ends. The permission prompts reinforce the picture: the tool asks before it touches anything. A careful team could reasonably think of it as an extension of the developer’s own hands, scoped to whatever the developer is doing at the moment.
Nobody has published a statement of what Nx’s users believed, so this belief is an inference from what the attack relied on. The assistant is a program on the laptop. Any other program running as the same user can start it, with whatever flags it likes.
what happened
Nx is an open-source build system for JavaScript projects, published on npm. Its own GitHub security advisory, posted on 27 August 2025, gives the timeline in US Eastern time.
The publish token. On 21 August 2025 Nx merged a GitHub Actions workflow that printed each pull request’s title inside a shell step. The workflow ran on the pull_request_target trigger, which the advisory says runs with a read/write token for the Nx repository. A title containing shell code would run as code. A post on X pointed this out that night. Nx reverted the workflow on its main branch the next day, which the advisory calls an inadequate fix: Nx says it believes the attacker opened a pull request against an outdated branch that still carried the old workflow. On 24 August a commit and a pull request used that path to start Nx’s publishing workflow, and the advisory says the commit showed signs of posting the npm publish token to a webhook. The secrets setup that kept the token away from outside contributors did not help: according to Nx’s advisory, the attacker ran Nx’s own pipeline inside Nx’s own repository, starting from a commit that came from a fork. How that kind of pipeline secret gets reached is covered in pipeline secrets.
The poisoned versions. From 6:32 pm to 8:37 pm Eastern on 26 August 2025, eight versions of nx and versions of several @nx plugins appeared on npm. The npm registry’s own record shows the nx versions published between 22:32 and 00:37 UTC. Each carried a script that ran on install. Nx’s advisory notes that installs do not only happen when someone types a command: its own VS Code extension, Nx Console, versions 18.6.30 to 18.65.1, installed the latest nx to check its version, so opening the editor during the window was enough.
The AI tools. The advisory says the script scanned the file system for text files, paths and credentials, and its appendix prints the instruction the script gave: act as a file-search agent, find configuration and environment files, and write their paths to /tmp/inventory.txt. Nx’s post-mortem of 5 September 2025 says the script attempted to use local AI tools, naming Claude and Gemini. StepSecurity, a vendor that sells CI security tooling, published the script’s code on 27 August 2025. In its analysis the script skipped Windows, looked for claude, gemini and q on the machine, and ran them non-interactively: claude with --dangerously-skip-permissions, gemini with --yolo, and q chat with --trust-all-tools. Anthropic’s Claude Code reference describes the first flag as skipping permission prompts. The Gemini CLI configuration reference describes YOLO mode as auto-approving all actions. Another program running as the same user started the assistants and switched off their permission prompts with one flag each.
The developer’s own GitHub token. StepSecurity reports that the script also read environment variables, the GitHub CLI’s token, the npm token in ~/.npmrc and SSH keys. Nx’s advisory says the results went, as an encoded string, into a new repository under the victim’s own GitHub account with s1ngularity-repository in its name. StepSecurity’s code shows the repository created as public. The script also added sudo shutdown -h 0 to the shell startup files, so each new terminal would ask for the password and switch the machine off.
step by step
- 21 to 24 August 2025a CI check leaks the publish tokenA pull-request title check in Nx's GitHub Actions ran attacker text as shell code, and Nx believes it was used to send its npm token to a webhook.
- 26 August 2025poisoned nx versions go liveEight nx versions and several plugin versions were published in about two hours, each with an install script.
- the script hands the search to the AI toolsWhere claude, gemini or q was installed, the script ran it with its permission prompts skipped and asked it to list files that could hold secrets.the assumption breaks here
- 26 to 27 August 2025npm pulls the versionsAbout four hours after the first publish, npm removed the versions and Nx's publish tokens, and Nx posted its advisory a few hours later.
- 28 August 2025a second waveStolen GitHub tokens were used to make private repositories public, according to StepSecurity and GitGuardian.
how it surfaced
A user raised the alarm on Nx’s GitHub issue tracker at 8:30 pm Eastern on 26 August, and another reported it to npm support at 9:54 pm, according to Nx’s advisory. At 10:44 pm npm removed the versions and the publish tokens. Nx’s post-mortem puts the time the packages were live at four hours. It also says the versions were spotted partly because they lacked provenance, the signature linking a package to its build, and adds that “provenance doesn’t block unsigned packages from being installed”. GitHub began hiding the public repositories the next morning, the advisory says.
The counts come from vendor research. GitGuardian, which sells secrets detection, wrote on 27 August 2025 that it saw 1,346 repositories named s1ngularity-repository and 2,349 distinct secrets in them, about half still valid when it wrote. It found that 33% of the compromised systems had at least one AI command-line client installed, and that of 366 systems where those tools were targeted, 95 wrote the inventory file. GitGuardian’s hedged reading is that “many LLM clients refused to comply”. The script also read tokens directly, per StepSecurity’s analysis, so the AI step was one route among several.
The stolen GitHub tokens were then used again. StepSecurity reports a second wave on 28 August 2025, in which compromised credentials were used to rename private organisation repositories and make them public. GitGuardian’s data counts 10,767 repositories made public in that phase. Nx moved its packages to trusted publishing without long-lived npm tokens, required two-factor approval for releases and added approval for workflows from outside contributors.
In September 2025 the Shai-Hulud worm used stolen npm tokens to spread through further packages, and the Amazon Q extension case shows an AI coding tool’s own release turned against its users. The guide on coding agents and the tokens they run with covers the mechanism, the engineer’s laptop covers what that machine holds, and GitHub as an identity surface covers the personal GitHub tokens the script used to post its results.
An AI assistant on a laptop answers to any program that can start it, with the developer’s tokens and the flags that program chooses.
Ask which of your developers’ machines have an AI coding CLI and a signed-in GitHub CLI side by side, and whether either one could be told to skip its prompts.
picture it at a company like yours
The company here is made up. The other two paths are not: they happened, and each links to the story.
- in this storythe day it mattersA routine install pulls in a poisoned update, the script asks the assistant to search the disk, and the GitHub tool posts the results.what it costs youYour keys sit in a public repository under your developer's name, and the clean-up reaches every service those keys open.
- or it goes like thisit happenedEchoLeak / Microsoft 365 Copilot, 2025howAn email with hidden instructions reaches an assistant that reads every inbox.what leavesanything the assistant can seewho ends up with itthe stranger who sent the email
- or it goes like thisit happenedMCP tool poisoning, 2025howA tool description tells the agent to send files somewhere else.what leavesfiles the agent can openwho ends up with itwhoever wrote the tool
sources
- Nx (nrwl/nx) GitHub security advisory GHSA-cxm3-wv7p-598c: Malicious versions of Nx and some supporting plugins were published, 27 August 2025
- Nx blog: S1ngularity, what happened, how we responded, what we learned, 5 September 2025
- npm registry: nx package metadata (publish times)
- StepSecurity: Popular Nx build system package compromised with data-stealing malware, 27 August 2025 (vendor research)
- GitGuardian: The Nx s1ngularity attack, inside the credential leak, 27 August 2025, updated 28 and 29 August 2025 (vendor research)
- Claude Code documentation: CLI reference
- Gemini CLI documentation: configuration reference
your turn
what you can do about it
this week
List the AI coding CLIs and signed-in GitHub CLIs on every developer laptop, and lock the skip-prompts mode where the tool allows it.
Ask each developer which AI coding tools they run in the terminal and whether the GitHub CLI is signed in, then check your GitHub audit log for any repository named s1ngularity-repository. Where a tool offers an admin setting that disables its no-prompt mode, as the Gemini CLI configuration reference does for YOLO mode, turn it on. Nx's users lost their tokens to tools that were already installed and already trusted, so who on your team could say today what an install script would find on their machine?
go deeper
if you're not sure where to start
Run the offboarding checklist on one leaver. It covers every account and token to close when someone leaves.
open the checklist →
