Shai-Hulud: a self-replicating npm worm hit 500+ packages in September and 25,000 repos in November
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.
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.
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.
Infected npm packagespreinstall Bun dropperShai-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.
preinstall Bun dropperCloud & token harvestStolen GitHub tokens publish victim secrets inside unrelated victims’ accounts under Sha1-Hulud: The Second Coming until GitHub revokes tokens and privatizes the leak repos.
Cloud & token harvestAuto-republish & leaks
Figure 1. How the attack unfolded, and what stayed isolated. Select any step or box for details.
What they took
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
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
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
Alert immediately on unauthorized public repository creations or GitHub Actions workflow additions across your organization and developer accounts.
.npmrc-hardeningEnforce script-blocking and release-age cooldowns in pnpm/npm so worm waves cannot auto-execute.
# .npmrc (apply in CI and developer workstations)ignore-scripts=trueaudit=true # pnpm-workspace.yaml (wait 72 hours before pulling brand-new npm versions)# minimumReleaseAge: 4320Appendix
Evidence log: what’s confirmed and what’s withheld
| Claim | Status | Source |
|---|---|---|
| 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) |
| 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 |
| 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 |
| 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
setup_bun.js / bun_environment.jsSha1-Hulud: The Second Coming / The Continued Cominggithub.com/wiz-sec-public/wiz-research-iocs
Reproduction lab
Cross-check your lockfiles against Wiz’s published Shai-Hulud 2.0 package CSV and verify your CI runners block npm preinstall hooks.
npm config get ignore-scripts
# Compare installed versions against wiz-sec-public/wiz-research-iocs/reports/shai-hulud-2-packages.csv