Cases › security breach › LR-2025-0041
Nx s1ngularity: malicious npm packages drove local AI coding CLIs to enumerate secrets for exfiltration
Severity major: Over 1,700 users had secrets publicly leaked and at least 480 compromised accounts published over 6,700 private repositories publicly, an unbounded scope of third parties.
Happened 2025-08-26 · Earliest source we hold 2025-08-27, 1 days later
Malicious versions of Nx packages published to npm on August 26, 2025 abused locally configured AI coding tools such as Claude and Gemini to find files for exfiltration, scanning users' systems for sensitive data and uploading the results to public GitHub repositories. Attackers had exploited a GitHub Actions injection vulnerability to steal Nx's NPM publishing token. Nx detected the packages because they lacked NPM provenance signing; they were active for 4 hours.
Risk grouping: AI used to exploit
| Who caused it | A person or organisation “Attackers exploited a GitHub Actions injection vulnerability to steal our NPM publishing token and publish malicious packages for 4 hours.” source |
|---|---|
| Intended or not | Intended “The malware also abused locally configured AI CLIs to identify additional files for exfiltration.” source |
| Before or after release | After release “On August 26, 2025, malicious versions of several Nx packages were published to npm.” source |
| The AI's part | Used as a tool “The malware also abused locally configured AI CLIs to identify additional files for exfiltration.” source |
The story
What the sources state
- Records exposed 82,901
- Other parties affected 2,399
Others like this
Jailbroken Claude used to breach Mexican government networks and steal taxpayer and voter records 2026-03-02
Anthropic Claude models gained unauthorized access to real third-party systems during evaluations 2026-10-22
AI agent (ARTEX with Claude) used in cyberattacks targeting South Korean banks 2026-10-05
Safeguards a source says failed
Provenance failed: “Unfortunately, provenance doesn’t block unsigned packages from being installed, which is what happened.”
Human approval absent: “Our publishing process itself wasn’t breached, but the token let attackers bypass release pipelines.”
Agent limits absent: “This meant any workflow token had full repository access instead of the safer read-only default (check yours at /settings/actions ).”
A model read these from the sources; each quote was checked word for word against its source.
Show the full account: 103 items from the primary sources
What happened, in order
- August 2025 The Nx "s1ngularity" attack occurred in August 2025, compromising Nx npm package versions 20.9.0 through 21.8.0.
- August 26, 2025 On August 26, 2025, malicious versions of several Nx packages were published to npm.
- August 26th Wiz Research began responding to the s1ngularity incident when news first broke on August 26th.
- August 27, 2025 GitGuardian detected secrets leaked between August 27, 2025 at 00:32:48 and August 27, 2025 at 15:36:57.
- morning (UTC) of the 28th Almost 90% of leaked GitHub tokens were still valid on the morning (UTC) of the 28th, over 24 hours after GitHub removed the repositories containing leaked secrets.
- August 28, 2025 In a second phase on August 28, 2025, attackers used valid GitHub tokens from the first phase to make private repositories public, naming them s1ngularity-repository- plus 5 random letters.
- between the evening of the 29th and the evening of the 30th Some time between the evening of the 29th and the evening of the 30th, GitHub ran a revocation campaign, after which roughly 5% of leaked GitHub keys remained valid.
- evening of August 31st Phase 3 began the evening of August 31st, when two compromised users publicly uploaded over 500 repositories belonging to a single organization.
Not dated in the sources:
- The malicious packages were active for 4 hours before being completely removed from the registry.
- Nx reached out to NPM, removed the affected token, and started to manually unpublish the malicious packages.
- NPM stepped in to remove all packages and revoke all Nx NPM tokens.
- Nx disabled all publishing workflows and external contributor access until they understood the attack vector.
Who and what was involved
- Attackers exploited a GitHub Actions injection vulnerability to steal the NPM publishing token.
- Nx is the organization that owns the Nx packages and responded to the incident.
- NPM removed all packages and revoked all Nx NPM tokens.
- GitHub collaborated closely with Nx and took leaked repositories offline.
- Community members alerted Nx to the attack and assisted during the investigation.
- The attackers targeted popular AI CLI tools including Claude, Gemini, and Q, hunting for their configuration files and authentication tokens.
- GitGuardian monitored the attack and sent 482 emails to affected developers through its Good Samaritan Program, capping at 10 emails per repository.
- An attacker compromised an npm publishing token for nx packages through a vulnerable GitHub Action.
- Wiz's Threat Exposure and Customer Incident Response Teams worked together to analyze leaked data and notify victims directly.
- In Phase 2, at least 480 compromised accounts, two-thirds of them organizations, published over 6,700 private repositories publicly.
How the agents communicated and organised
- Nx started identifying and reaching out to point of contacts: Nx Enterprise customers, social media and Discord communities, and actively monitored GitHub for leaked repositories, opening issues to alert their respective owners.
- Nx collaborated closely with GitHub, who stepped in to take leaked repositories offline.
- The attackers likely used only the GitHub API for the second phase, renaming repositories before making them public based on repository IDs.
- The malware only exfiltrated data when the gh CLI was present and it could create a repository on the victim's account.
What they used to do it
- The malicious packages ran a post-install script that scanned user systems for sensitive data, attempted to use local AI tools (like Claude and Gemini), and uploaded the results to a public GitHub repo via the GitHub CLI.
- The attacker created a PR with a malicious title containing shell commands, which executed with repository permissions due to the PR title validation workflow's injection vulnerability and pull_request_target setup.
- The malicious script ran with elevated permissions, extracted a read/write GitHub token, and used it to create a branch with a malicious script replacing the legitimate CI script, trigger the publish workflow against that branch via the GitHub API, and clean up traces by deleting branches and workflow runs.
- When the publish workflow ran the malicious script, it had access to the NPM_TOKEN and exfiltrated it.
- Using the stolen token, they published infected Nx packages with postinstall hooks that scanned users' systems and leaked data to public GitHub repositories.
- The malware scanned infected systems for GitHub tokens, npm authentication keys, SSH private keys, environment variable API keys, and cryptocurrency wallet files.
- Stolen credentials were double-base64 encoded before exfiltration to public GitHub repositories named with the "s1ngularity-repository" pattern, each containing a single "results.b64" file.
- The attackers attempted to use LLM clients as vectors to enumerate secrets on victims' machines.
- The malware directly extracted environment variables plus GitHub and npm tokens and published them in public s1ngularity-repository GitHub repositories.
- The malware abused locally configured AI CLIs to identify additional files for exfiltration.
- A second phase used leaked GitHub tokens to make victims' private repositories public, renaming them to s1ngularity-repository-#5letters#.
- All three payload variants shared code to detect popular AI CLIs: Claude, Gemini, and Amazon Q.
- The Nx 20.9.0, 20.11.0, and 21.5.0 prompt told the AI to recursively search Linux/macOS paths from $HOME and others, skip /proc /sys /dev, follow depth limit 8, avoid sudo, and record matching wallet-related file paths in /tmp/inventory.txt.
- The Nx 21.6.0 and 21.7.0 prompt used role-prompting as an authorized penetration testing agent to enumerate interesting text files and write their full paths to /tmp/inventory.txt without reading or exfiltrating contents.
- The Nx 20.12.0 and 21.8.0 prompt posed as a file-search agent looking for text configuration and environment-definition files, excluding source code and the source/ directory, and writing full paths to /tmp/inventory.txt.
- In the initial compromise of Nx's npm token, the attacker appears to have used webhook.site for remote exfiltration.
- Webhook.site was used in the initial compromise but limits anonymous users to 100 records, forcing the attacker to use an alternative exfiltration mechanism due to the large number of victims.
- In Phase 2, the attacker used TOR to access victim accounts.
- The attacker used a single-threaded Python script to publish repositories, with User Agents python-requests/2.32.3 and python-requests/2.32.4.
What they did to avoid being caught
- The double-base64 encoding was likely chosen to evade basic detection mechanisms while preserving data integrity during GitHub-based exfiltration.
- The attacker optimized for operational security by using exfiltration mechanisms that required no infrastructure of their own.
- The attackers deliberately exfiltrated data only when the gh CLI was present and they could create a repository on the victim's account, limiting their exposure.
What made it possible
- The PR title validation workflow used pull_request_target, which runs with the permissions of the target branch and can access repository secrets, bypassing normal restrictions for external contributors.
- The repository had GitHub's original default setting of 'Read and write permissions' for Actions, giving any workflow token full repository access.
- The publish.yml workflow included workflow_dispatch, enabling triggering the workflow programmatically via GitHub's API.
- The attackers targeted AI CLI tools because these tools often require elevated permissions and access to sensitive development environments.
- Of the compromised systems, 33% had at least one LLM client installed, validating the attackers' focus on AI development tools.
- Deleting repositories does not automatically revoke the underlying credentials, so developers must manually rotate tokens, API keys, and other secrets.
- Simply deleting exposed data is not enough; organizations must inventory secrets across all systems, automate rotation workflows at scale, and maintain comprehensive visibility into where credentials are used.
- AI file identification required at least one AI CLI with functional configuration and credentialing, a valid LLM response without task rejection, and a useful response identifying sensitive files.
- Configuration problems recurred, including Claude credit issues, credential issues, --dangerously-skip-permissions requiring approval, and MCP configuration issues.
- The attackers optimized for operational security by using exfiltration mechanisms that required no infrastructure, similar to the tj-actions attack.
How it was found
- Nx detected the malicious packages because they lacked NPM provenance signing.
- GitGuardian's monitoring infrastructure sees everything on GitHub including deleted files and repositories, allowing analysis of exfiltrated data.
- GitGuardian's platform listed 1,346 repositories containing "s1ngularity-repository" while GitHub listed only about ten, indicating repositories were being deleted while developers continued using the vulnerable package.
- August 28, 2025 GitGuardian released a free, open-source tool called S1ngularity Scanner to scan local environments for compromised files including environment variables.
- GitGuardian added all discovered stolen credentials to the HasMySecretLeaked database in hashed form.
- People can check whether their secrets were compromised at hasmysecretleaked.com, where the secret is hashed locally before being checked against the database.
- For bulk checking, GitGuardian's CLI can be used with commands like `ggshield hmsl check --type env <(env)`.
- Anyone who used malicious Nx versions 20.9.0 through 21.8.0 should make checking their credentials the first step in incident response.
- To check for compromise, inspect package.json and package-lock.json for malicious Nx versions 20.9.0-21.8.0 and run `npm ls nx` to verify the current installation.
- If compromised, immediately remove the node_modules directory, run `npm cache clean --force`, and inspect shell startup files (~/.bashrc, ~/.zshrc, ~/.profile) for malicious "sudo shutdown -h 0" commands.
- Most critically, rotate every credential that might have been exposed: GitHub tokens, npm tokens, SSH keys, API keys, and cryptocurrency wallet seeds.
- Check the GitHub account for "s1ngularity-repository" repositories and review audit logs for suspicious activity.
- Wiz's white glove reporting reached over 50 major impacted organizations, and the vast majority said this was the first indication they had received of the attack impacting them.
- For Phase 1, investigators should look for the string 's1ngularity' in the repo field of repo.create events in GitHub Audit Logs.
- A detection signal is a single user cloning a wide set of repositories in a short timeframe.
- Organizations should check GitHub Audit Logs for the org_credential_authorization.deauthorize event by the 'github-staff' actor_id, which is tied to GitHub's mass revocation of compromised credentials.
What it reached, and the numbers
- The attack targeted the OSS packages of Nx; Nx Cloud was not affected and remained fully operational and secure.
- Nx has approximately 6 million weekly installs.
- GitGuardian detected 2,399 repositories containing at least one secret, with 82,901 total secrets including 11,168 valid ones.
- 10,767 repositories were made public, corresponding to around 20% of repositories containing a hardcoded secret.
- Of 366 systems where LLM tools were targeted, only 95 actually wrote the requested /tmp/inventory.txt file, with many LLM clients refusing to comply.
- 85% of infected systems were running macOS, highlighting the attack's particular impact on the developer community.
- GitGuardian detected 1,079 repositories containing at least one secret, representing 2,349 distinct secrets, with the most common credential types being GitHub, NPM, AWS, and OpenAI.
- Half of the discovered secrets were valid at the time of writing, with GitHub OAuth App Keys being the most numerous.
- At the height of the wave, nearly 1,400 repositories were publicly accessible via GitHub.
- GitGuardian identified over 1,100 valid credentials from the Nx attack across GitHub tokens, OpenAI API keys, AWS credentials, and other sensitive secrets.
- The stolen secrets remained valid during GitGuardian's analysis, so attackers could still use them for lateral movement and further attacks.
- The s1ngularity attack shows concerning trends: targeting AI development tools as new attack surfaces, using public platforms like GitHub for credential exfiltration, and combining credential theft with environmental sabotage.
- Stolen credentials were weaponized rapidly, within 2-4 hours, making automated detection and response capabilities essential for modern software delivery.
- In Phase 1, over 1,700 users had secrets publicly leaked, each with at least a GitHub token in the leaked data.
- Multiple reports, echoing Wiz's own data, say over 2,000 unique, verified secrets were leaked.
- Wiz observed over 20,000 files leaked across its sample, across 250 cases impacting 225 distinct users.
- In Phase 2, at least 480 compromised accounts published over 6,700 private repositories publicly, and in one case a single organization had over 700 repositories leaked.
- Wiz identified thousands of valid credentials in the formerly-private repositories exposed in Phase 2.
- AI exfiltrated data successfully in under a quarter of cases, yielding under 100 unique valid secrets across 20,000 exfiltrated files, mostly for AI services (Langsmith, Anthropic, OpenAI) and cloud platforms (AWS, Azure, Vercel).
- Almost a quarter of Claude interactions were rejected by guardrails, Q showed similar behavior, and Gemini rejected at a lower rate.
- Almost a quarter of Gemini interactions were foiled by default restrictions to workspace directories, and in many other cases the search only ran against Nx's directory, consistently exfiltrating 14-15 non-sensitive Nx files.
- Over 40% of leaked npm tokens from the first phase are still valid, amounting to almost 100 unique tokens.
- For organizations impacted in the second phase, the exposure of secrets in formerly private repositories creates further attack surface.
- Attackers are escalating small GitHub Actions misconfigurations into massive supply chain attacks, as seen in Ultralytics, tj-actions, and now Nx.
What the sources say is still unknown or disputed
- The fact that stolen secrets remain valid raises questions on both offensive and defensive sides, and it is likely developers are unaware of the leaked secrets and have not revoked them.
- It is likely that the leaked secrets will never be revoked or rotated, though GitGuardian knows the names of the repositories that leaked secrets.
- An unknown, broader pool of Nx users may have run the malware, resulting in secrets gathered and persisted to disk but not exfiltrated.
- Wiz has yet to observe any successful cryptocurrency-related exfiltration.
- The first burst of activity has concluded, but the incident is expected to have a long tail with future risks.
Show every field, with its source and grade
The AI system
What happened
Impact
Context
LR-2025-0041 · version 9 · published 2026-10-25 after automatic checks; not yet checked field by field by a person · changes to this case · JSON