What is the Shai-Hulud npm worm?

A worm that installs, steals your tokens, then publishes as you.

Shai-Hulud is a family of self-replicating npm worms that ran inside npm install, stole npm, GitHub and cloud credentials, and used the stolen npm tokens to publish infected versions of the victim's other packages. The sections below cover every reported wave from September 2025 to October 2026, how to check whether you were hit, what to rotate and in which order, and what Chainsaw did and did not stop.

Questions and answers

What is Shai-Hulud?

Shai-Hulud is a family of self-replicating npm worms that steal developer and CI credentials during npm install, then use any stolen npm token to publish infected versions of the victim’s other packages. GitHub says it was notified of the first wave on 14 September 2025 and removed more than 500 compromised packages from the registry, and CISA’s alert of 23 September 2025 also counts over 500. A second wave, Shai-Hulud 2.0, began in late November 2025; Palo Alto Networks Unit 42 counted more than 25,000 malicious GitHub repositories across about 350 users. In 2026 the same playbook returned as Mini Shai-Hulud, which hit SAP and TanStack packages, and as ChainDrop, whose payload StepSecurity traces to Shai-Hulud 2.0. Every wave runs its code at install time, before any application imports the package. A scanner that reads dependencies after the install therefore reports the worm only after the credentials have left the machine.

When did each Shai-Hulud wave hit?

This page counts six reported Shai-Hulud waves on npm between September 2025 and October 2026, and each one moved the payload to a different install hook or a different route to publish rights. The table lists the waves in date order with the scale each source reported. Counts differ between sources because they were taken at different hours of a fast-moving attack: for Shai-Hulud 2.0, Aikido counted 492 packages while Wiz described nearly 800. Sources also number the generations differently. Tenable counts Mini Shai-Hulud as the fourth generation of Shai-Hulud, while StepSecurity calls the SAP wave a third wave. SafeDep also files the June 2026 Miasma worm under Mini Shai-Hulud; Chain305 covers it in a separate teardown. Whatever the numbering, the pattern holds across all six: a credential stealer that runs inside the install, takes npm and GitHub tokens, and republishes itself under the victim’s name.

