Guide, sources citedLast checked 16 October 2026 with AI-assisted research. Editor: Akshay Dubey.Corrections logEditorial policy
On this page
  1. Summary
  2. Background: Shai-Hulud v1
  3. Timeline
  4. How it worked
  5. The destructive fallback
  6. NHI root cause
  7. Impact
  8. Mitigation playbook
  9. Lessons
  10. Primary sources
  11. FAQ
Incident record: Shai-Hulud 2.0 npm worm, November 2025
FieldRecord
Date disclosed24 November 2025 (public reports that day by Aikido, Wiz and GitLab; Aikido detected the first packages at 03:16 UTC)
Initial accessInfected npm package versions ran a preinstall script on developer and CI machines. How the campaign first obtained publishing rights is not publicly disclosed; at PostHog, a pull_request_target workflow was abused to steal a bot's GitHub token (PostHog post-mortem)
Identity or credential involvedIdentities: npm publisher accounts, CI bot accounts and GitHub accounts. Credentials: npm tokens, GitHub tokens and cloud credentials found on infected machines
PrivilegesWhatever the install process could read on the machine, plus the publish rights of any npm token it found
Confirmed impactInfected package versions published (Aikido: 492 packages; Datadog Security Labs: 796); stolen secrets published to public GitHub repositories (Wiz: more than 25,000 on 24 November 2025, more than 30,000 by 1 December 2025); Zapier, ENS Domains, PostHog and Postman packages temporarily trojanised
Estimated1,195 organisations identified in the exfiltrated data (Entro Security, reported 28 November 2025); up to 400,000 unique raw secrets, about 2.5% verified (Wiz, 1 December 2025)
Not established in the sources we reviewedConfirmed triggering of the destructive fallback in a victim environment; follow-on intrusions using the stolen credentials
AttributionNone confirmed (Wiz, 24 November 2025)
Primary sourceWiz; Aikido; Datadog Security Labs; PostHog post-mortem

TL;DR

  • Shai-Hulud 2.0 was a self-replicating npm supply-chain worm. Its payload ran from a preinstall script when an infected package version was installed. Aikido detected the first malicious packages at 03:16 UTC on 24 November 2025.
  • Stolen secrets were published to public GitHub repositories. Wiz counted more than 25,000 repositories on 24 November 2025. Entro Security identified 1,195 organisations in the exfiltrated data (reported 28 November 2025). Researchers published different counts on different dates and no single figure is a settled total.
  • The first wave (September 2025) used a postinstall script. The second wave added a destructive fallback: if the malware could obtain neither a GitHub token nor npm credentials, it tried to erase the user's home directory. GitLab researchers called this a dead man's switch.
  • Our mapping to the OWASP NHI Top 10 (our analysis, not an OWASP statement): NHI2 (Secret Leakage), NHI3 (Vulnerable Third-Party NHI), NHI7 (Long-Lived Secrets) and NHI8 (Environment Isolation).
  • GitHub announced its npm hardening plan (mandatory 2FA for local publishing, short-lived granular tokens, trusted publishing) on 22 September 2025, after the first wave. On 23 December 2025 it said it was accelerating that roadmap.

Summary

Shai-Hulud 2.0 was a propagating npm package worm. Infected package versions carried a preinstall script, setup_bun.js, which installed the Bun runtime and used it to run a second file, bun_environment.js (Microsoft, 9 December 2025; Wiz, 24 November 2025). The payload did two things. It searched the machine for secrets, including with the legitimate secret scanner TruffleHog, and published what it found to public GitHub repositories. It also published infected versions of other npm packages that the stolen credentials could publish.

The name comes from the first wave, which created a public GitHub repository named "Shai-Hulud" and a workflow file named after the sandworms in Dune (Socket, 16 September 2025). The first wave began in mid-September 2025. The second wave was first detected on 24 November 2025 (Aikido). Its repositories carried the description "Sha1-Hulud: The Second Coming".

The public record used on this page comes from Aikido, Wiz, Datadog Security Labs, GitLab, Palo Alto Networks Unit 42, Microsoft, Socket, CISA, GitHub and the post-mortem published by PostHog. No source we reviewed attributes the campaign to a named threat actor. Wiz wrote on 24 November 2025 that no attribution had been confirmed.

