{"incident":{"slug":"shai-hulud-2025-npm-supply-chain-worm","caseId":"BI-2025-009","organization":"Shai-Hulud (npm)","title":"Shai-Hulud: a self-replicating npm worm hit 500+ packages in September and 25,000 repos in November","shortSummary":"Two waves of the self-propagating Shai-Hulud npm worm stole maintainer tokens, infected hundreds of packages across Zapier, Postman, and PostHog ecosystems, and leaked cloud secrets into over 25,000 public GitHub repositories.","lede":"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.","incidentDate":"Sep–Nov 2025","incidentDateIso":"2025-09-16","incidentEndIso":"2025-11-26","waves":[{"id":"sh-w1","label":"Wave 1","date":"Sep 16 to Sep 23, 2025","startIso":"2025-09-16","endIso":"2025-09-23","summary":"Shai-Hulud 1.0 self-propagated across 500+ npm packages (starting around @ctrl/tinycolor), running TruffleHog and exfiltrating secrets to public GitHub repositories."},{"id":"sh-w2","label":"Wave 2","date":"Nov 24 to Nov 26, 2025","startIso":"2025-11-24","endIso":"2025-11-26","summary":"Shai-Hulud 2.0 shifted to preinstall (setup_bun.js / bun_environment.js), infected 796+ package versions, created 25,000+ public GitHub leak repos, and added a home-directory wiper fallback."}],"disclosedDate":"Nov 24, 2025","sourceUrl":"https://www.wiz.io/blog/shai-hulud-2-0-ongoing-supply-chain-attack","sourceAuthor":"CISA Alert (Sep 23, 2025), Wiz Research, and Palo Alto Unit 42","vectorFilter":"CI supply chain","timeToDetect":"Hours per wave (mass cross-account repo leaks visible Nov 24, 01:22 UTC)","detectedBy":"Security researchers (Wiz, Unit 42, Aikido, Socket) and npm/GitHub security","initialAccess":{"label":"Self-propagating npm worm & stolen tokens","detail":"Compromised maintainer npm tokens seeded trojan-free-looking updates that harvested victim tokens and auto-republished to every package each victim maintained","evidence":"confirmed"},"blastRadius":"500+ packages (Wave 1), ~796+ package versions & 25,000+ GitHub repos (Wave 2)","whatItReachedShort":"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","whatHeldShort":"Pipelines enforcing frozen lockfiles, ignore-scripts=true, release-age cooldowns, and OIDC Trusted Publishing with zero static npm tokens","revisions":[{"id":"Rev A","date":"Nov 26, 2025","note":"Published from CISA’s Sept 23, 2025 npm alert, Wiz’s Nov 24–26 Shai-Hulud 2.0 telemetry (wiz-sec-public/wiz-research-iocs), and Palo Alto Unit 42’s analysis."}],"bodyMarkdown":"## How they got in\n\nMost 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.\n\nWave 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.\n\nWave 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.\n\n## What it reached\n\nWiz 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).\n\nIf 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.\n\n## What held\n\nTeams 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.\n\n> **Why this matters for defenders**\n>\n> A self-replicating package worm moves faster than human triage. You cannot wait for advisory feeds to catch up: disable install scripts globally (`ignore-scripts=true`), enforce a release-age cooldown on registry upgrades, and remove static npm and GitHub PATs from every workstation and runner.","narrative":{"howTheyGotIn":["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."],"whatItReached":["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."],"whatHeld":["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."],"sideNoteTitle":"Why this matters for defenders","sideNoteParagraphs":["A self-replicating package worm moves faster than human triage. You cannot wait for advisory feeds to catch up: disable install scripts globally (`ignore-scripts=true`), enforce a release-age cooldown on registry upgrades, and remove static npm and GitHub PATs from every workstation and runner."]},"claims":[{"group":"How they got in","claim":"Wave 1 (starting Sept 16, 2025) compromised over 500 npm packages by harvesting developer tokens and automatically republishing worm-infected versions","evidence":"confirmed","source":"CISA Alert (Sep 23, 2025)"},{"group":"What it reached","claim":"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","evidence":"confirmed","source":"Wiz Research (Nov 24–26, 2025) and Palo Alto Unit 42"},{"group":"What it reached","claim":"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","evidence":"confirmed","source":"Wiz Research and Palo Alto Unit 42, Nov 2025"},{"group":"What held","claim":"Environments enforcing frozen lockfiles, ignore-scripts=true, and OIDC Trusted Publishing avoided both preinstall execution and static token theft","evidence":"confirmed","source":"CISA Alert and Wiz remediation guidance"}],"diagram":{"label":"How Shai-Hulud turned stolen npm tokens into a self-replicating worm across build servers and GitHub","zones":[{"id":"reg","label":"Compromised npm packages","kind":"boundary","lane":0},{"id":"build","label":"Developer & CI runners","kind":"boundary","lane":1},{"id":"out","label":"Worm spread & leak repos","kind":"boundary","lane":2},{"id":"safe","label":"Hardened builds","kind":"isolated","lane":2}],"nodes":[{"id":"sh-seed","zone":"reg","name":"Infected npm packages","detail":"500+ W1 / 796+ W2","kind":"attacker","ev":"confirmed","at":0,"when":"Sep 16 & Nov 24, 2025","steps":[1],"story":"Using stolen maintainer npm tokens, the worm injected malicious payloads into hundreds of legitimate npm packages across two waves in September and November 2025."},{"id":"sh-pre","zone":"build","name":"preinstall Bun dropper","detail":"setup_bun.js hook","kind":"compromised","ev":"confirmed","at":1,"when":"Nov 24, 03:00 UTC","steps":[1,2],"ctl":["sh-k1"],"story":"In Wave 2, execution moved to package.json preinstall (setup_bun.js and bun_environment.js) so payloads fired before build steps or static post-install checks."},{"id":"sh-cred","zone":"build","name":"Cloud & token harvest","detail":"AWS, GCP, npm, GitHub","kind":"compromised","ev":"confirmed","at":2,"when":"Sep & Nov 2025","steps":[2,3],"ctl":["sh-k2"],"story":"The script swept runner environments, cloud IMDS metadata, and local files for AWS, GCP, Azure, npm, and GitHub tokens, attempting a home-directory wipe if token access failed."},{"id":"sh-worm","zone":"out","name":"Auto-republish & leaks","detail":"25,000+ GitHub repos","kind":"compromised","ev":"confirmed","at":3,"when":"Nov 24–26, 2025","steps":[3],"ctl":["sh-k3"],"story":"Stolen npm tokens auto-infected every other package maintained by the victim, while stolen GitHub tokens published cross-victim secrets to public repos labeled Sha1-Hulud: The Second Coming."},{"id":"sh-safe","zone":"safe","name":"Pinned & script-free CI","detail":"ignore-scripts held","kind":"isolated","ev":"confirmed","at":0,"when":"Not reached","story":"Builds using frozen lockfiles, release-age cooldowns, ignore-scripts=true, and short-lived OIDC credentials stayed outside the worm loop."}],"edges":[{"id":"she1","from":"sh-seed","to":"sh-pre","kind":"attack","step":1},{"id":"she2","from":"sh-pre","to":"sh-cred","kind":"attack","step":2},{"id":"she3","from":"sh-cred","to":"sh-worm","kind":"attack","step":3}],"steps":[{"n":1,"time":"Sep 16, 2025 (Wave 1)","short":"Sep 16 W1","text":"Wave 1 worm infects 500+ npm packages and triggers CISA alert","say":"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."},{"n":2,"time":"Nov 24, 01:22–03:00 UTC (Wave 2)","short":"Nov 24 W2","text":"Wave 2 shifts to preinstall hooks (setup_bun.js) to harvest cloud and GitHub secrets","say":"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."},{"n":3,"time":"Nov 24–26, 2025","short":"25K+ repos","text":"Cross-victim exfiltration spawns 25,000+ public GitHub leak repos before takedowns","say":"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."}],"controls":[{"id":"sh-k1","step":1,"kind":"control","nodeId":"sh-pre","name":"Set ignore-scripts=true","tag":"Stops step 1","long":"Block preinstall and postinstall lifecycle execution across CI and workstations by default, and configure a multi-day minimumReleaseAge cooldown in pnpm/npm proxies."},{"id":"sh-k2","step":2,"kind":"control","nodeId":"sh-cred","name":"Ephemeral OIDC & egress","tag":"Stops step 2","long":"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."},{"id":"sh-k3","step":3,"kind":"detection","nodeId":"sh-worm","name":"Watch rogue GitHub repos","tag":"Catches step 3","long":"Alert immediately on unauthorized public repository creations or GitHub Actions workflow additions across your organization and developer accounts."}],"detectedAt":{"time":"Sep 16, 2025 (Wave 1) & Nov 24, 2025 (Wave 2)","short":"Sep & Nov 2025","text":"Wiz, Unit 42, and registry teams flagged Wave 2 within hours of 01:22 UTC Nov 24; GitHub revoked tokens and reduced public leak repos to ~300 by Nov 26."}},"plate":{"W":814,"H":380,"label":"How Shai-Hulud turned stolen npm tokens into a self-replicating worm across build servers and GitHub","zones":[{"id":"reg","label":"Compromised npm packages","kind":"boundary","x":8,"y":16,"w":237,"h":110},{"id":"build","label":"Developer & CI runners","kind":"boundary","x":283,"y":16,"w":237,"h":212},{"id":"out","label":"Worm spread & leak repos","kind":"boundary","x":558,"y":16,"w":248,"h":110},{"id":"safe","label":"Hardened builds","kind":"isolated","x":558,"y":146,"w":248,"h":110}],"nodes":[{"id":"sh-seed","name":"Infected npm packages","detail":"500+ W1 / 796+ W2","kind":"attacker","ev":"confirmed","x":20,"y":52,"w":213,"at":0,"story":"Using stolen maintainer npm tokens, the worm injected malicious payloads into hundreds of legitimate npm packages across two waves in September and November 2025.","when":"Sep 16 & Nov 24, 2025","steps":[1]},{"id":"sh-pre","name":"preinstall Bun dropper","detail":"setup_bun.js hook","kind":"compromised","ev":"confirmed","x":295,"y":52,"w":213,"at":1,"story":"In Wave 2, execution moved to package.json preinstall (setup_bun.js and bun_environment.js) so payloads fired before build steps or static post-install checks.","when":"Nov 24, 03:00 UTC","steps":[1,2],"ctl":["sh-k1"]},{"id":"sh-cred","name":"Cloud & token harvest","detail":"AWS, GCP, npm, GitHub","kind":"compromised","ev":"confirmed","x":295,"y":154,"w":213,"at":2,"story":"The script swept runner environments, cloud IMDS metadata, and local files for AWS, GCP, Azure, npm, and GitHub tokens, attempting a home-directory wipe if token access failed.","when":"Sep & Nov 2025","steps":[2,3],"ctl":["sh-k2"]},{"id":"sh-worm","name":"Auto-republish & leaks","detail":"25,000+ GitHub repos","kind":"compromised","ev":"confirmed","x":575,"y":52,"w":213,"at":3,"story":"Stolen npm tokens auto-infected every other package maintained by the victim, while stolen GitHub tokens published cross-victim secrets to public repos labeled Sha1-Hulud: The Second Coming.","when":"Nov 24–26, 2025","steps":[3],"ctl":["sh-k3"]},{"id":"sh-safe","name":"Pinned & script-free CI","detail":"ignore-scripts held","kind":"isolated","ev":"confirmed","x":570,"y":182,"w":224,"at":0,"story":"Builds using frozen lockfiles, release-age cooldowns, ignore-scripts=true, and short-lived OIDC credentials stayed outside the worm loop.","when":"Not reached"}],"edges":[{"id":"she1","kind":"attack","step":1,"pts":[[233,81],[295,81]]},{"id":"she2","kind":"attack","step":2,"pts":[[402,110],[402,154]]},{"id":"she3","kind":"attack","step":3,"pts":[[508,183],[542,183],[542,81],[575,81]]}],"balloons":{"1":[264,81],"2":[402,132],"3":[542,132]},"noroute":[{"x1":520,"x2":558,"y":188,"label":"No route"}],"bps":[{"id":"sh-k1","step":1,"kind":"control","at":[264,81],"name":"Set ignore-scripts=true","tag":"Stops step 1","lead":[[264,70],[264,53],[276,53]],"lx":282,"ly":57,"anchor":"start","long":"Block preinstall and postinstall lifecycle execution across CI and workstations by default, and configure a multi-day minimumReleaseAge cooldown in pnpm/npm proxies.","nodeId":"sh-pre"},{"id":"sh-k2","step":2,"kind":"control","at":[402,132],"name":"Ephemeral OIDC & egress","tag":"Stops step 2","lead":[[402,143],[402,154],[414,154]],"lx":420,"ly":158,"anchor":"start","long":"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.","nodeId":"sh-cred"},{"id":"sh-k3","step":3,"kind":"detection","at":[542,132],"name":"Watch rogue GitHub repos","tag":"Catches step 3","lead":[[542,121],[542,104],[530,104]],"lx":524,"ly":108,"anchor":"end","long":"Alert immediately on unauthorized public repository creations or GitHub Actions workflow additions across your organization and developer accounts.","nodeId":"sh-worm"}],"steps":[{"n":1,"time":"Sep 16, 2025 (Wave 1)","short":"Sep 16 W1","text":"Wave 1 worm infects 500+ npm packages and triggers CISA alert","say":"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."},{"n":2,"time":"Nov 24, 01:22–03:00 UTC (Wave 2)","short":"Nov 24 W2","text":"Wave 2 shifts to preinstall hooks (setup_bun.js) to harvest cloud and GitHub secrets","say":"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."},{"n":3,"time":"Nov 24–26, 2025","short":"25K+ repos","text":"Cross-victim exfiltration spawns 25,000+ public GitHub leak repos before takedowns","say":"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."}],"stripRows":[{"id":"sr-sh-seed","nodeId":"sh-seed","lineStyle":"solid"},{"id":"sr-step-1","nodeId":"sh-pre","step":1,"lineStyle":"solid","bpIds":["sh-k1"]},{"id":"sr-step-2","nodeId":"sh-cred","step":2,"lineStyle":"solid","bpIds":["sh-k2"]},{"id":"sr-step-3","nodeId":"sh-worm","step":3,"lineStyle":"none","bpIds":["sh-k3"]}],"detectedAt":{"time":"Sep 16, 2025 (Wave 1) & Nov 24, 2025 (Wave 2)","short":"Sep & Nov 2025","text":"Wiz, Unit 42, and registry teams flagged Wave 2 within hours of 01:22 UTC Nov 24; GitHub revoked tokens and reduced public leak repos to ~300 by Nov 26."}},"codeArtifacts":[{"id":"sh-npmrc-guard","filename":".npmrc-hardening","language":"sh","description":"Enforce script-blocking and release-age cooldowns in pnpm/npm so worm waves cannot auto-execute.","code":"# .npmrc (apply in CI and developer workstations)\nignore-scripts=true\naudit=true\n\n# pnpm-workspace.yaml (wait 72 hours before pulling brand-new npm versions)\n# minimumReleaseAge: 4320\n"}],"reproductionLab":{"title":"Shai-Hulud IOC & lifecycle-script check","summary":"Cross-check your lockfiles against Wiz’s published Shai-Hulud 2.0 package CSV and verify your CI runners block npm preinstall hooks.","bundleMeta":"Shell check and .npmrc hardening, MIT license","safetyNote":"Read-only lockfile and configuration audit.","commands":"npm config get ignore-scripts\n# Compare installed versions against wiz-sec-public/wiz-research-iocs/reports/shai-hulud-2-packages.csv\n"},"iocs":[{"type":"File","value":"setup_bun.js / bun_environment.js","note":"Wave 2 preinstall payloads executed during package installation","evidence":"confirmed"},{"type":"Description","value":"Sha1-Hulud: The Second Coming / The Continued Coming","note":"Public GitHub repository descriptions created during Nov 24–25 cross-victim secret dumps","evidence":"confirmed"},{"type":"IOC List","value":"github.com/wiz-sec-public/wiz-research-iocs","note":"Official Wiz CSV catalog of 796+ compromised Wave 2 package versions","evidence":"confirmed"}],"publishedAt":"2025-11-26T14:00:00Z","origin":"editorial"}}