# Shai-Hulud: a self-replicating npm worm hit 500+ packages in September and 25,000 repos in November

- **Canonical URL:** https://breachidents.com/incidents/shai-hulud-2025-npm-supply-chain-worm
- **Organization:** Shai-Hulud (npm)
- **Incident date:** Sep–Nov 2025
- **Disclosed / updated:** Nov 24, 2025
- **Category:** CI supply chain
- **Primary source:** CISA Alert (Sep 23, 2025), Wiz Research, and Palo Alto Unit 42 (https://www.wiz.io/blog/shai-hulud-2-0-ongoing-supply-chain-attack)

## In 30 seconds

- **How they got in:** Compromised maintainer npm tokens seeded trojan-free-looking updates that harvested victim tokens and auto-republished to every package each victim maintained _[Confirmed]_
- **What leaked / reached:** Developer laptops and CI runners installing infected npm packages (including @ctrl/tinycolor and Wave 2 packages across major SaaS ecosystems), leaking AWS, GCP, Azure, npm, and GitHub secrets
- **What stayed safe:** Pipelines enforcing frozen lockfiles, ignore-scripts=true, release-age cooldowns, and OIDC Trusted Publishing with zero static npm tokens

## Summary

In September and November 2025, the JavaScript ecosystem faced its first large-scale self-replicating credential worm. Wave 1 (Sept 16) harvested npm tokens to auto-infect more than 500 packages, prompting a CISA alert on Sept 23. Wave 2 (Nov 24, dubbed Sha1-Hulud: The Second Coming) shifted execution into preinstall hooks (setup_bun.js and bun_environment.js), infected nearly 800 package versions, pushed cross-victim cloud secrets into more than 25,000 public GitHub repos, and added a destructive home-directory wiper fallback.

## Attack sequence

1. **Sep 16, 2025 (Wave 1) — Wave 1 worm infects 500+ npm packages and triggers CISA alert:** Starting around Sept 16, 2025, Shai-Hulud 1.0 steals maintainer tokens from developer and CI hosts and self-propagates across more than 500 npm packages.
2. **Nov 24, 01:22–03:00 UTC (Wave 2) — Wave 2 shifts to preinstall hooks (setup_bun.js) to harvest cloud and GitHub secrets:** Shai-Hulud 2.0 fires during preinstall on developer laptops and CI runners, scraping cloud IAM keys, GitHub PATs, and npm tokens, with a destructive fallback wiping home folders.
3. **Nov 24–26, 2025 — Cross-victim exfiltration spawns 25,000+ public GitHub leak repos before takedowns:** Stolen GitHub tokens publish victim secrets inside unrelated victims’ accounts under Sha1-Hulud: The Second Coming until GitHub revokes tokens and privatizes the leak repos.

## How they got in

Most npm supply-chain attacks stop once the attacker burns one stolen maintainer token. Shai-Hulud turned every infected developer laptop and CI runner into a propagation node.

Wave 1 erupted around September 16, 2025. Whenever a victim installed an infected package (such as `@ctrl/tinycolor` and hundreds of sibling libraries), the payload harvested the machine's local npm token, automatically patched and republished every other package that developer maintained, and swept for cloud credentials. CISA issued an emergency alert on September 23 after more than 500 packages were caught in the loop.

Wave 2 returned on November 24, 2025 with sharper engineering. Earliest GitHub leak repositories appeared in GH Archive at 01:22 UTC, followed by malicious package uploads around 03:00 UTC. Instead of waiting for postinstall, Wave 2 fired during `preinstall` using `setup_bun.js` and `bun_environment.js`, executing before normal build checks even started.

## What it reached

Wiz Research and Palo Alto Unit 42 tracked nearly 800 compromised package versions in Wave 2 and more than 25,000 malicious public GitHub repositories created across roughly 350 compromised developer accounts. Even worse for incident responders, Wave 2 exfiltrated credentials **cross-victim**: secrets stolen from one organization were uploaded into newly created public repositories belonging to completely unrelated GitHub users under descriptions reading `Sha1-Hulud: The Second Coming` (and `The Continued Coming` during a Nov 25 secondary phase).

If the payload failed to authenticate or extract usable tokens on a host, it triggered a destructive fallback attempting to wipe files inside the user's home directory. GitHub responded rapidly by revoking exposed tokens and privatizing malicious repositories, knocking the public count down to roughly 300 by November 26.

## What stayed safe

Teams that already treated `npm install` as untrusted code execution survived both waves intact. Frozen lockfiles prevented silent version jumps into freshly poisoned releases, `ignore-scripts=true` neutered both `preinstall` and `postinstall` hooks, release-age cooldowns kept zero-hour packages out of builds, and npm OIDC Trusted Publishing ensured infected developers had no static npm tokens sitting in `~/.npmrc` for the worm to steal.

## How to defend against this

- **Set ignore-scripts=true** (Stops step 1): Block preinstall and postinstall lifecycle execution across CI and workstations by default, and configure a multi-day minimumReleaseAge cooldown in pnpm/npm proxies.
- **Ephemeral OIDC & egress** (Stops step 2): Eliminate static AWS/GCP keys and classic GitHub PATs from build runners; restrict CI egress so an infected dependency cannot reach arbitrary GitHub or registry APIs.
- **Watch rogue GitHub repos** (Catches step 3): Alert immediately on unauthorized public repository creations or GitHub Actions workflow additions across your organization and developer accounts.

## Evidence log

| Section | Claim | Evidence state | Source |
| --- | --- | --- | --- |
| How they got in | Wave 1 (starting Sept 16, 2025) compromised over 500 npm packages by harvesting developer tokens and automatically republishing worm-infected versions | Confirmed | CISA Alert (Sep 23, 2025) |
| What it reached | Wave 2 began around 01:22 UTC on November 24, 2025, infecting 796+ package versions using preinstall hooks (setup_bun.js and bun_environment.js) and spawning over 25,000 public GitHub repositories across ~350 compromised developer accounts | Confirmed | Wiz Research (Nov 24–26, 2025) and Palo Alto Unit 42 |
| What it reached | Wave 2 published secrets cross-victim (storing one company’s secrets inside another unaffiliated victim’s GitHub account) under descriptions like Sha1-Hulud: The Second Coming, and included a destructive home-directory wipe fallback | Confirmed | Wiz Research and Palo Alto Unit 42, Nov 2025 |
| What held | Environments enforcing frozen lockfiles, ignore-scripts=true, and OIDC Trusted Publishing avoided both preinstall execution and static token theft | Confirmed | CISA Alert and Wiz remediation guidance |

## Indicators of compromise

- **File:** `setup_bun.js / bun_environment.js` (undefined)
- **Description:** `Sha1-Hulud: The Second Coming / The Continued Coming` (undefined)
- **IOC List:** `github.com/wiz-sec-public/wiz-research-iocs` (undefined)

---
Published by [breachidents](https://breachidents.com). Preserve evidence labels (Confirmed / Inferred / Withheld by vendor / Observed) when citing.
