The update that ate npm
On September 15, 2025, security researchers noticed something strange happening on npm — the giant library where programmers download free, reusable code packages. Popular packages, including one used to handle colors that millions of projects rely on, had just been "updated." Except the updates weren't from their authors.
The new versions contained a hidden script that ran the moment a developer installed them. It hunted through the victim's computer for passwords and access keys — for npm, GitHub, Amazon, Google Cloud — shipped them off to the attackers, and then did the thing that made this worm historic: it used the victim's own npm credentials to republish itself into every package that victim maintained. A developer who installed the poisoned package at breakfast could be unknowingly poisoning hundreds of other projects by lunch.
Within days, roughly 200 packages (about 600 poisoned versions) carried the worm, and thousands of stolen secrets had been dumped into public GitHub repos the attackers named "Shai-Hulud" — the giant sandworms from the book and movie Dune. Two months later, an even bigger second wave — nicknamed "The Second Coming" — hit hundreds more packages, including tools from Zapier, ENS Domains, and Postman, and spread stolen data across tens of thousands of GitHub repositories.
Nobody clicked a sketchy link. Nobody downloaded a virus. They just ran the normal, boring, daily command that every JavaScript project in the world runs: npm install.
- What happened
- Shai-Hulud became the first self-spreading worm inside a package ecosystem: poisoned npm updates stole credentials, then used them to poison more packages.
- When
- First wave September 15, 2025 (~200 packages); a larger "Second Coming" wave followed in November 2025.
- Who
- Still unknown — the attackers never revealed themselves. The name comes from Dune's sandworms, which the attackers used as a calling card.
- The catch
- Every victim was also a carrier. Installing one bad update could silently push the worm to every package you maintained.
Your code is other people's code
Modern software isn't written, it's assembled. A typical web project might directly install 30 packages — and each of those installs its own helpers, which install their own helpers. One little project can quietly depend on hundreds or thousands of strangers' packages.
That's the software supply chain: like a sandwich shop that doesn't grow its own bread or lettuce — it buys ingredients from suppliers. A supply-chain attack doesn't poison the shop's kitchen. It poisons a truck on the way in, so every sandwich looks fine until it isn't.
Package author
Writes a free, useful tool and publishes it to npm
Poisoned update
Attacker publishes a bad version under the author's name
Your project
npm install pulls the "update" automatically — the attack rides inside
Simple definition: a supply-chain attack hacks you by hacking something you trust — like a package you install — instead of hacking you directly. Want the technical deep dive, including typosquatting and dependency confusion? See npm Supply-Chain Attacks.
The worm's three moves
Shai-Hulud's genius was a loop that turned every victim into a distributor:
- Run on install. npm packages can carry "install scripts" — code that runs automatically during setup, meant for chores like compiling add-ons. The worm hid in a postinstall script, so just installing the package ran it. You never had to use the code.
- Steal the keys. On the victim's machine it scanned for credentials — npm and GitHub login tokens, cloud keys — and exfiltrated them, even flipping the victim's private GitHub repos public so anyone could read the secrets inside.
- Republish itself. With the stolen npm token, it logged in as the victim and pushed the worm into every package that person maintained. The next developer who updated their package got infected, and the loop repeated.
That's what made it a worm and not "just" malware: it reproduced using its victims' identities. Each infection minted new carriers automatically. It's the same self-copying trick as the Morris worm and Samy — just moving through package registries instead of networks or profile pages.
What happened after
The cleanup was frantic: npm yanked poisoned versions, GitHub scrubbed the leaked-secret repos, and companies that had installed an infected update had to rotate — cancel and replace — every credential it could have touched. But the lasting fallout was a redesign of how package installation works.
Within weeks, the ecosystem agreed the core problem was speed: a poisoned package version was being installed by thousands of projects in the hours before anyone noticed it was bad. So package managers added a brake:
- pnpm shipped minimumReleaseAge in September 2025: your project won't install a package version until it's been out for a set amount of time — say, 3 days.
- npm shipped minimum-release-age in December 2025 — the same idea for the biggest package manager on Earth.
- GitHub hardened npm publishing — requiring two-factor authentication and short-lived "trusted publishing" tokens instead of the permanent tokens the worm loved to steal.
The nickname for it is a waiting room or a minimum-release-age policy — some teams call it "package minimum days." A poisoned version typically gets discovered and yanked within hours, so if your installs refuse versions younger than 3 days, the attack is over before your build ever sees it. The worm needed you to be an early adopter; this makes sure you're not.
Set a waiting period
Here are six package updates queued for a pretend project. Two were published minutes ago — and one of those is poisoned (the worm!). Pick a minimum-release-age policy, then press Run install to see what gets through. Can you find the policy that blocks the worm without blocking everything?
Trust, but make it earn the key
You probably won't ship an npm package this year. But you will build on other people's code, install apps and extensions, and trust downloads. The defenses that beat Shai-Hulud work for everyone:
Don't be first in line
For packages, browser extensions, and app updates alike: "just released" and "just attacked" look identical at hour zero. A minimum-age rule — or just waiting a few days — dodges most fresh attacks.
Know your ingredients
Every dependency is a stranger's code running in your project. Fewer packages, and sticking to well-maintained ones, means fewer doors.
Give out small keys
The worm needed permanent, all-powerful tokens. Short-lived logins, two-factor authentication, and keys that only unlock one door limit the blast radius.
Lock your list
A lockfile records the exact versions your project installed and tested. Updating on purpose beats updating by accident.
Remember: supply-chain attacks win by being faster than your skepticism. A waiting period is just skepticism, automated.
Try it with your family or class
Pick one of these to talk about at dinner, in the car, or with a classmate.
- Think of something built from strangers' work — a phone app, a school website, a video game mod. Where does its "supply chain" have weak links?
- A waiting period slows down real features and security fixes too. Is three days without a brand-new update worth dodging a worm? Where would you set the dial?
- When you ask an AI tool to write code, it often suggests installing packages. Who's responsible for checking those suggestions — the tool, or you?
Check your understanding
In your own words: what made Shai-Hulud a worm rather than ordinary malware, and why does a "minimum release age" policy stop it so effectively?
Your answer:
Sample answer: Shai-Hulud was a worm because it reproduced itself: when someone installed a poisoned package, it stole that person's npm credentials and republished the worm into every package they maintained — turning each victim into a new source of infections. Minimum release age stops it because poisoned versions are typically discovered and removed within hours, so refusing to install any version younger than a few days means the attack is already over before your project downloads it.
Quick quiz
1. How did Shai-Hulud spread to new victims?
2. What is a "minimum release age" (package minimum days) policy?
3. Why did install scripts make Shai-Hulud so dangerous?
You've read all five case files
From 1988's accidental worm to 2025's supply-chain worm, the pattern is the same: trust is the exploit. Start at the beginning to see how it all began, or dig into the technical side of supply-chain attacks.
Part of the Cyber Attack Stories tutorial series.