Shai-Hulud: from the first npm worm to the TanStack compromise
Shai-Hulud is the name researchers gave to a family of self-spreading npm worms. On 11 May 2026, a new wave called “Mini Shai-Hulud” published 84 malicious versions of 42 @tanstack/* packages in six minutes, through TanStack’s own release pipeline. Researchers saw its code and tactics again in the Red Hat compromise a few weeks later, and similar techniques in the ChainDrop worm.
A short history
- September 2025: the original Shai-Hulud, described by Snyk as the first self-propagating npm worm, compromised more than 500 packages. It searched infected machines for secrets and used stolen npm tokens to republish the victim’s other packages. CISA issued an advisory.
- November 2025: a second wave, “Sha1-Hulud 2.0”, hit about 490 packages through a
preinstallhook. - May 2026: “Mini Shai-Hulud” hit TanStack, then Mistral AI, UiPath and dozens of other maintainers within hours. StepSecurity attributes this wave to a group called TeamPCP. Snyk counted 373 malicious versions across 169 packages in that wave.
How it got into TanStack
TanStack published a detailed postmortem. In short, the attacker never stole an npm password or token:
- A pull request that ran attacker code. A bundle-size workflow used the
pull_request_targettrigger and built code from a fork, so a malicious pull request ran on TanStack’s own runner. - A poisoned cache. That run saved a tampered pnpm store into the GitHub Actions cache for the main branch.
- A stolen OIDC token. When the real release workflow later restored the cache, the attacker’s code read the workflow’s short-lived OIDC token out of the runner’s memory.
- Trusted publishing, used against them. The token was valid for npm’s trusted-publisher setup, so the malware published directly to npm as TanStack. Snyk reports that the malicious versions carried valid SLSA provenance, because they really were built by TanStack’s release workflow.
What the malicious versions did
- A hidden git dependency. Each version gained an
optionalDependenciesentry pointing at a commit in a GitHub fork. Installing it ran that dependency’spreparescript, which started a roughly 2 MB obfuscated payload. - Credential theft. It collected cloud credentials (AWS, GCP), Kubernetes and Vault tokens, GitHub tokens,
~/.npmrcand SSH keys, and sent them over the decentralised Session messaging network, so there was no attacker server to take down. - Spreading. It looked up other npm packages the victim maintains and republished them with the same injection.
- Persistence. Snyk also reports editor and AI-assistant hooks (
.vscode/tasks.json,.claude/settings.json) that rerun the malware when a folder is opened, and a “dead man’s switch” that deletes the home directory if the stolen GitHub token is revoked.
npm removed the tarballs within about three to four and a half hours. TanStack purged its caches, restructured the vulnerable workflow and pinned its third-party actions to commit SHAs.
What to do
- Check lockfiles for the affected
@tanstack/*versions from 11 May 2026 and for the other packages listed in the sources. - If one was installed, treat the machine as compromised and rotate cloud, Kubernetes, Vault, GitHub, npm and SSH credentials. Follow Snyk’s advice on the dead man’s switch before revoking GitHub tokens.
- For maintainers: avoid
pull_request_targetworkflows that build fork code, don’t share caches between untrusted and release workflows, and grantid-token: writeonly to the publish job. - For consumers: a minimum release age (for example seven days) would have avoided this wave entirely. npm 12 also stops git dependencies and install scripts from running unless you approve them.
Where DepSentinel fits. DepSentinel would have shown warnings, but honestly not a strong alarm before advisories existed. The injected dependency was installed straight from a git commit, which gets a git-source signal, and the new @tanstack/* version gets fresh-release on its first day. Each package scores below the SUSPICIOUS threshold on its own. Because the versions had valid provenance, the provenance-dropped signal would not have fired, and this payload didn’t use a preinstall hook in the package itself, so install-script-added wouldn’t either. The reliable catch is OSV’s malicious-packages feed: once the versions are listed there, DepSentinel shows them as MALICIOUS with a “remove it” fix. It doesn’t scan the .vscode and .claude files the worm planted, so check those separately.
Am I affected?
The malicious versions added an @tanstack/setup dependency pointing at a GitHub commit. Search your lockfiles for it, and look for the files the worm drops into repositories:
grep -n "@tanstack/setup" package-lock.json pnpm-lock.yaml yarn.lock 2>/dev/null
ls .claude/router_runtime.js .claude/setup.mjs .vscode/setup.mjs 2>/dev/null
For other package managers, and what to do if you find a match, see how to check your project for malicious or compromised packages.
Sources
- TanStack: npm supply chain compromise postmortem
- Snyk: TanStack npm packages compromised
- GitHub changelog: upcoming breaking changes for npm v12
Details come from the public reports above and may change as investigations continue. Package names and versions are listed so you can check your own projects; verify them against the original sources before acting.
Related
- ChainDrop: the npm worm that started in keyv and reached hundreds of packages
- Red Hat’s npm packages backdoored: how the “Miasma” worm got in
- Fake Paysafe, Skrill and Neteller SDKs: a credential stealer that looks like a payment library
Catch the next one in your editor. DepSentinel is a free VS Code extension that checks every dependency, including sub-dependencies, for known vulnerabilities and signs of a supply-chain attack. No account, no API key.