Shai-Hulud: Anatomy of the npm Worm That Keeps Coming Back

How a self-replicating package turns one npm install into stolen tokens, public leak repositories, a rogue self-hosted runner and a hundred republished packages. The infection chain step by step, the dated history from September 2025 to August 2026, the numbers by source, and a checklist to find out whether you were hit.

On September 14, 2025, at 17:58:50 UTC, version 0.0.3 of a small npm package called rxnt-authentication was published. It contained a 3.6 MB file named bundle.js and one extra line in package.json. Two days later about two hundred packages carried the same file (Sysdig’s count), and within a week npm had removed more than 500. None of those versions was published by a human. The npm ecosystem had its first worm that spreads by itself: every machine that installed an infected package had its tokens stolen, and every stolen npm token was used to infect more packages.

The authors named the repositories where it dumped stolen secrets Shai-Hulud, after the sandworm in Dune. The name stuck, and so did the worm. A second, nastier version came back in November 2025, and by August 2026 security vendors were counting about a dozen waves and offshoots.

This post is a defensive analysis. It explains how the worm gets onto a machine and what it does there, at the level of detail the published analyses give, then covers the history, the numbers, the architecture, and how to check whether you were affected. It contains indicators of compromise and detection commands. It does not contain worm code.

One rule for the numbers: vendors measured different things on different days, so every figure below is attributed to its source and date. Where sources disagree, I say so instead of picking one.

The short version

  Wave 1, “Shai-Hulud” Wave 2, “Sha1-Hulud: The Second Coming”
Dates September 14 to 16, 2025 November 24, 2025, long tail into December
Hook postinstall preinstall
Files added to the package bundle.js (about 3.6 MB) setup_bun.js (loader) and bun_environment.js (payload, over 10 MB)
Runtime Node.js Bun, downloaded by the loader
Platforms Linux and macOS, skips Windows Linux, macOS and Windows
Secret scanner TruffleHog TruffleHog
Leak repository named Shai-Hulud, file data.json random 18-character name, description Sha1-Hulud: The Second Coming.
Packages republished per token up to 20 up to 100
Persistence workflow on a shai-hulud branch self-hosted runner named SHA1HULUD plus a backdoor workflow
Destructive behaviour none reported wipes the home directory when it finds no usable GitHub or npm token
Scale reported 500+ packages (GitHub, CISA) about 800 packages, 25,000+ repositories (Wiz, Datadog, ReversingLabs)

Sources for this table: StepSecurity, September 15, 2025, Aikido, November 24, 2025, Datadog Security Labs, November 25, 2025, Unit 42, updated November 26, 2025.

History and timeline

Timeline of the Shai-Hulud family from August 2025 to August 2026: the s1ngularity Nx compromise on August 26, 2025, the chalk and debug phishing on September 8, wave 1 on September 14 to 16, wave 2 The Second Coming on November 24, npm revoking classic tokens on December 9, then in 2026 The Third Coming on April 22, Mini Shai-Hulud hitting TanStack on May 11, the source code published on May 12, the AntV wave on May 19, Miasma on June 1 and ChainDrop on August 4. Spacing is not to scale.20252026Aug 26s1ngularityNx compromiseSep 8chalk / debugphishingSep 14-16WAVE 1Shai-HuludNov 24WAVE 2Second ComingDec 9npm revokesclassic tokensApr 22Third ComingBitwarden CLIMay 11Mini Shai-HuludTanStackMay 12source codepublishedMay 19AntV wave639 versionsJun 1MiasmacopycatsAug 4ChainDrop400+ packagesmain 2025 wavesprecursor or later variantregistry responsespacing not to scale
One year of Shai-Hulud: two precursors, the two 2025 waves, the token revocation, and the 2026 variants (dates from ReversingLabs, Aikido, GitHub, Unit 42, Microsoft and Zscaler)

s1ngularity / Nx, August 26, 2025. Attackers exploited a pull_request_target workflow in the Nx repository to steal an npm publishing token, then published Nx versions carrying a script called telemetry.js that ran at post-install on Linux and macOS. It searched the machine for secrets and pushed them to a public repository created in the victim’s own GitHub account, named after the pattern s1ngularity-repository. In a second phase, stolen GitHub tokens were used to flip thousands of private repositories to public. Wiz confirmed more than 2,000 unique leaked secrets in the first phase (Datadog Security Labs, “Learnings from recent npm supply chain compromises”).

This one matters because it is the direct ancestor. Wiz assessed that Shai-Hulud was “directly downstream” of s1ngularity: the first packages hit in September belonged to known s1ngularity victims whose tokens had not been rotated (Wiz, September 2025). The tradecraft is also the same: a lifecycle script, and the victim’s own GitHub account used as the exfiltration channel.

chalk / debug, September 8, 2025. A maintainer known as Qix received a fake two-factor reset email from support@npmjs[.]help. With his account, attackers published malicious versions of more than 18 packages, including debug, chalk and ansi-styles. The payload was a browser-side crypto stealer that swapped wallet addresses. The malicious versions were downloaded more than 2.5 million times and about 500 dollars were reported stolen (same Datadog article).

This incident is often listed next to Shai-Hulud because it happened a week earlier, but nothing published ties the two to the same actor, and the payload has nothing in common with the worm. What it shows is the other entry door: phishing a maintainer. Unit 42 wrote that the September worm “may originate” from a phishing campaign spoofing npm and asking developers to update their MFA options (Unit 42). So for wave 1 there are two published hypotheses for the first foothold, leftover s1ngularity tokens (Wiz, Datadog) and npm phishing (Unit 42), and they are not mutually exclusive.