Background: Shai-Hulud v1 (September 2025)

Socket dated the first observed compromise of the first wave to 14 September 2025. Affected packages included @ctrl/tinycolor and, on 16 September 2025, packages published by the crowdstrike-publisher npm account (Socket, 16 September 2025). The first wave ran from a postinstall script, used TruffleHog to find secrets, and published them to a public repository named "Shai-Hulud" in the victim's GitHub account.

CISA's alert of September 2025 put the first wave at over 500 compromised packages. GitHub said on 22 September 2025 that it had removed more than 500 compromised packages from the npm registry and was blocking uploads that matched the malware's indicators of compromise. In the same post GitHub announced planned changes to npm publishing: two-factor authentication for local publishing, granular tokens with a seven-day lifetime, trusted publishing, and the deprecation of legacy classic tokens.

Timeline (reconstructed from public reporting)

DateEvent
14 Sep 2025First observed compromise of the first wave (Socket). GitHub says it was notified of the attack on this date.
16 Sep 2025Packages published by the crowdstrike-publisher npm account are compromised and then removed by the registry (Socket).
22 Sep 2025GitHub reports the removal of more than 500 compromised packages and announces planned npm publishing changes.
18 Nov 2025A pull request against a PostHog repository abuses a pull_request_target workflow and steals a bot's GitHub token (PostHog post-mortem).
24 Nov 2025, 03:16 UTCAikido detects the first second-wave packages: go-template and 36 AsyncAPI packages. PostHog packages follow at 04:11 UTC and Postman packages at 05:09 UTC (Aikido).
24 Nov 2025Wiz reports more than 25,000 repositories of stolen secrets, growing by about 1,000 every 30 minutes. PostHog says it had identified and deleted its malicious versions and revoked its publishing tokens by 09:30 UTC.
26 to 27 Nov 2025Wiz reports that GitHub is revoking tokens, making malicious repositories private and notifying users. Public repositories fall to about 300 on 26 November. About 15 malicious package versions remain on npm at 11:00 UTC on 27 November (Wiz).
28 Nov 2025Entro Security's count of 1,195 affected organisations is reported.
1 Dec 2025Wiz reports a corpus of more than 30,000 repositories and a renewed spike of more than 200 new repositories in about 12 hours.
9 Dec 2025Microsoft publishes detection, investigation and defence guidance.
23 Dec 2025GitHub says it is accelerating its npm security roadmap, including bulk migration tooling for trusted publishing, more OIDC providers and staged publishing.

How the worm worked

When an infected package version was installed, the worm ran from a preinstall script. The first wave had used a postinstall script (Unit 42). The steps below are drawn from the Microsoft, Wiz, Datadog Security Labs, Unit 42 and GitLab analyses.

  1. Loader. The preinstall script setup_bun.js installed the Bun JavaScript runtime and used it to run the bundled payload bun_environment.js.
  2. Secret discovery. The payload downloaded and ran TruffleHog, a legitimate secret scanner, and collected GitHub tokens, npm tokens and cloud credentials found on the machine.
  3. CI awareness. The payload checked for CI environment variables such as GITHUB_ACTIONS to decide whether to run in the foreground or as a background process (Wiz). Wiz reported on 1 December 2025 that only 23% of infections occurred on developer machines.
  4. Exfiltration. Stolen data was written to new public GitHub repositories with the description "Sha1-Hulud: The Second Coming", in files such as truffleSecrets.json and contents.json.
  5. Persistence. The payload registered the infected machine as a self-hosted GitHub Actions runner named SHA1HULUD (Wiz, Datadog) and added a workflow file named discussion.yaml (Unit 42).
  6. Propagation. Where npm credentials were available, the worm published infected versions of other packages that those credentials could publish.
  7. Destructive fallback. See the next section.

The dead-man's-switch

The term comes from GitLab's analysis of 24 November 2025. GitLab reported that if an infected system lost access to both GitHub and npm at the same time, the malware triggered data destruction on that machine. Datadog Security Labs described the same condition: if the worm could not retrieve a valid GitHub token and could not find valid npm credentials, it attempted to destroy all files in the user's home folder. On Linux and macOS it used shred to overwrite files before deleting them. On Windows it deleted the user profile's files and overwrote free disk space.

