IncidentSupply chain
Shai-Hulud: self-replicating worm spreads through npm
CriticalCrowdStrike (packages affected)
A self-spreading worm infected more than 500 npm packages. Installing one stole the developer's secrets, then used their npm access to infect every other package they maintained.
Replay the attack step by step in the Learning Center
How it happened
- An infected version ran a script automatically through npm's postinstall hook.
- It dumped environment variables and ran a secret scanner to find GitHub, npm and cloud credentials.
- It posted the secrets to a public GitHub repository in the victim's account and added a malicious workflow.
- With a stolen npm token it injected itself into up to 20 of the maintainer's packages and published new versions.
Impact
Developer and CI/CD credentials were harvested and private code exposed across many organizations.
The fix
GitHub removed the packages and announced npm hardening: mandatory 2FA, short-lived tokens and trusted publishing.
Lessons
- Disable install scripts in CI where possible and pin dependencies with lockfiles.
- Replace long-lived tokens on developer machines with short-lived, scoped credentials.
- Watch for unexpected public repositories and workflows, and rotate quickly after exposure.