Wave 1: September 14 to 16, 2025

  • September 14, 17:58:50 UTC. rxnt-authentication@0.0.3 is published. ReversingLabs considers its maintainer account, techsupportrxnt, to be patient zero (ReversingLabs). GitHub says it was notified of the attack the same day (GitHub, September 22, 2025).
  • September 15. ReversingLabs detects the worm. StepSecurity publishes an analysis after @ctrl/tinycolor, a package with more than 2 million weekly downloads, is found compromised along with about 40 others. Packages in the @crowdstrike scope are among the victims (Socket’s report, Wiz’s package list).
  • September 16. Sysdig counts approximately 200 infected packages. Aikido and Datadog date the wave to this day.
  • September 22 (US time). GitHub announces it has removed 500+ compromised packages and that npm now blocks uploads containing the malware’s indicators. In the same post it announces the end of long-lived tokens (details below).
  • September 23. CISA publishes the alert “Widespread Supply Chain Compromise Impacting npm Ecosystem”, stating that the worm compromised over 500 packages and asking organisations to review dependencies and rotate developer credentials (CISA).

npm changes its token model

GitHub’s September plan listed what would remain allowed for publishing: local publishing with mandatory 2FA, granular tokens with a seven-day lifetime, and trusted publishing. It also announced the deprecation of classic tokens and of TOTP as a second factor in favour of FIDO/WebAuthn.

The rollout, from the GitHub changelog:

  • November 5, 2025. Classic tokens can no longer be created. New granular tokens with write access enforce 2FA by default, and existing ones are capped at a 90-day lifetime (changelog).
  • December 9, 2025. All classic tokens are permanently revoked (the date first announced was November 19). npm login now returns a two-hour session token (changelog).

Aikido pointed out the timing of the second wave: it landed two weeks before the classic token deadline, while many maintainers had not yet migrated.

Wave 2: November 2025, “The Second Coming”

The second wave did not start with phishing. It started with CI.

  • November 18, 5:40 PM. A throwaway GitHub account opens and closes, within one minute, a pull request against PostHog’s main repository. A workflow triggered by pull_request_target checks out and runs code from that pull request, which sends a bot’s personal access token to the attacker. This pattern is known as a “Pwn Request” (PostHog post-mortem, November 26, 2025).
  • November 23, 15:28 to 15:45 UTC. The attacker tests the stolen token, pushes a detached commit that modifies a lint workflow to dump all GitHub secrets, runs it and deletes the run. They now hold PostHog’s npm publishing token.
  • November 24, 01:22 UTC. First leak repositories appear on GitHub according to GH Archive data (Wiz).
  • November 24, 03:16:26 UTC. Aikido detects the first infected packages: go-template and 36 AsyncAPI packages. PostHog packages follow at 04:11 UTC and Postman packages at 05:09 UTC. AsyncAPI later found a branch in its cli repository, created just before, that contained the payload.
  • November 24, 09:30 to 11:46 UTC. PostHog, then Postman, then npm (for AsyncAPI) unpublish the malicious versions. The rate of new leak repositories drops sharply. Datadog dates the last infected publication to 18:00 UTC.
  • November 25, 22:45 UTC. Wiz observes private repositories of one victim being published with the description Sha1-Hulud: The Continued Coming.
  • November 26, about 09:00 UTC. GitHub starts removing the leak repositories and revoking exposed tokens. At 16:00 UTC, Wiz starts seeing leaked AWS keys and GitHub tokens being abused, including to download private source code.
  • December 1. A new spike: more than 200 new repositories in about 12 hours (Wiz aftermath).

A note on dates: Wiz’s text says the trojanized packages were uploaded “between November 21-23”, while its own timeline and Aikido’s detections put the first malicious versions on November 24 around 03:00 UTC. I use the timestamped observations, and Wiz’s advice to roll back to builds from before November 21 remains the safe boundary.

Wiz’s conclusion on the entry point: “the initial access vector in this incident was abuse of pull_request_target via PWN request”. The actor behind wave 2 is not attributed. Wiz notes that it “may involve different actors” than wave 1.

After 2025: variants and copycats

The name is now a family. This table follows the timeline published by Zscaler ThreatLabz on August 11, 2026, cross-checked with Unit 42’s npm threat landscape page (updated July 15, 2026) and Microsoft’s posts.