The switch destroyed data. It did not publish secrets. Secrets were published by the normal exfiltration step described above.

GitLab warned that a mass takedown of the repositories or revocation of the tokens could, in principle, cause many infected systems to destroy user data at once. None of the sources we reviewed reports a confirmed case of this destruction in a victim environment. Whether it occurred is not publicly disclosed.

NHI root cause analysis

The mapping below is our own reading of the incident against the OWASP Non-Human Identities Top 10 (2025). It is analysis, not a statement by OWASP or by any of the researchers cited.

  • NHI2, Secret Leakage. Secrets stored on developer and CI machines were readable by a process started from an untrusted package's install script. The worm then published them to public repositories.
  • NHI3, Vulnerable Third-Party NHI. Microsoft reported that attackers compromised maintainer accounts of widely used projects. PostHog's post-mortem describes a stolen bot token, followed by the theft of its npm publishing token. Consumers of those packages inherited the compromise.
  • NHI7, Long-Lived Secrets. A stolen secret is useful for as long as it stays valid. Wiz reported on 1 December 2025 that over 60% of the leaked npm tokens it tested were still valid.
  • NHI8, Environment Isolation. Wiz reported on 1 December 2025 that only 23% of infections occurred on developer machines, and described the infected instances as mostly Linux, with most runners being containers and GitHub Actions the most common CI/CD platform. In our reading, most infections were therefore in CI and build environments. Secrets present in a build job are available to any install script that job runs.

Impact

Researchers published different counts on different dates. None is a settled total.

  • Repositories. Wiz (24 November 2025): more than 25,000 repositories across about 350 unique users. The same post also gives a figure of about 500 users. Aikido (24 November 2025): 26,300 repositories exposed. Wiz (1 December 2025): a corpus of more than 30,000 repositories. Datadog Security Labs (25 November 2025, updated 4 December 2025): over 14,000 repositories and over 500 unique GitHub users, stated as a lower bound.
  • Packages. Aikido (24 November 2025): 492 packages with 132 million monthly downloads in total. Wiz (24 November 2025, updated): about 700, later nearly 800. Datadog Security Labs: 796 unique npm packages with over 20 million weekly downloads in total.
  • Organisations. Entro Security identified 1,195 distinct organisations from email domains, internal hostnames and tenant identifiers in the exfiltrated data, as reported by Cybersecurity News on 28 November 2025.
  • Secrets. Wiz (1 December 2025) reported up to 400,000 unique raw secrets in the TruffleHog output files, of which about 2.5% were verified, and over 60% of leaked npm tokens still valid.
  • Publishers. Wiz and Microsoft named Zapier, ENS Domains, PostHog and Postman among the projects whose packages were temporarily trojanised. Aikido also named AsyncAPI. PostHog published its own post-mortem.
  • Follow-on misuse. The extent to which stolen credentials were used in later intrusions is not publicly disclosed in the sources we reviewed.

Mitigation playbook for affected organisations

  1. Determine exposure. Audit package.json and lockfiles across all repositories, CI configurations, and developer machines. Check against the published Shai-Hulud 2.0 IOC lists maintained by security research teams.
  2. Rotate all potentially exposed credentials. See credential rotation. Any credential that was available as an environment variable or in a common file location on an affected endpoint during the exposure window is candidate-compromised. Rotate broadly, not selectively.
  3. Revoke npm tokens and re-issue via trusted publishing. Where packages are published, move to OIDC-based trusted publishing, which eliminates long-lived publish tokens.
  4. Re-evaluate CI secret scopes. Pipelines should receive only the secrets they operationally need, not a broad environment of everything. Use CI-native secret scoping where available.
  5. Improve developer-machine hygiene. Credentials should live in platform-native keychains, not plaintext .env files or shell profiles. Enterprise endpoints should have EDR that detects the kind of environment-scraping the worm used.
  6. Check for persistence and plan for the destructive fallback. Look for a self-hosted GitHub Actions runner named SHA1HULUD, a workflow file named discussion.yaml, and unexpected repositories with the description "Sha1-Hulud: The Second Coming". The malware tried to erase the home directory when it could obtain neither a GitHub token nor npm credentials, so isolate an infected machine and preserve what you need from it before revoking its credentials.
  7. Notify downstream. If you were a publisher whose package was infected, communicate clearly with your consumers about the window of exposure and the specific actions they should take.

