Skip to content
Threat ResearchCVE-2026-45321

npm worms: from Shai-Hulud to Hades, and the controls that stop them

Self-replicating npm worms steal developer and CI tokens at install time and use them to republish through packages you trust. Here is the wave timeline and the controls that actually cut install-time risk.

Shadow Labs · Offensive Research Team

7 min read

Key takeaways

TL;DR
  1. 01

    A Shai-Hulud-class worm runs when you install a package: its install script steals developer and CI tokens, then uses them to republish itself through other packages the victim can publish.

  2. 02

    The campaign ran in waves from September 2025 into mid-2026, and the worm's source was open-sourced under an MIT license in May 2026, which makes attribution of later copies unreliable.

  3. 03

    CVE-2026-45321 (TanStack) is the one in CISA's KEV catalog, flagged for known ransomware use. A valid provenance attestation did not make it safe: the attacker abused the legitimate publishing pipeline.

  4. 04

    The controls that work are unglamorous: block install scripts by default, pin and quarantine versions, publish through OIDC trusted publishing, and lock down CI egress and tokens.

When a package install runs the attacker's code

Most developers think of a dependency as code that runs when their app runs. An npm package can also run code the moment it is installed, through lifecycle scripts such as preinstall and postinstall. A self-replicating worm abuses exactly that: its install script harvests whatever credentials are on the machine, developer npm and GitHub tokens, cloud keys, CI secrets, and then uses those credentials to publish a poisoned version of every other package the victim is allowed to publish. Each new victim becomes a new publisher. That is what makes it a worm rather than a one-off compromise.

A dependency does not have to wait for your app to run. It can run the attacker's code the moment you install it.

The waves

[Confirmed] The campaign has run in waves for more than a year. Dates and counts below are from each wave's primary source.

  1. GlobalSupply chain

    Shai-Hulud: the first self-replicating npm worm

    CISA warned that a self-propagating worm had compromised "over 500 packages" to steal GitHub tokens and cloud keys and republish itself.

    Why it matters [Our assessment]

    a developer laptop and a CI runner are credential stores. After any exposure, rotate developer and CI credentials and enforce phishing-resistant MFA on npm and GitHub, as CISA advised.

    Source
  2. GlobalSupply chain

    Sha1-Hulud, "the second coming"

    A larger resurgence hit around 24 November 2025. Tenable counted "at least 800 compromised packages"; parallel analysis reported thousands of malicious repositories created with stolen tokens.

    Why it matters [Our assessment]

    the same control gaps as the first wave, at larger scale. Developers and CI accounts that reused the first wave's unrotated tokens were the ones re-hit.

  3. GlobalSupply chain

    TanStack: valid provenance, poisoned packages (CVE-2026-45321)

    Malicious versions of TanStack npm packages were published: "84 malicious versions across 42 @tanstack/* packages", tied by Tenable to the "Mini Shai-Hulud" wave.

    Why it matters [Our assessment]

    a valid provenance attestation did not mean safe code. The attacker abused the project's legitimate OIDC publishing pipeline, so provenance verified the pipeline, not the content.

    Source
  4. GlobalSupply chain

    The worm's source is open-sourced under MIT

    Researchers reported the worm's source code published to GitHub under an MIT license, which lets anyone fork and rerun it.

    Why it matters [Our assessment]

    once the code is public, "which group did this" stops being answerable. Defend against the technique, not a named actor.

  5. GlobalSupply chain

    Miasma: preinstall persistence through a Red Hat npm scope

    Microsoft documented a credential-stealing wave it calls Miasma, which abused the @redhat-cloud-services scope: "32 maliciously modified packages across more than 90 versions", with a dropper run from an npm preinstall hook.

    Why it matters [Our assessment]

    preinstall and postinstall hooks run before your code ever does. Installing with scripts disabled would have stopped the dropper.

[Reported] Vendors have tracked further branches, including a "Hades" wave in May 2026 and a PyPI variant that tried to evade AI code scanners (Zscaler, 12 June 2026), and a "Mini Shai-Hulud" strand active since late April 2026 across npm and PyPI (Tenable, 21 May 2026). The branches matter less than the shared mechanism.

TanStack: provenance is not the same as trust

[Confirmed] CVE-2026-45321 is the entry from this campaign in CISA's KEV catalog, added on 27 May 2026 and flagged for known ransomware use. It is worth dwelling on because it breaks a comforting assumption. TanStack publishes through a legitimate OIDC "trusted publishing" pipeline, and the malicious versions carried valid provenance. The attacker did not forge provenance; they abused the pipeline that produces it, through a pull_request_target "pwn request" and Actions cache poisoning. Provenance attested that the packages came from TanStack's real pipeline. It said nothing about whether the content was safe. That is the same CI weakness we cover in auditing your own GitHub Actions.

