schliewe.systems
← cd ../blog
#malware#supply-chain#npm#detection

Shai-Hulud: ten waves, one shape

Ten Shai-Hulud waves, September 2025 to October 2026. The payload changed. The loop did not: install, sweep, GitHub, republish.

$ whoami Jack Schliewe · 17 November 2026 · 7 min read

After defanging a copy, I read the public reports: Wiz, Unit 42, Datadog, StepSecurity, Socket, Sonatype, OX, JFrog, Endor Labs, Sygnia, and CISA. It is at least ten waves over thirteen months. Each rewrote the payload. Five other attacks used the same moves. Structure only: what runs, what it reads, where the data goes. No payload code. Two tools at the end check a package or a repo for that shape.

Ten waves

WaveFirst seenHow it got inWhat ran it
Shai-HuludSep 2025stolen npm tokenspostinstall
Sha1-Hulud: The Second ComingNov 2025stolen tokens, some mined from CI secretspreinstall, then Bun
Shai-Hulud 3.0Dec 2025one maintainer accountinstall hook
The Third Coming (Bitwarden CLI)Apr 2026a compromised release pathpreinstall plus a bin shim
Mini Shai-Hulud (SAP)Apr 2026the publish path for four SAP packagespreinstall
Mini Shai-Hulud (TanStack, then Nx Console)May 2026a poisoned CI cache, then a publish token taken from the runner's memorya git dependency's prepare hook
Here We Go Again (AntV)May 2026one maintainer accountpreinstall or a git dependency's prepare
Miasma (Red Hat, AsyncAPI)Jun 2026account takeoversbinding.gyp, import time, Python .pth files
ChainDrop and TensorlakeAug to Oct 2026maintainer accounts and the projects' own release workflowspreinstall
An MCP Registry offshootAug 2026a registry entry pointing at a poisoned repoopening the repo in an editor or agent

Sources disagree on some details: how the first wave got its tokens, exactly when the SAP wave began, and most of the package counts. Where they disagree, I left the detail out.

One shape

Strip the version-specific details and every wave runs the same loop:

a trojanized versionis publishedsomething routineruns itnpm install hooksa git dependency'spreparea native buildan agent or editoropens the repoa loader fetches Bunand starts thepayloadit sweeps forcredentialsand pushes them torepos in thevictim's own GitHubstolen tokensrepublish morepackagesand commit .claudeand .vscode hooks tomore repos

The trigger kept moving

Each wave used a different trigger:

  1. postinstall, the obvious one (September 2025).
  2. preinstall, which runs earlier and installs Bun, a runtime most projects never use (November 2025).
  3. A bin shim that runs when the package's command is called (April 2026).
  4. A git dependency pinned to a commit, whose own prepare hook does the work, so the trojanized package's package.json has no install script at all (May 2026).
  5. binding.gyp, which makes npm run a native build with no script in package.json, and Python .pth files, which run when Python starts (June 2026).
  6. No install at all: a Claude Code SessionStart hook in .claude/settings.json and a VS Code task set to run on folder open, committed into every repo the stolen GitHub token could reach (from April 2026 on). Opening the repo in either tool runs the worm.

From April 2026, opening the repo was enough. That is why defang-specimen.sh renames .claude and .vscode, not only package.json.

What other attacks share

Five other npm and JavaScript attacks from the same period, compared on the same structures: the Nx "s1ngularity" compromise (Aug 2025), the chalk and debug maintainer compromise (Sep 2025), GlassWorm in VS Code-compatible extensions (Oct 2025 on), SANDWORM_MODE (Feb 2026) and the axios compromise (Mar 2026).

StructureFamilies out of 6
A hijacked trusted publisher (account, token or CI identity)6
Code that runs on a routine developer action6
A sweep for developer and CI credentials5
An obfuscated payload whose size or shape breaks from the last version5
GitHub used for exfiltration, dead drops and spreading4
Self-propagation through publishing3
Agent or editor config as a way to run code or as loot3 to 4

The agent angle differs by family. Shai-Hulud uses agent hooks, which run commands without any AI involved. SANDWORM_MODE adds a rogue MCP server and hides instructions in its tool descriptions, which is real prompt injection. s1ngularity ran the victim's own AI coding CLIs to search the disk for secrets.

Catching it before it installs

The payload rotates every wave, so signatures on payload bytes keep going stale. What stays stable is the manifest diff between a clean version and an infected one. Every Shai-Hulud wave changed at least one of these:

This checks a live package for exactly that, against the version before it. It reads public npm metadata in your browser and installs nothing.

npm diff guard · compare a release with the one before it

Two limits. The TanStack wave had valid build provenance, because it stole the CI identity provenance vouches for. A new package has no previous version to diff. Several waves were flagged by scanners within hours of publishing.

Catching it in a repo

For the hooks committed into repos, the files themselves are the signal. These YARA-X rules match the structure the later waves left behind, not any payload bytes: an install hook that starts Bun or a loose loader script, a Claude Code SessionStart hook, a VS Code folder-open task, and a git dependency pinned to a commit. It runs VirusTotal's real engine, compiled to WebAssembly, in your browser.

yara-x · write a rule, scan a sample

A SessionStart hook isn't malicious by itself, plenty of teams use them, so treat a hit as "read this before opening the repo", not a verdict. The tell is a hook or task that showed up in a commit from an account or bot that doesn't normally touch those files.

If you're hit, order matters

Several 2026 waves installed a monitor that watches for the stolen token being revoked and wipes the home directory when it is. Sources disagree on whether the GitHub or the npm token is the trigger. Either way, the usual instinct, revoking every token immediately, can set it off. Find and remove the persistence first (a background service, a self-hosted runner registered on the machine, new hooks in .claude/ and .vscode/), then rotate everything the machine could reach.

Sources