Lessons that transfer

  • Static credentials in CI are a worm attractor. The economics of secret-harvesting supply-chain attacks depends on the abundance of long-lived credentials in CI environments.
  • Package-publishing accounts are production-grade NHIs. Treat the npm tokens, PyPI tokens, Maven credentials, and similar publisher credentials as production-grade secrets with appropriate rotation, 2FA, and scope controls.
  • Trusted publishing reduces supply-chain risk asymmetrically. OIDC-based publishing via GitHub Actions (or equivalents) removes the need for long-lived publisher tokens. It does not fix insecure CI workflows: PostHog traced its compromise to a pull_request_target workflow that ran untrusted code.
  • Install-time lifecycle scripts are a meaningful attack surface. npm install executes code. The first wave used a postinstall script and the second a preinstall script. Consumer organisations with the means should consider disabling or auditing lifecycle scripts, especially in CI.
  • Destructive fallbacks are now part of the threat landscape. The second wave tried to erase the home directory when it lost access to both GitHub and npm. Incident response should assume that cutting off malware can trigger data loss on the infected machine, and should isolate and preserve before revoking.
  • The ecosystem's response has to be structural, not reactive. Each new worm wave surfaces the same underlying issue, too many credentials, in too many places, with too-long lifetimes. The long-term fix is ambient NHI hygiene, not post-incident cleanup.

Frequently asked questions

What was the Shai-Hulud npm worm?

A self-replicating attack against the npm ecosystem in which compromised packages harvested developer and CI credentials, then used those stolen credentials to publish further compromised packages. The self-propagation is what distinguishes it: each successful credential theft expanded the attack surface without further attacker action.

Why does self-replication change the risk calculation?

Because containment time becomes the dominant variable rather than initial blast radius. A conventional supply-chain compromise affects the packages the attacker could reach; a self-replicating one grows at a rate set by how many maintainer credentials it captures. Credential lifetime therefore has outsized effect, since every expired token is a branch of propagation that terminates.

What protects a package registry account from this pattern?

Publishing credentials that are short-lived and scoped to a single package, hardware-backed multi-factor authentication on maintainer accounts, provenance attestation so consumers can verify build origin, and automated publishing from a controlled pipeline rather than from developer machines. The last removes long-lived publish tokens from developer machines.

What should a consuming organisation do?

Pin dependencies and review changes rather than accepting floating versions, restrict what build-time scripts may do, and ensure CI credentials are short-lived and narrowly scoped so that a compromised package in your pipeline captures little of value. Detection after the fact matters less than reducing what is available to steal.

Related on this site: Codecov Bash Uploader (2021) · Agent credentials in CI/CD · Secrets management · Workload identity federation

Would your controls have changed the outcome? The breach readiness score asks you to rate your own controls against seven publicly reported incidents, including this one, and lists the scenarios to revisit. No sign-up is needed.

Other case studies: Codecov Bash Uploader compromise (2021), Microsoft Storm-0558 (2023), Okta support system breach (2023), Salesloft Drift breach (2025), Snowflake and UNC5537 (2024).

Primary sources

Sources are listed below. Counts differ between researchers and dates, so each figure on this page is attributed to its source.

From the publisher

HumanAudit, which publishes this site, is preparing the NHI Governance pack: an NHI policy, ownership register, lifecycle procedures and one control set mapped, as our interpretation, to PCI DSS v4.0.1, ISO/IEC 27001:2022, NIS2 and DORA. Planned for March 2027; not yet on sale, and no price has been published.

Monthly change log

Know when the NHI landscape changes.

One email a month from this reference: new deals, standards status changes and corrections. No sponsored content. Unsubscribe from any email.

We first email you a link to confirm. Privacy policy.