Nx s1ngularity: when a supply-chain payload drives your AI CLI
Finding: The s1ngularity postinstall ran Claude, Gemini and Q with permission checks disabled to inventory secrets; where those CLIs persisted a session, the hunting prompt and its tool calls are recoverable evidence.
- Evidence class
- Public source analysis
- Confidence
- High
- Evidence availability
- Public sources only
- Reproducibility
- Reproduced
- Incident date
- 2025-08-26
- Published
- 2026-11-11
- Updated
- 2026-11-11
- Tested version
- AgentDFIR v5.0.0 (adfir format 0.2)
- Author
- AgentDFIR Labs
- Technical reviewer
- AgentDFIR owner (publication approved)
- Affected agents
- claude-code, gemini-cli, amazon-q-cli
Key findings
- The payload used the victim’s own AI CLIs. The
telemetry.jspostinstall ranclaude --dangerously-skip-permissions -p,gemini --yolo -pandq chat --trust-all-tools --no-interactivewith a prompt telling the agent to inventory wallets, keys and.envfiles into/tmp/inventory.txt(StepSecurity). - It did not need a developer to type anything. Besides
npm install, the Nx Console VS Code extension (18.6.30–18.65.1) installednx@lateston startup, so opening an editor during the window was enough (Nx advisory). - Stolen data was published under the victim’s account. Results were triple-base64 encoded and uploaded to public
s1ngularity-repository,-0or-1repositories. GitHub disabled them on 2025-08-27 around 09:00 UTC, after an exposure window of about eight hours (Wiz). - The agent route leaves evidence the rest of the payload does not. Where a CLI persisted the session, the hunting prompt, every command the agent ran and the path list it produced sit in the agent’s own transcript. Our synthetic reproduction shows AgentDFIR flagging that prompt shape and the incident indicators from the transcript alone.
- Search where the evidence is. A directory-only
agentdfir huntover the synthetic profile returned NO EVIDENCE, because that fixture has no lockfile or rc-file change. Analysing the acquired transcripts found the indicators. Scope your hunt to the surfaces the incident touched.
Scope and sources
The primary source is the Nx maintainers’ advisory, with times in EDT. The AI-CLI arguments and prompt come from StepSecurity’s analysis of the payload. Indicator lists and the exposure window come from Wiz. We cite instead of republishing, and we did not access any victim repository or leaked data.
Executive summary
Between 2025-08-21 and 2025-08-24, an attacker abused a GitHub Actions workflow in nrwl/nx: a pull_request_target trigger combined with a PR title interpolated into a shell step. They used it to run the publish.yml pipeline with a malicious commit, which sent Nx’s npm token to a webhook. On 2025-08-26 they published malicious versions of nx and several @nx/* packages. Each carried a postinstall script that harvested credentials, used local AI CLIs to find more, uploaded the results to a new public GitHub repository under the victim’s account, and appended sudo shutdown -h 0 to ~/.bashrc and ~/.zshrc.
Why it matters for agent forensics: this was the first widely documented case of malware delegating discovery to the victim’s coding agents. The agent becomes both the attacker’s tool and, if it keeps a session record, a witness.
Attack chain
Vulnerable workflow merged
Reported2025-08-21 16:31 EDTA PR-title validation workflow with pull_request_target and an injectable ${{ github.event.pull_request.title }} lands in nrwl/nx.
source: Nx advisory, timeline
npm token stolen via publish.yml
Reported2025-08-24 16:50–17:11 EDTA malicious commit plus a PR whose title injects code trigger publish.yml, which posts the npm token to a webhook.
source: Nx advisory, timeline
Malicious versions published
Reported2025-08-26 18:32 EDTnx 21.5.0 and the @nx packages first; further nx versions follow until 20:37 EDT.
source: Nx advisory, affected versions
postinstall runs telemetry.js
ReportedOn Linux and macOS: collects env, gh auth token and npmrc, then searches for wallets, keystores, .env files and SSH keys.
source: Wiz; StepSecurity
AI CLIs coerced into reconnaissance
Reportedclaude, gemini and q run with permission checks disabled and a prompt to write sensitive file paths to /tmp/inventory.txt.
source: StepSecurity (payload code)
Exfiltration to a victim-owned public repo
ReportedTriple-base64 results.b64 is uploaded to s1ngularity-repository[-0|-1] using the stolen GitHub token.
source: StepSecurity; Wiz
Lockout attempt
Reportedsudo shutdown -h 0 is appended to ~/.bashrc and ~/.zshrc.
source: Nx advisory
Containment
Reported2025-08-26 22:44 EDTnpm removes the malicious nx versions and publish tokens (22:44 EDT); GitHub disables the attacker-created repos around 09:00 UTC on 2025-08-27.
source: Nx advisory; Wiz
Timeline
Times follow the Nx advisory (EDT, UTC−4) unless marked UTC. Precision is to the minute where the source gives it.
| Time | Event | Source |
|---|---|---|
| 2025-08-21 16:31 EDT | Workflow with an injection vulnerability merged (PR #32458) | Nx advisory |
| 2025-08-21 22:48 EDT | Public post reports that the workflow is injectable | Nx advisory |
| 2025-08-22 15:45 EDT | Vulnerable workflow reverted on master (outdated branches still carried it) |
Nx advisory |
| 2025-08-24 16:50 EDT | Malicious commit 3905475c made to nrwl/nx |
Nx advisory |
| 2025-08-24 17:04–17:11 EDT | Injecting PR created; publish.yml run leaks the npm token |
Nx advisory (audit logs) |
| 2025-08-26 18:32 EDT | nx 21.5.0 and @nx/* packages published |
Nx advisory |
| 2025-08-26 20:30 EDT | First public GitHub issue (#32522) | Nx advisory |
| 2025-08-26 22:44 EDT | npm removes the affected versions and all publish tokens | Nx advisory |
| 2025-08-27 01:53 EDT | Security advisory posted | Nx advisory |
| 2025-08-27 ≈09:00 UTC | GitHub disables attacker-created repositories | Wiz |
| 2025-08-27 08:33 EDT | Nx Console released without the nx@latest install |
Nx advisory |
Agent and CLI reconstruction
The payload’s CLI table, as published by StepSecurity:
const cliChecks = {
claude: { cmd: 'claude', args: ['--dangerously-skip-permissions', '-p', PROMPT] },
gemini: { cmd: 'gemini', args: ['--yolo', '-p', PROMPT] },
q: { cmd: 'q', args: ['chat', '--trust-all-tools', '--no-interactive', PROMPT] },
};
Each flag removes the human approval step that normally stands between an agent and the file system. For an investigator, the useful consequence is that the reconnaissance ran through the agent. Whatever the CLI records about a session (prompt, tool calls, tool output) is a second trace of the payload’s behaviour. That trace is independent of /tmp/inventory.txt, which the payload could overwrite or which a reboot could clear. Wiz reports that AI provider guardrails sometimes refused the request. A refusal is itself evidence that the payload ran.
Reproduce with AgentDFIR (synthetic)
export AGENTDFIR_HOME="$PWD/home"
agentdfir simulate --scenario s1ngularity --out "$PWD/profile"
agentdfir collect --product claude --path "$PWD/profile" --case-id LABS-002 --out "$PWD/LABS-002.adfir"
agentdfir analyze LABS-002.adfir
Acquired: 4 artifacts (3388 bytes)
Incident IOCs: 9 incident(s) checked, 1 with indicators present
Attack chains: 20 chain(s) evaluated, 0 matched
CRITICAL — [SIMULATED] Indicator of a Known Incident: Nx "s1ngularity" npm compromise [KNOWN_INCIDENT_IOC]
Finding: path:/tmp/inventory.txt observed in a command the agent ran (1 time(s)). First seen 2025-08-26T22:32:14Z (transcript time).
Evidence: …-node-modules-nx/f6a7b8c9-6666-4d7e-8f90-ffffffffffff.jsonl:2 (artifact 776fc7f7f461)
MITRE: T1195.002 AML.T0010
HIGH — Session Opened With an Instruction to Hunt for Secrets [HEADLESS_AGENT_SECRET_HUNT]
Finding: The first user message of this session tells the agent to search the file system for wallets, keys or
credential files and write what it finds to a file — the Nx s1ngularity prompt shape.
MITRE: T1552.001 AML.T0055
LOW — Agent Created a GitHub Repository or Gist [GITHUB_EXFIL_REPO_CREATE]
| Severity | Finding | Where |
|---|---|---|
| CRITICAL ×2 | KNOWN_INCIDENT_IOC: /tmp/inventory.txt and s1ngularity-repository in commands the agent ran |
recon session line 2; upload session line 2 |
| HIGH ×2 | KNOWN_INCIDENT_IOC: the same indicators seen in tool output |
recon session line 5; upload session line 3 |
| HIGH | HEADLESS_AGENT_SECRET_HUNT: session opened with a secret-hunting instruction |
recon session, first message |
| MEDIUM | SENSITIVE_FILE_READ: .env referenced by the agent |
recon session line 2 |
| LOW | GITHUB_EXFIL_REPO_CREATE: gh repo create … --public |
upload session line 2 |
Every finding is RECORDED with second witness UNKNOWN. To confirm or contradict the agent’s account, pair the transcript with process telemetry for the node → claude launch and with GitHub’s audit log for repo.create.
agentdfir hunt --path over the same directory returned NO EVIDENCE for s1ngularity, and it says why: it searched lockfiles, installed files and shell rc files, and the fixture contains none of them. On a real host, run both: hunt --path ~ for the nx lockfile entries and the rc-file line, and collect plus analyze for the agent sessions.
| Fixture file | SHA-256 |
|---|---|
…-node-modules-nx/f6a7b8c9-6666-4d7e-8f90-ffffffffffff.jsonl |
776fc7f7f4617034856b3841675430cf0bcc2eacf9403fbbfe86eb0ef68bd07d |
…-monorepo/a7b8c9d0-7777-4e8f-9012-aaaaaaaaaaab.jsonl |
ccec0a38be7c96a03c9ebd8acb1dbad14c5965dc01982016a395d4dfb43f3fe7 |
Indicators and where to look
| Indicator | Type | Where to look | False-positive note |
|---|---|---|---|
/tmp/inventory.txt, /tmp/inventory.txt.bak |
File | Host file system, agent transcripts | Generic name; check contents and creation time |
s1ngularity-repository, -0, -1 |
GitHub repo name | GitHub audit log repo.create, the user’s repositories |
Highly specific |
sudo shutdown -h 0 in ~/.bashrc / ~/.zshrc |
Persistence/lockout | Shell rc files | Rare in legitimate rc files |
nx 20.9.0–20.12.0, 21.5.0–21.8.0; @nx/* 21.5.0 / 20.9.0; @nx/key, @nx/enterprise-cloud 3.2.0 |
Package version | Lockfiles, npm and pnpm caches, ~/.npm/_npx |
Version match alone does not prove the postinstall ran |
--dangerously-skip-permissions, --yolo, --trust-all-tools launched by node |
Process arguments | EDR or audit process events, agent session records | These flags have legitimate uses; the parent process matters |
ATT&CK and ATLAS mapping
| Technique | Why it applies |
|---|---|
| T1195.002 Compromise Software Supply Chain | Malicious versions published with a stolen npm token (Nx advisory) |
| AML.T0010 AI Supply Chain Compromise | AgentDFIR’s incident-IOC rule maps the s1ngularity indicators to this technique |
| T1552.001 Credentials in Files | Search for .env, keystores, SSH keys and wallets (StepSecurity, Wiz) |
| AML.T0055 Unsecured Credentials | AgentDFIR’s mapping for an agent session instructed to hunt for credential files |
| T1059 Command and Scripting Interpreter | postinstall execution, and AI CLIs driven to run shell commands |
| T1567 Exfiltration Over Web Service | Upload of results.b64 to GitHub (StepSecurity) |
Containment and recovery
The Nx advisory’s remediation steps:
- check the GitHub security log for
repo.createevents - check for
/tmp/inventory.txt - rotate GitHub tokens, revoking the
ghOAuth app, and rotate npm tokens and any secret that was in the environment - clean
~/.bashrcand~/.zshrc - purge caches and internal registries
On the agent side, before you rotate anything, preserve the session stores of every AI CLI on the host. They may be the only record of which paths the payload enumerated.
Related research
- Reproducing a poisoned tool-result chain in an AI coding agent: what a transcript proves without a second witness.
Limitations
- AgentDFIR had no access to victim systems. Incident facts come from the Nx advisory and the Wiz and StepSecurity analyses listed under Sources.
- The reproduction is synthetic. It models the AI-CLI reconnaissance as Claude Code sessions, and it models the GitHub upload as an agent command. In the real incident the upload was made by telemetry.js through the GitHub API, not by an agent.
- Whether a headless CLI run left a session transcript depends on the CLI and its version. Absence of a transcript is not evidence that the CLI did not run.
- Victim counts are the vendors' published observations, not AgentDFIR measurements.
Sources
- https://github.com/nrwl/nx/security/advisories/GHSA-cxm3-wv7p-598c
- https://github.com/advisories/GHSA-cxm3-wv7p-598c
- https://nvd.nist.gov/vuln/detail/CVE-2025-10894
- https://www.wiz.io/blog/s1ngularity-supply-chain-attack
- https://www.stepsecurity.io/blog/supply-chain-security-alert-popular-nx-build-system-package-compromised-with-data-stealing-malware
- https://github.com/efij/AgentDFIR/releases/tag/v5.0.0
Changelog
- 2026-11-11: current revision.
- No corrections.
License: Text © AgentDFIR, all rights reserved. Quoted advisory material belongs to its authors and is cited.. Report a factual error: contact Labs.
Investigate with AgentDFIR OSS
Every command in this report runs on the free, MIT-licensed release. It works offline and needs no account.
Need enterprise evidence assurance?
We test whether your telemetry can prove what an agent changed, and show you the gaps.