Date Name What changed
Late December 2025 “Shai-Hulud 3.0” A smaller strain reported by Aikido, without the destructive fallback (reported by SiliconAngle, December 30, 2025; I could not read Aikido’s own post)
April 22, 2026 “The Third Coming” A malicious @bitwarden/cli@2026.4.0 was on npm from 5:57 PM to 7:30 PM EST. TeamPCP claimed it (Unit 42)
April 29, 2026 Mini Shai-Hulud Attributed to TeamPCP, aimed at the SAP developer ecosystem
May 11, 2026 Mini Shai-Hulud, TanStack Poisoned GitHub Actions cache, OIDC token extraction: 84 malicious versions across 42 @tanstack/* packages in six minutes (Unit 42). Microsoft counts 170+ npm packages, 2 PyPI packages, 404 malicious versions for the wave
May 12, 2026 Source release The worm’s source code is published on GitHub, then taken down. Copycats follow
May 19, 2026 AntV wave 639 malicious versions across 323 packages in one hour, 01:56 to 02:56 UTC (Socket, via BleepingComputer). GitHub invalidates 61,274 npm granular tokens with write access and 2FA bypass (Microsoft)
June 1, 2026 Miasma 32 @redhat-cloud-services packages, valid provenance, a unique payload per infection
June 3, 2026 Phantom Gyp Execution hidden in binding.gyp, which bypasses --ignore-scripts. 57 packages, 280+ versions in two hours
June 2026 Hades PyPI packages infected through .pth startup hooks (June 7 to 9), then npm packages of the Leo Platform (June 24)
July 14, 2026 Miasma-Train-P1 Five @asyncapi packages, execution moved from install time to import time
August 4, 2026 ChainDrop, “Here We Go Again” keyv ecosystem, more than 400 packages, command and control resolved through an Ethereum contract, persistence in .claude/ and .vscode/ files

As of December 2, 2026, I found no vendor report of a new named wave after ChainDrop. That is an absence of reports in my searches, not proof of calm.

How it installs and how it acts

Everything rests on one npm feature. A package can declare lifecycle scripts in its package.json, and until npm 12 the client ran the preinstall, install and postinstall scripts of every dependency, direct or transitive, with the privileges of the user who typed npm install. A package manager that runs code from thousands of strangers at install time is a remote code execution service with good manners. The worm only needed to add one line.

Wave 1, step by step

1. Entry. The attacker publishes a new version of a legitimate package with a stolen maintainer token. The version contains bundle.js and a postinstall entry that runs it with Node (ReversingLabs).

2. Execution. On npm install, after the package is unpacked, bundle.js runs. It is a Webpack bundle of about 3.6 MB, minified. It checks the platform and continues only on Linux and macOS (StepSecurity).

3. Harvest. StepSecurity describes separate modules:

  • a reconnaissance module that profiles the system and dumps all of process.env, which on a CI runner contains GITHUB_TOKEN, NPM_TOKEN, AWS_ACCESS_KEY_ID and friends;
  • an AWS module that validates credentials through STS and enumerates Secrets Manager;
  • a GCP module that lists Secret Manager;
  • a filesystem module that runs TruffleHog, a legitimate open-source secret scanner, against the filesystem;
  • queries to the cloud instance metadata services (IMDS) for temporary credentials when the code runs on a cloud VM (Wiz).

4. Exfiltration, three ways.

  • With a GitHub token, it creates a public repository named Shai-Hulud in the victim’s account and commits the loot as data.json, double Base64 encoded.
  • It drops a script at /tmp/processor.sh that, for every repository the token can write to, creates a branch named shai-hulud and commits .github/workflows/shai-hulud-workflow.yml. The workflow triggers on push, serialises the repository’s Actions secrets with toJSON(secrets) and posts them to webhook[.]site/bb8ca5f6-4175-45d2-b042-fc9ebb8170b7. Wiz observed that the free webhook was deactivated after 100 callbacks, so this channel died early, but the secrets were also echoed, double Base64 encoded, into the workflow logs.
  • It drops /tmp/migrate-repos.sh, which clones the private repositories of the organisations the victim belongs to and republishes them as public repositories under the victim’s user account, with the suffix -migration and the description Shai-Hulud Migration. Wiz notes the tell: a CreateEvent immediately followed by a PublicEvent.

Unit 42 assessed with moderate confidence that an LLM helped write the bash script, because of its comments and emojis.

5. Propagation. With an npm token (from ~/.npmrc or the environment), a function that analysts found under the name NpmModule.updatePackage validates the token, asks the registry for up to 20 packages maintained by that user, and for each one bumps the patch version, adds bundle.js and the postinstall line, and publishes. Each of those packages is now a new patient zero for everyone who installs it.

Wave 2, step by step

Infection chain of Shai-Hulud 2.0. Stage 0: npm install resolves an infected version and npm runs its preinstall script. Stage 1: node setup_bun.js finds or installs the Bun runtime. Stage 2: bun runs bun_environment.js, which checks whether it is in CI (stay attached) or on a developer machine (detach to background). It then harvests secrets, exfiltrates them to a public GitHub repository, registers a self-hosted runner named SHA1HULUD, and republishes up to 100 of the maintainer packages. If no GitHub token and no npm token can be found, it wipes the home directory.STAGE 0 · the package managernothing unusual on screennpm installresolves an infected patch versionpreinstall scriptruns before the tree is installedSTAGE 1 · loadersmall, readable, looks like a helpernode setup_bun.jsis Bun on the PATH?Bun runtimeinstalled from bun.sh if missingSTAGE 2 · payloadone obfuscated file, more than 10 MBbun bun_environment.jsCI variables present?CI runnerruns attached, job waits for itdeveloper machinedetaches, install returns cleanyesno1 · harvestenv, .npmrc, gh config, TruffleHog on $HOMEAWS / Azure / GCP SDKs and metadataActions secrets via a temporary workflow2 · exfiltratepublic repo, random 18-char namedescription "Sha1-Hulud: The Second Coming."no token? borrow one from an earlier victim3 · persistself-hosted runner "SHA1HULUD"installed in $HOME/.dev-envdiscussion.yaml backdoor workflow4 · propagatenpm token valid? list maintainer packagesadd loader + payload, bump patch versionpublish, up to 100 packagesfallback · wipe the home directoryonly when no GitHub token (local or borrowed)and no npm token can be found
Shai-Hulud 2.0 infection chain: lifecycle hook, loader, Bun payload, then harvest, exfiltration, persistence and propagation (after Wiz, Datadog, GitLab and StepSecurity)

1. Entry. For the first victims, stolen CI secrets (see the PostHog timeline above). For everyone after that, the worm itself.

2. preinstall instead of postinstall. The infected package.json declares a preinstall script that runs node setup_bun.js. The difference is larger than it looks. preinstall runs before the dependency tree is installed, so the payload runs even if the installation fails later, and before any tool that inspects the installed tree. Wiz found that 99% of the infections it could fingerprint came from this exact event.

3. Stage one, the loader. setup_bun.js is small and looks harmless. It checks whether the Bun JavaScript runtime is on the PATH, and if not, installs it with the official installer from bun.sh. Then it starts stage two with Bun. Datadog’s reading is that using a second runtime is a way to step outside the Node.js process monitoring that many security tools rely on.

4. Stage two, the payload. bun_environment.js is a single obfuscated file of more than 10 MB (StepSecurity, GitLab, Unit 42). Its first decision is where it runs. It checks five environment variables: BUILDKITE, PROJECT_ID, GITHUB_ACTIONS, CODEBUILD_BUILD_NUMBER and CIRCLE_SHA1 (Wiz).

  • In CI, it runs synchronously, so that the runner stays alive until it is done.
  • On a developer machine, it forks itself into a detached background process and lets npm install return normally. The developer sees a clean install.

5. Harvest. The same sources as wave 1, with more depth:

  • GitHub tokens (ghp_, gho_) from the environment and the GitHub CLI configuration, npm tokens from .npmrc and the environment (GitLab);
  • the whole environment, written to environment.json;
  • a TruffleHog binary, downloaded and run over the home directory, results in truffleSecrets.json. The worm did not ask TruffleHog to verify its findings, which is why the leak contains a huge amount of noise (see the statistics);
  • AWS, Azure and GCP, through bundled official SDKs: local credential files, IMDS, then AWS Secrets Manager, Azure Key Vault and Google Secret Manager, destined for cloud.json. Wiz later observed that cloud.json was never actually populated: the three providers are queried in one block without error handling, so a failure in any of them discards everything;
  • GitHub Actions secrets. Where the token has the workflow scope, the worm pushes .github/workflows/formatter_123456789.yml to a new branch named add-linter-workflow-<timestamp>. That workflow uploads the repository’s secrets as a build artifact. The worm downloads the artifact, stores it as actionsSecrets.json, then deletes the workflow and the branch to hide the operation.

6. Exfiltration to GitHub, with a cross-victim fallback. The worm creates a public repository with a random 18-character name (pattern [0-9a-z]{18}, Datadog), the description Sha1-Hulud: The Second Coming. and discussions enabled, and commits the JSON files: contents.json (system information and the GitHub token used), environment.json, truffleSecrets.json, actionsSecrets.json, cloud.json.

If the machine has no usable GitHub token, the worm searches GitHub for repositories with that exact description, downloads the contents.json of earlier victims, extracts their tokens, and uses the first one that still works. Your secrets can therefore be sitting in a repository that belongs to a stranger, and a stranger’s secrets can be in yours. Wiz confirmed this happening repeatedly on November 24.

7. A runner as a backdoor. If the token allows it, the worm downloads the official GitHub Actions runner (version 2.330.0 on Linux x64), installs it in $HOME/.dev-env/, and registers the infected machine as a self-hosted runner named SHA1HULUD on the leak repository. It then commits .github/workflows/discussion.yaml, a workflow named “Discussion Create” that runs on that self-hosted runner whenever a discussion is opened and passes the discussion body to a shell without sanitising it. Anyone who can open a discussion on that public repository can run commands on the infected machine. Wiz reproduced the technique in a lab and, as of its report, had not seen it used in the wild.

8. Privilege escalation on CI. On Linux runners where Docker is available, the worm tries to start a privileged container with the host root filesystem mounted, in order to write a sudoers file for the runner user and obtain passwordless root (Wiz). GitHub’s summary describes this as privilege escalation aimed at certain build agents.

9. Propagation. The npm token is validated with /-/whoami, the maintainer’s packages are listed through the registry search API, and up to 100 packages are processed: download the current tarball, set the preinstall script, bump the patch version, add the two files, repack, publish (Datadog). The worm reads its own file to write bun_environment.js into the next victim. Aikido noticed that this self-copy sometimes failed, which produced packages containing the loader without the payload and limited the spread.

10. The destructive fallback. If the worm finds no valid GitHub token, local or borrowed, and no npm token, it has no way to exfiltrate and no way to spread. In that case it tries to destroy the user’s data: on Linux and macOS it overwrites and deletes every writable file owned by the user under $HOME with shred, on Windows it deletes the user profile and wipes free space with cipher /W (Datadog). GitLab called it a “dead man’s switch”. Microsoft Defender customers saw it as the alert “Suspicious usage of the shred command on hidden files”.

What changed between the two waves

The propagation loop. An infected version sits on the npm registry. A developer machine or CI runner installs it. The lifecycle script runs the payload with the user privileges. The payload harvests npm, GitHub and cloud credentials. With the npm token it republishes the other packages of the same maintainer, 20 at most in wave 1 and 100 at most in wave 2, which puts new infected versions on the registry. On the side, secrets are published to public GitHub repositories, and in wave 1 private repositories are made public.THE LOOP · no human needed after the first publishinfected version on npmlegitimate name, patch bumpnpm installdev machine or CI runnerlifecycle scriptpayload runs as the usercredentials harvestednpm, GitHub, cloud, CI secretsrepublishmaintainer packages: 20 / 100npm token validwhoami, then list packagesside effectssecrets in publicGitHub repositoriesprivate repos exposedwave 1: postinstall, up to 20 packages per token · wave 2: preinstall, up to 100
The propagation loop: each stolen npm token turns the victim into a publisher of new infected versions

GitHub’s own summary, published on December 23, 2025, is a good one: wave 2 added cross-victim credential exposure, command and control through self-hosted runner registration, a wider range of harvested secrets, destructive functionality, CI-aware behaviour with privilege escalation, and a multi-stage payload that was harder to detect (GitHub).

Three design choices explain why wave 2 was so much larger.

  1. preinstall plus CI awareness. Wiz’s fingerprinting of the leaked environment.json files suggests that only 23% of infections were on developer machines. The rest were CI runners, mostly Linux containers on GitHub Actions, with Jenkins, GitLab CI and AWS CodeBuild far behind.
  2. A higher propagation cap, 100 packages per token instead of 20.
  3. No fixed infrastructure. Wave 1 depended on one webhook URL that died after 100 calls. Wave 2 uses only GitHub and npm. There is no attacker server to block or take down, and the description string acts as the rendezvous point.

Architecture

Exfiltration data flow in Shai-Hulud 2.0. Sources on the infected machine: process environment, credential files, a TruffleHog scan of the home directory, cloud SDKs and metadata services, and GitHub Actions secrets dumped by a temporary workflow. They are written to environment.json, contents.json, truffleSecrets.json, cloud.json (empty in practice because of a bug) and actionsSecrets.json, and committed to a public GitHub repository with a random name and the description Sha1-Hulud: The Second Coming, in the account of victim A. The infected machine is also registered on that repository as a self-hosted runner named SHA1HULUD. A second victim B without a GitHub token searches GitHub for that description, takes a token from victim A contents.json, and its data is published under victim A account. The attacker and anyone else read the public repositories through GitHub search.VICTIM A · infected machine or CI jobsourcesfiles writtenprocess.envall variablesenvironment.json.npmrc, gh, cloud configtokens and keys on diskcontents.jsonhost info + GitHub tokenTruffleHog on $HOMEunverified matchestruffleSecrets.jsoncloud SDKs + IMDSsecret managerscloud.jsonempty in practice (bug)Actions secretstemporary workflowactionsSecrets.jsonGITHUB · account of Apublic repositoryname: 18 random chars"Sha1-Hulud:The Second Coming."runner SHA1HULUDA's machine, self-hosteddiscussion.yamlsecond repositoryB's data, in A'saccountVICTIM B · infected, but no GitHub token on the machine1 · search GitHubfor the descriptionstring of leak repos2 · borrow A's tokenread A's contents.jsonkeep the first valid one3 · publishunder Aattacker, and anyonereads via GitHub searchNo attacker server is involved: GitHub is the storage,the description string is the index.
Exfiltration data flow in wave 2: five sources, five JSON files, one public repository, and the cross-victim fallback (after Wiz, Datadog and GitLab)

Seen as a system, the worm has five parts.

  • A carrier: any legitimate package, republished with one more patch version. Nothing changes in the source repository. The malicious code exists only in the registry tarball, which is why reviewing GitHub history shows nothing.
  • A trigger: one lifecycle script line.
  • A harvester: environment, files, a borrowed secret scanner, cloud SDKs, and the CI platform’s own secret store.
  • A public dead drop: GitHub repositories created in victims’ accounts. The attacker never has to receive anything. They read public repositories like everyone else, and GitHub’s search is their index.
  • A replicator: the registry’s own publish API, driven with the victim’s identity.

No component is an exploit in the classical sense. Every step uses a feature as designed, with credentials that are valid. That is why the defences that work are not patches but changes to defaults: who can publish, with what kind of credential, and whether install scripts run at all.

The numbers, by source

What the sources measured: packages and versions on npm, repositories and accounts on GitHub, and files inside the leak repositories. Nobody measured “servers”. The closest thing to a machine count is Wiz’s corpus of environment.json files, each of which corresponds to one execution of the worm on one machine or CI job.

Precursors and wave 1

Metric Figure Source and date
s1ngularity, unique secrets leaked in the first phase 2,000+ Wiz, reported by Datadog
chalk/debug, packages with malicious versions 18+ Datadog
chalk/debug, downloads of malicious versions 2.5 million+ Datadog
Wave 1, infected packages about 200 Sysdig, September 16, 2025
Wave 1, compromised packages removed by npm 500+ GitHub, September 22, 2025; CISA, September 23
Wave 1, GitHub users with secrets in a Shai-Hulud repository 36 (initial observation) Wiz, September 2025
Wave 1, repositories with a shai-hulud branch 64 more Wiz, September 2025
Wave 1, GitHub search results for “Shai-Hulud Migration” close to 700 ReversingLabs, September 2025

The wave 1 repository counts are small and were taken early. GitHub deleted repositories quickly, so no source gives a reliable final total.

Wave 2

Metric Figure Source and date
Compromised packages 492, with 132 million monthly downloads Aikido, November 24, 2025
Compromised packages about 700, then “nearly 800” Wiz, November 24 to 27
Compromised packages 795, downloaded 100 million+ times ReversingLabs
Unique packages and versions 796 packages, 1,092 versions, 20 million+ weekly downloads Datadog, deduplicated across seven vendors, December 4
Leak repositories 21,000+ within five hours StepSecurity
Leak repositories 26,300 Aikido, November 24
Leak repositories 27,000+ ReversingLabs
Leak repositories 25,000+, later a corpus of 30,000+ Wiz
Leak repositories visible in GH Archive 14,000+ Datadog (GH Archive loses events, so this is a floor)
Peak creation rate about 1,000 new repositories every 30 minutes Wiz
GitHub accounts hosting leak repositories about 350, then about 500 Unit 42 quoting Wiz; Wiz’s updated post
GitHub users and organisations with exfiltrated data 500+ users, 150+ organisations (lower bound) Datadog
environment.json files retrieved about 24,000, half of them unique Wiz aftermath
Share of infections on developer machines 23% Wiz aftermath
Unique raw secrets in TruffleHog output up to 400,000, about 2.5% verified Wiz aftermath
Verified credentials in an early sample 775 GitHub tokens, 373 AWS, 300 GCP, 115 Azure Wiz, first publication
Leaked npm tokens still valid over 60% Wiz, as of December 1, 2025
Share of infections from two packages over 60% (@postman/tunnel-agent@0.6.7, @asyncapi/specs@6.8.3) Wiz aftermath

Notable affected publishers in wave 2: Zapier, ENS Domains, AsyncAPI, PostHog, Postman and Browserbase (Aikido). PostHog lists posthog-node 4.18.1, 5.11.3 and 5.13.3 and posthog-js 1.297.3 among its compromised versions. The worm also crossed ecosystems by accident: Maven Central’s automatic mirror republished the infected posthog-node as org.mvnpm:posthog-node:4.18.1, and AsyncAPI lost an OpenVSX key, with confirmed infections through its IDE extension (Wiz aftermath).

Read the secret counts with care. 400,000 “secrets” is a raw count of unverified TruffleHog matches with heavy duplication. Wiz’s floor is “thousands of critical secrets across hundreds of companies”, which is serious enough without inflation.

2026 variants

Metric Figure Source
May 11 wave 170+ npm packages, 2 PyPI packages, 404 malicious versions Microsoft
May 19 AntV wave 639 versions across 323 packages Socket, via BleepingComputer
May 19, packages removed and tokens invalidated 640 packages, 61,274 granular tokens GitHub, reported by Microsoft
May 19, leak repositories 2,200+ (Microsoft), 2,700+ (Aikido, via BleepingComputer) as cited
August 4 ChainDrop more than 400 packages Microsoft, Zscaler
August 4 ChainDrop 868 packages, 1,381 versions Aikido, as quoted in press coverage that I could not check against Aikido’s post

How to check whether you are affected

Work through this from a machine you trust, not from the one you suspect. For each check I give the 2025 indicators, which are well documented, and note the 2026 ones where a vendor published them.

1. Did a compromised version enter your dependency tree?

Get a list of compromised name@version pairs. The maintained ones are Datadog’s consolidated list in the DataDog/indicators-of-compromise repository (folder shai-hulud-2.0), Wiz’s CSV in wiz-sec-public/wiz-research-iocs, and the malware advisories in the GitHub Advisory Database. Formats differ between vendors, so normalise to one name@version per line in a file, here compromised.txt.

For an npm lockfile (version 2 or 3):

jq -r '.packages | to_entries[] | select(.key != "")
       | "\(.key | sub("^.*node_modules/"; ""))@\(.value.version)"' \
  package-lock.json | sort -u > resolved.txt

grep -Fxf compromised.txt resolved.txt

Any line printed is a hit. Run it on every lockfile, and on the lockfiles of the commits that were built during the exposure windows (September 14 to 17 and November 21 to 27, 2025, plus the 2026 dates in the timeline), because a branch that was fixed since may still have installed the bad version at the time. For pnpm and Yarn, pnpm why <package> and yarn why <package> answer the same question for one package.

The lockfile only tells you what a clean install would resolve. What was actually installed is in the caches and build logs:

# was this exact tarball ever fetched into the npm cache? (one name and version at a time)
grep -rh "posthog-node/-/posthog-node-4.18.1.tgz" ~/.npm/_cacache/index-v5 2>/dev/null | head -1

# npm debug logs that mention the loader
grep -Rl "setup_bun" ~/.npm/_logs 2>/dev/null

Also check your internal registry or proxy (Artifactory, Nexus, Verdaccio): it keeps tarballs that npm has long since deleted, and it will serve them again.

2. Are the payload files on disk?

# wave 2 files, anywhere under the home directory and the workspace
find ~ . -type f \( -name setup_bun.js -o -name bun_environment.js \) 2>/dev/null

# leftovers of the harvest
find ~ . -maxdepth 6 -type f \( -name truffleSecrets.json -o -name actionsSecrets.json \) 2>/dev/null

# wave 1: bundle.js is a common file name, so match on the hash
find . -type f -name bundle.js -path '*node_modules*' -exec sha256sum {} + \
  | grep 46faab8ab153fae6e80e7cca38eab363075bb524edd79e42269217a083628f09

# wave 1 helper scripts
ls -la /tmp/processor.sh /tmp/migrate-repos.sh /tmp/github-migration 2>/dev/null

Published hashes (SHA-256):

File Hash Source
bundle.js (wave 1) 46faab8ab153fae6e80e7cca38eab363075bb524edd79e42269217a083628f09 StepSecurity, Wiz, Unit 42
setup_bun.js a3894003ad1d293ba96d77881ccd2071446dc3f65f434669b49b3da92421901a Datadog, Unit 42
bun_environment.js 62ee164b9b306250c1172583f138c9614139264f889fa99614903c12755468d0 Datadog, Unit 42
bun_environment.js cbb9bc5a8496243e02f3cc080efbe3e4a1430ba0671f2e43a202bf45b05479cd Datadog, Unit 42
bun_environment.js f099c5d9ec417d4445a0328ac0ada9cde79fc37410914103ae9c609cbc0ee068 Datadog, Unit 42

Wave 1 had several builds of bundle.js and wave 2 several builds of the payload, so a hash that does not match proves nothing. File names and behaviour are the stronger signal. For ChainDrop (August 2026), Microsoft lists setup.mjs as the loader and Math_Symbol.js, Math_init.js or math_<guid>.js as payload artefacts, and both ChainDrop and the May 2026 waves plant .claude/settings.json, .claude/setup.mjs, .vscode/tasks.json and .vscode/setup.mjs in repositories. Review any unexpected change to those files as you would review code.

3. Is there a rogue runner on the machine?

ls -la ~/.dev-env 2>/dev/null
pgrep -fa 'Runner.Listener|actions-runner|trufflehog'
command -v bun && ls -la ~/.bun   # was Bun installed by you?

On the GitHub side, list self-hosted runners and look for SHA1HULUD or anything you did not register:

gh api orgs/ORG/actions/runners --paginate -q '.runners[] | "\(.name)\t\(.status)\t\(.os)"'
gh api repos/OWNER/REPO/actions/runners -q '.runners[] | "\(.name)\t\(.status)"'

4. Do your GitHub accounts hold marker repositories?

Check every developer’s personal account as well as the organisation. The leak repositories were created under personal accounts.

# my own repositories, public and private, by description
gh api user/repos --paginate \
  -q '.[] | select((.description // "") | test("hulud|miasma|hades|niagA"; "i")) | "\(.full_name)\t\(.description)"'

# an organisation, through search
gh search repos "Sha1-Hulud: The Second Coming" --owner ORG --match description
gh search repos "Shai-Hulud" --owner ORG --match name,description
gh search repos "Shai-Hulud Migration" --owner ORG --match description

Marker strings by wave:

Wave Marker
September 2025 repository named Shai-Hulud; repositories ending in -migration with description Shai-Hulud Migration
November 2025 description Sha1-Hulud: The Second Coming., then Sha1-Hulud: The Continued Coming
April 2026 Shai-Hulud: The Third Coming
May and August 2026 Shai-Hulud: Here We Go Again, also written reversed as niagA oG eW ereH :duluH-iahS
June 2026 Miasma: The Spreading Blight, and descriptions starting with Hades

Remember the cross-victim mechanism: not finding a marker repository in your accounts does not prove that your secrets were not leaked, because they may have been published under another victim’s account. If a compromised version ran in your environment, assume exposure.

5. Workflows and branches you did not create

# code search for the known workflow files
gh search code --owner ORG --filename shai-hulud-workflow.yml
gh search code --owner ORG --filename discussion.yaml "Discussion Create"
gh search code --owner ORG --filename formatter_123456789.yml

# branches named by the worm
gh repo list ORG --limit 1000 --json nameWithOwner -q '.[].nameWithOwner' | while read -r repo; do
  gh api "repos/$repo/branches" --paginate -q '.[].name' 2>/dev/null \
    | grep -E '^(shai-hulud|add-linter-workflow-)' | sed "s|^|$repo: |"
done

Wave 2 deletes its add-linter-workflow-* branch after use, so the branch listing can come back empty on an affected repository. The Actions run history and the audit log keep the trace.

6. The audit log

In the organisation audit log (Settings, then Audit log, or the API on Enterprise Cloud), search the exposure windows for these events:

  • action:repo.create for repositories nobody remembers creating;
  • action:repo.access for private repositories that became public;
  • action:repo.register_self_hosted_runner and action:org.register_self_hosted_runner;
  • action:workflows.created_workflow_run and action:workflows.delete_workflow_run on repositories that were quiet, since both waves ran a workflow to dump secrets and wave 2 deleted the evidence;
  • pushes and workflow runs performed by bot accounts and personal access tokens outside working hours. PostHog only found its pivot commit this way.

7. Your own npm packages

If you maintain packages, the question is also whether the worm published under your name.

npm view <your-package> time --json      # every version with its publish timestamp
npm view <your-package> scripts          # an unexpected preinstall or postinstall?
npm token list                           # tokens you do not recognise

A patch version you did not publish, without a matching tag or commit in your repository, is the signature. Microsoft’s ChainDrop analysis makes the same point: many malicious versions “had no matching source commit, pull request, tag, or legitimate release”.

What to do if a check is positive

Order matters, because some 2026 variants react to a revoked token, and because rotating a credential from a machine that is still infected hands the new credential to the worm.

  1. Isolate first. Take the affected workstation or runner off the network. Do not start by revoking tokens from that machine. For ChainDrop, Zscaler reports that the token-monitor daemon wipes the home directory when its stolen token is revoked, so stop the process and preserve the disk before you rotate.
  2. Kill persistence. Remove the rogue self-hosted runner in GitHub’s settings and on disk (~/.dev-env), delete the backdoor workflows and worm branches, check .claude/ and .vscode/ task files in your repositories.
  3. Rotate everything the machine could read, from a clean machine. npm tokens, GitHub personal access tokens and OAuth sessions (gh auth), SSH keys, cloud keys (AWS, GCP, Azure), CI/CD secrets, and every secret stored in GitHub Actions for the repositories the token could write to. Wiz found over 60% of leaked npm tokens still valid a week after wave 2. Unrotated s1ngularity tokens are what made wave 1 possible.
  4. Deal with the leak repositories. Save a copy as evidence and to know exactly what leaked, then make them private or delete them. Re-privatise any -migration repository and treat every secret in its history as public.
  5. Review cloud activity for the leaked identities: CloudTrail, Azure activity logs, GCP audit logs, and Key Vault or Secrets Manager reads in particular (Microsoft’s guidance).
  6. Clean and rebuild. rm -rf node_modules, npm cache clean --force (and pnpm store prune, yarn cache clean), purge shared CI caches and the internal registry proxy, rebuild runner images. For a workstation where the payload ran, reimage. It had the user’s privileges, and on CI it tried for root.
  7. Unpublish and republish. If your packages were infected, deprecate or unpublish the malicious versions, report them to npm, and publish a clean version so that ranges resolve to something safe.
  8. Pin and redeploy from known-good versions, then watch for a week. Wave 2 had a second spike seven days after the first.

Hardening that would have stopped it

Not all of these stop every variant, so I note what each one covers.

Stop running strangers’ scripts at install time. In .npmrc, for developers and CI:

ignore-scripts=true

Both 2025 waves depended on a lifecycle script, and this setting stops them. With npm 12, released in the summer of 2026, this is the default behaviour: install scripts of dependencies are blocked unless the package is approved in the allowScripts field of package.json (npm approve-scripts), and strict-allow-scripts=true turns the warning into a failed install, which is what you want in CI (npm config documentation). pnpm has blocked dependency scripts by default since version 10.

Know the limits. The 2026 variants were designed around this control: Phantom Gyp hid execution in binding.gyp, the July AsyncAPI wave ran at import time, the Bitwarden package hooked its bin entry, and ChainDrop re-executes from editor task files when a project is opened. Blocking scripts removes the easiest path, not all of them.

Install only what the lockfile says. Use npm ci, pnpm install --frozen-lockfile or yarn install --immutable in CI. A worm that publishes x.y.(z+1) relies on someone resolving a range to “latest patch”.

Add a release cooldown. Almost every malicious version in this story was removed within hours. If your installs refuse versions younger than a few days, you would have skipped all of them.

# .npmrc (recent npm 11 releases and npm 12): days
min-release-age=7
# pnpm-workspace.yaml: minutes
minimumReleaseAge: 10080
# .yarnrc.yml
npmMinimalAgeGate: "1w"

Apply the same rule to automated dependency update bots, so that they do not open a pull request for a version published ten minutes ago.

Publish without long-lived tokens. Use npm trusted publishing: the CI job proves its identity through OIDC and npm issues a short-lived credential for that one workflow, so there is no NPM_TOKEN secret to steal. npm documents GitHub Actions, GitLab.com shared runners and CircleCI cloud as supported providers, and says self-hosted runners are not supported yet. Then set the package’s publishing access to disallow tokens, and require 2FA with a passkey or security key for humans. TOTP codes can be phished in real time.

Trusted publishing is not a proof of innocence. In the May, June and August 2026 waves the attackers controlled the release workflow itself, so malicious packages were published through OIDC with valid provenance attestations. Provenance tells you which workflow built the package. It does not tell you whether that workflow was hijacked.

Fix the workflows that leak the tokens. The second wave began with a pull_request_target workflow that checked out and ran pull request code. GitHub’s advice from April 2026 is direct: do not trigger workflows on pull_request_target, pin third-party actions to full commit SHAs, and watch for script injection from user-controlled fields (GitHub). Add to that: no organisation-wide personal access tokens for bots, read-only GITHUB_TOKEN by default, and branch protection so that a stolen token cannot push to the default branch.

Shrink what an install can reach. Scoped, expiring tokens. Ephemeral CI runners that are destroyed after one job. Egress filtering on build machines: a build has no reason to call api.github.com to create repositories, or to download a runtime from bun.sh. StepSecurity caught wave 1 in a test because an npm install was making GitHub API calls. No cloud administrator credentials on the laptop that runs npm install, and development in a container or VM when possible.

Treat editor and agent configuration as code. .vscode/tasks.json, .claude/settings.json and similar files execute commands. Since May 2026 they are a persistence mechanism, and they deserve the same review as a workflow file.

What I take from it

The worm did not break npm or GitHub. It used both exactly as documented: a registry that runs install scripts by default, tokens that live for years and can publish anything their owner maintains, CI workflows that hand secrets to code from a pull request, and a hosting platform where creating a public repository is one API call. Each default was reasonable on its own. Chained together they formed a loop with no human in it.

The responses that mattered also changed defaults: classic tokens revoked, sessions that last two hours, install scripts off in npm 12, cooldowns in every package manager. What the 2026 variants show is that the loop moves to wherever the next implicit trust sits, such as the release pipeline, the build cache or the editor’s task file. The practical question for a team is not “are we on the list of compromised packages” but “what can an npm install on our machines read, and what can it publish”. If the answer to both is “not much”, the worm has nowhere to go.

Sources

Primary analyses and advisories, in the order used:

Limits of this article: I could read CISA’s alert and Socket’s posts only through search excerpts and other vendors’ citations, because both sites refused automated access, so the CISA figures above rest on those excerpts. The exact release date of npm 12 comes from third-party coverage, while its behaviour is taken from npm’s own documentation. Package lists change. Use the vendors’ live lists, not a blog post, as your reference.

Share: X (Twitter) Facebook LinkedIn