Controls that cut install-time risk

Mitigation

For developer machines and CI

5 items
  • Block install scripts by default. Install with npm install --ignore-scripts, or set ignore-scripts=true in .npmrc, and allow scripts only for the specific packages that genuinely need them. This alone stops the preinstall and postinstall droppers every wave above relied on.

  • Pin and quarantine versions. Commit a lockfile, and do not auto-adopt brand-new releases. A short cooldown before a new version is allowed into builds means a malicious version is often pulled before you ever install it.

  • Publish through OIDC trusted publishing, not long-lived npm tokens, so there is no standing token on a laptop or runner to steal (npm docs). Keep provenance on, but treat it as "this came from the expected pipeline", not "this is safe".

  • Lock down CI. Least-privilege tokens, restricted outbound network access from runners, and ephemeral runners, so a malicious install script cannot reach the internet or your cloud freely.

  • Harden the accounts. Phishing-resistant MFA on npm and GitHub, as CISA advised; GitHub itself moved to shorten token lifetimes and disable token-based publishing by default after the first wave (GitHub blog, 22 September 2025).

If a dependency you use was hit

Response

  1. 01Scope it

    Identify which projects and CI pipelines installed an affected package version, and in what window, from your lockfiles and build logs.

  2. 02Rotate what the install could see

    Developer npm and GitHub tokens, cloud keys, and any CI secret reachable from the build. Rotate, do not just revoke sessions.

  3. 03Re-pin to a known-good version

    Move to a release published before the compromise window, and turn on --ignore-scripts if it was not already.

  4. 04Hunt for use of the stolen tokens

    Review GitHub, npm and cloud audit logs for publishing or access from unexpected places after the exposure.

What we don't know

  • The true number of downstream victims. Counts are per-wave and per-vendor, and the open-sourcing of the worm means later copies are hard to attribute or total.
  • Whether a given organization's exposure led to real token theft. The rotation-and-hunt steps above answer that for your own estate.

If you want help reviewing how your pipelines handle dependencies, our secure code review and cloud penetration testing teams do this work. Every control above you can apply yourself.

Sources

9 sourcescisa.gov+7
  1. 01cisa.gov
  2. 02github.blog
  3. 03

    Tenable, FAQ about Sha1-Hulud 2.0, 24 November 2025, and Mini Shai-Hulud FAQ, 21 May 2026.

    tenable.com
  4. 04

    TanStack, GitHub Security Advisory GHSA-g7cv-rxg3-hmpx (CVE-2026-45321), 11 May 2026.

    github.com
  5. 05

    CISA, Known Exploited Vulnerabilities catalog, catalog version 2026.10.21, checked 22 October 2026.

    cisa.gov
  6. 06zscaler.com
  7. 07microsoft.com
  8. 08docs.npmjs.com
  9. 09

    MITRE ATT&CK: T1195.001, T1195.002.

    attack.mitre.org

Tags

  • #supply-chain
  • #npm
  • #worm
  • #shai-hulud
  • #devsecops
  • #kev

If you want a second pair of hands

Curious what our deliverables look like? Read a sample report.

Written by

Shadow Labs · Offensive Research Team

Shadow Labs is the research team behind Shadow Corp's penetration tests and incident response. We track the threats that reach Latin America and write guides that defenders can act on, with sources you can check.

Drafted with AI assistance and checked line by line against the primary sources cited here by a Shadow Labs editor before it went out, on October 22, 2026. The cover image was generated with AI. Read our editorial standards.

Spotted an error? Write to contact@sh4dowcorp.com and we will correct it publicly on this page.

From research to testing

Find out if this affects you.

Tell us what you want tested against this threat. We agree on scope on a short call. After the call, you get a written proposal within one business day.

Shadow Digest · Free preview

The blog explains. The Digest keeps you current.

This blog is public and evergreen: guides you can come back to. The Shadow Digest is our curated briefing for security teams. Every other Monday, Shadow Labs tells you what happened, whether it reaches Latin America, and what to do this week. Free during the preview; a paid plan for teams is coming.

By subscribing, you agree to receive the Shadow Digest by email (every other Monday, plus rare flash alerts). We email a confirmation link first. We store your address with our providers in the United States, and every email has a one-click unsubscribe link. See our privacy policy.