WaveFirst reportedHow it ran at installScale reported
Shai-Hulud14 to 15 September 2025 (GitHub, StepSecurity)A postinstall hook ran a minified bundle.js of about 3.6 MBOver 500 packages (CISA), including @ctrl/tinycolor
Shai-Hulud 2.0 (“The Second Coming”)Uploads 21 to 23 November, detected 24 November 2025 (Wiz, Aikido)A preinstall hook ran setup_bun.js, which installed the Bun runtime and ran bun_environment.js, over 10 MB and obfuscated (Unit 42)492 packages with 132 million monthly downloads (Aikido); over 25,000 GitHub repositories (Unit 42)
Mini Shai-Hulud, SAP CAP29 April 2026 (StepSecurity)A preinstall hook ran setup.mjs, which used Bun to run an obfuscated execution.jsFour versions of mbt and @cap-js packages (teardown)
Mini Shai-Hulud, TanStack11 May 2026 (TanStack, GHSA-g7cv-rxg3-hmpx)The prepare script of a git-hosted optional dependency84 versions of 42 @tanstack/* packages (teardown)
ChainDrop4 August 2026 (StepSecurity)A preinstall hook ran setup.mjs, which downloaded Bun 1.3.13 and ran an obfuscated Math_Symbol.js444 packages and 2,212 versions, starting with keyv@6.0.0, in under four hours
Tensorlake8 October 2026 (Socket)A preinstall hook, node lib/setup.mjs, with the same loader structure as ChainDroptensorlake@0.5.144, a package of about 12,000 weekly downloads

How did Shai-Hulud spread and republish packages?

Shai-Hulud spreads by turning each infected maintainer into a publisher: the payload finds an npm token on the machine, lists the other packages that token can publish, injects itself into them and publishes new versions.

Shai-Hulud got publish rights three ways: stolen npm tokens in the 2025 waves, a poisoned Actions cache and trusted publishing at TanStack, and a hijacked GitHub account releasing through its own workflow at ChainDrop, whose releases carried valid provenance.
Full answer

In the September 2025 wave, according to StepSecurity, the payload used the maintainer’s npm token to find up to 20 packages the user maintained and force-published patched versions carrying the malicious bundle. Aikido reports that Shai-Hulud 2.0 raised that limit to up to 100 packages per victim. Unit 42 notes that this let the worm spread without direct involvement from the actor. The 2026 waves added routes to publish rights that need no stolen token. In the TanStack wave the attacker reached TanStack’s own trusted-publishing binding through a poisoned GitHub Actions cache. In ChainDrop, StepSecurity reports, the attacker took over the maintainer’s GitHub account and released through the projects’ own workflows, so every version carried valid provenance.

The ChainDrop finding matters for anyone who relies on provenance. StepSecurity’s point is that provenance proves which commit was built and cannot prove that the commit was authorized. A worm that controls a maintainer’s GitHub account produces releases that look signed, attested and ordinary. The maintainer account takeover guide covers what trusted publishing does and does not prove.

What did Shai-Hulud steal?

Every Shai-Hulud wave steals the credentials a developer laptop or CI runner holds, starting with npm and GitHub tokens because those let the worm spread, then cloud keys and secret-manager contents. The first wave ran TruffleHog, a legitimate secret scanner, across the whole filesystem, sent the results to a webhook.site endpoint and committed them to a public repository named Shai-Hulud on the victim’s own GitHub account, according to StepSecurity and CISA. Shai-Hulud 2.0 also dumped AWS Secrets Manager, Google Secret Manager and Azure Key Vault. In a sample of about 20,000 exfiltration repositories, Wiz counted 775 GitHub access tokens, 373 AWS credentials, 300 GCP credentials and 115 Azure credentials. The 2026 waves added Kubernetes and Vault tokens, AI coding tool configuration and, on Linux GitHub Actions runners, secrets read from runner memory. Some waves also destroy data. Aikido reports that Shai-Hulud 2.0 wipes the home directory when it cannot authenticate to GitHub or npm.

Socket reports that the Tensorlake payload, built on the ChainDrop toolkit, runs a monitor that wipes the user’s home directory when the stolen GitHub token is revoked while the monitor is still running. That changes the order of the clean-up, covered below.

How do I check whether I was affected?

You check for Shai-Hulud in three places: your lockfiles for the affected package versions, your machines and runners for the payload files, and your GitHub accounts for the repositories, workflows and runners the worm creates. Start with the version lists. CISA advises reviewing package-lock.json and yarn.lock, including dependencies nested deep in the tree, and searching for cached copies in artifact repositories and dependency management tools. The GitHub Advisory Database and OSV carry MAL- entries per malicious version, Wiz publishes a CSV of the Shai-Hulud 2.0 versions, and each vendor write-up in the sources lists its own wave. Then look for the payload on disk: setup_bun.js and bun_environment.js for Shai-Hulud 2.0, bundle.js from a package that gained a postinstall hook for the first wave. StepSecurity notes that an install step downloading a JavaScript runtime is itself the signal worth investigating, since Bun comes from github.com and passes reputation checks.

# Which installed version of a package from an advisory list do you have?
npm ls --all <package-name>

# Payload files and the first wave's workflow, anywhere under your home directory
find ~ -name setup_bun.js -o -name bun_environment.js -o -name shai-hulud-workflow.yml 2>/dev/null

# Exfiltration repositories on a GitHub user or org you control
gh repo list <owner> --limit 1000 --json name,description | grep -i -e hulud -e "mini shai"

On GitHub, look for these traces, each reported by the source named:

  • Repositories named Shai-Hulud (first wave, StepSecurity), described “Sha1-Hulud: The Second Coming” (Shai-Hulud 2.0, Unit 42) or described “A Mini Shai-Hulud has Appeared” (SAP wave, StepSecurity).
  • Workflows and branches: .github/workflows/shai-hulud-workflow.yml on a shai-hulud branch (first wave, StepSecurity); .github/workflows/discussion.yaml and a self-hosted runner named SHA1HULUD (Shai-Hulud 2.0, Wiz).
  • Editor and AI tool hooks: .claude/settings.json SessionStart hooks and .vscode/tasks.json tasks that run setup.mjs, committed as “chore: update dependencies” (SAP wave, StepSecurity and Snyk, in the SAP CAP teardown).
  • Releases you did not make: new npm versions published under your account or organization (Wiz).

What should I do now if I was hit?

If an affected version was installed on a laptop or CI runner, treat that host as compromised and rotate every credential it could reach, but remove the worm’s persistence before you revoke anything. StepSecurity and Socket both warn that the 2026 ChainDrop toolkit installs a gh-token-monitor that reacts when the stolen GitHub token is revoked, and Socket reports that in the Tensorlake case the reaction is wiping the home directory. Revoking first, on a host where the monitor still runs, can turn a credential theft into data loss. CISA’s guidance for the first wave was to rotate all developer credentials immediately, and that still holds once the host is contained. The steps below follow the order the sources give: contain the host, remove persistence, rotate from a clean machine, check the cloud logs, rebuild from known-good versions, and check whether the worm published anything under your name.

  1. Isolate the host. Take the laptop or runner off the network, as Socket advises for Tensorlake. For a CI runner, stop the runner and its pipelines.
  2. Remove persistence first. Stop and delete gh-token-monitor, the .claude/ and .vscode/ hooks, the shai-hulud-workflow.yml and discussion.yaml workflows, any shai-hulud branches and any self-hosted runner you did not register.
  3. Rotate from a different, clean computer. npm tokens and GitHub tokens first, because they let the worm spread, then SSH keys, cloud credentials and CI secrets.
  4. Read the cloud audit logs. StepSecurity advises reviewing AWS CloudTrail and GCP audit logs for secret access after the install time.
  5. Rebuild from known-good versions. Run npm cache clean --force, delete node_modules, pin dependencies to versions published before the wave, and reinstall with npm ci --ignore-scripts, as Wiz and StepSecurity advise.
  6. Check what was published as you. Deprecate or remove any npm version you did not release, and tell your downstream users.

How do I keep the next Shai-Hulud wave out?

Every Shai-Hulud wave so far needed the same two things: a malicious version only hours old, and an install that ran its hook. Breaking either one stops the wave on that machine. On the install side, ignore-scripts=true in CI stops the preinstall and postinstall hooks five of the six waves used, and Snyk notes --ignore-scripts blocks the SAP wave’s delivery. A release-age hold, through npm’s min-release-age setting or a proxy, keeps a brand-new version away until the malware feeds catch up: in production Chainsaw data, the feed listed the TanStack versions 4.2 to 5.2 hours after publish, ChainDrop’s 0.5 to 7.4 hours after and Tensorlake’s 1.7 hours after. npm ci from a reviewed lockfile stops a build from picking up a version published after the review. On the publishing side, npm permanently revoked classic tokens on 9 December 2025, caps write tokens at 90 days and issues two-hour session tokens for local publishing.

The settings, with the npm documentation behind each, are in how to block malicious npm packages. Four more habits close the routes the 2026 waves used:

  1. Block git-URL dependencies in production installs unless you have listed them. The TanStack wave ran from one.
  2. Restrict trusted publishing to one branch and one workflow, with a manual approval gate on releases. The SAP and ChainDrop waves used release workflows that published from attacker commits.
  3. Require phishing-resistant MFA on GitHub and npm accounts, as CISA advises; GitHub’s plan moves npm from TOTP to FIDO-based 2FA.
  4. Allowlist egress from CI runners. StepSecurity recommends it after ChainDrop, whose loader fetched Bun from github.com.

How does install-path refusal apply to Shai-Hulud?

Install-path refusal means the package proxy decides on the install request itself, before the tarball reaches the laptop or runner, so the worm’s install hook never gets a chance to run.

The Shai-Hulud worm loop: an infected version is published, a developer runs npm install, the install hook steals tokens and the worm publishes more infected versions. Chainsaw refuses the infected version at install, so the hook never runs, no token is stolen and nothing is republished.
Full answer

That timing is the whole point against Shai-Hulud: every wave steals credentials during npm install, so a tool that decides after the install decides too late. Chainsaw, the supply chain firewall from Chain305, applies three layers on that request. The release hold keeps any version younger than 48 hours away by default, and 96 hours when a version first gains an install script, grows more than 20 times, or scores a warning. A byte check on first download reads the install scripts, and a default rule refuses scripts that fetch remote URLs. The malware feed makes each refusal permanent once a version is listed. An install that asks for the newest version during the hold resolves to the previous release instead. Install script attacks explains each package manager’s hooks in full.

Would Chainsaw have stopped Shai-Hulud?

For the six Shai-Hulud-family attacks in our 2026 test set, Chainsaw refused every malicious version by default, for installs that went through its proxy, but only two of them entirely on the bytes on day 0. The other four relied, fully or in part, on the release hold lasting until the malware feed listed the versions. The evidence is our test of 58 public 2026 attacks against production Chainsaw (v0.22.127) on 25 October 2026, which lists every row, including the 16 attacks Chainsaw does not stop. All six rows are graded FULL there, meaning refused by default for every malicious version. “Day 0” means refused on first download before any feed listed the version, rather than held back until the feed caught up. The table links each row of that report. The TanStack teardown walks through one of these results in detail, from the 96-hour hold to the feed listing that made the refusal permanent.

Attack (report row)Day 0 by defaultWhat refused it
SAP CAP / mbt, Mini Shai-Hulud (#27)YesThe default rule on install scripts that fetch remote URLs, through the obfuscated second stage
lightning, intercom-client, intercom-php (#28)PartlyThe npm and Packagist versions on first download; the PyPI versions by hold, then feed (listed about 17 hours after)
TanStack, Mini Shai-Hulud (#31)NoHold, then feed (listed 4.2 to 5.2 hours after publish)
Miasma, Red Hat wave (#38)YesThe default rule on install scripts that fetch remote URLs
ChainDrop (#51)NoHold, then feed (listed 0.5 to 7.4 hours after publish)
Tensorlake (#58)NoHold, then feed (listed 1.7 hours after publish)

What Chainsaw did not do, or did not prove:

  • The 2025 waves were not tested. The test set is attacks from 2026, so this page makes no claim for Shai-Hulud or Shai-Hulud 2.0.
  • Day 0 is the exception. Only #27, #38 and the npm and Packagist parts of #28 were refused on their bytes. For ChainDrop and Tensorlake the real payload bytes were not kept, so the report makes no day-0 claim. The SAP refusal rests on the obfuscation of the second stage; a readable one would fall back to the hold.
  • The hold works only if the feed is faster. In two other 2026 npm worms, CanisterWorm and IronWorm, some versions were listed after the 96-hour extension and were served; both rows are PARTIAL.
  • The git-dependency rule is off by default. It would have refused TanStack on day 0, but some teams use git URLs legitimately.
  • Installs that bypass the proxy are not protected. A laptop or runner pointed straight at registry.npmjs.org gets the worm, so Chainsaw also gates CI, pins laptops through MDM and blocks direct registry traffic at the network.
  • Chainsaw guards what you install, not what you publish. A maintainer machine infected outside the proxy can still leak your npm token.

Sources

Each fact on this page links its source or names it in the sentence, and the list below is the full set: the CISA alert, GitHub’s own posts on npm, vendor research on each wave, and Chain305’s teardowns and 2026 attack test.

The next wave will be hours old

See which installs Chainsaw would refuse, before you enforce

Start a free org in monitor mode and route installs through the proxy. Nothing is blocked until you switch a rule to enforce.