Shai-Hulud Worm
A self-replicating npm (later PyPI/RubyGems) credential-stealing worm: an install hook harvests secrets, dumps them into attacker-readable GitHub repos, and uses stolen npm tokens or hijacked CI publish identities to trojanize every package the victim maintains.
How it works
Generic kill chain, stable across waves:
- Execution at install — injected lifecycle hook (
postinstallin wave 1;preinstallfrom 2.0 on, so it runs before tests/scans;binding.gypin the Miasma wave;prepareon an injected gitoptionalDependenciesentry in TanStack). - Harvest —
process.envdump (catchesGITHUB_TOKEN,NPM_TOKEN, cloud keys),~/.npmrc,~/.aws/credentials, cloud SDK/IMDS calls, andtrufflehog filesystem / --jsonfor high-entropy secrets (e.g.AKIA[0-9A-Z]{16}). Later variants scrape CI runner memory and hunt 469 credential locations, including AI agents (Cursor, Gemini,~/.claude/projects/*.jsonlsession history), Jenkins and crypto wallets. - Exfil — create a repo under the victim’s own GitHub account and commit JSON (
contents.json,environment.json,cloud.json,truffleSecrets.json); later AES-256-GCM + RSA-OAEP encrypted. Side channels:webhook.site, Session/Oxen P2P (filev2.getsession[.]org), GitHub GraphQL “dead-drop” commits. - Propagate — validate token via
/whoami, enumerate/-/v1/search?text=maintainer:<user>&size=N, then for each package: inject payload,npm version patch --force && npm publish --access public --token $T. - Persist / destroy — malicious workflows, self-hosted runners, IDE/agent hooks, OS daemons; wiper fallbacks.
Waves
| Wave | Date | Mechanics / IOCs |
|---|---|---|
| Shai-Hulud (1) | Sep 2025 | @ctrl/tinycolor (2M+ weekly), ngx-bootstrap 20.0.4–20.0.6, ng2-file-upload; 500+ pkgs. ~3.6 MB Webpack bundle.js via postinstall; propagates to 20 pkgs/maintainer; public repo named Shai-Hulud; pushes branch shai-hulud + .github/workflows/shai-hulud-workflow.yml exfiltrating ${{ toJSON(secrets) }} to webhook.site/bb8ca5f6-…; flips private repos public. Believed downstream of the [[Malicious Packages#Notable cases |
| 2.0 “Sha1-Hulud: The Second Coming” | Nov 2025 | 796 pkgs / 1,092 versions, 20M+ weekly downloads, 25K+ repos exposed. preinstall → setup_bun.js installs Bun → runs bun_environment.js (Bun evades Node-focused monitoring). Backdoors up to 100 pkgs/maintainer. Repo description Sha1-Hulud: The Second Coming.; if no GitHub token, it searches GitHub for other victims’ repos and reuses their tokens. Registers a self-hosted runner SHA1HULUD in ~/.dev-env plus a workflow triggered on discussion with run: echo ${{ github.event.discussion.body }} — deliberate expression injection as C2. Fallback wiper: `find “$HOME” -type f -writable … |
| 3.0 “Golden Path” | Dec 2025 | @vietmoney/react-big-calendar@0.26.2; re-obfuscated from source, cross-platform, better error handling; timed to holidays and the npm move to trusted publishing. |
| Mini Shai-Hulud (TeamPCP) | Apr–Aug 2026 | @bitwarden/cli@2026.4.0 (via compromised GitHub Actions, 334 devs); SAP mbt, @cap-js/{sqlite,postgres,db-service} ("preinstall": "node setup.mjs" → Bun 1.3.13 → execution.js; 1,200+ exfil repos); PyPI lightning 2.6.2/2.6.3, intercom-client 7.0.4; TanStack (84 versions / 42 pkgs); @antv (300+ versions, "preinstall": "bun run index.js", beacon niagA oG eW ereH :duluH-iahS); keyv/flat-cache/cacheable (setup.mjs + Math_Symbol.js). Token-revocation monitor triggers a machine wipe. Persistence by poisoning Claude Code and VS Code config. |
| Miasma / descendants | Jun–Nov 2026 | binding.gyp execution (sonatype-2026-003581); RubyGems strutil-core exfiltrating to paleasbest[.]top with Python backdoor and revocation-triggered wiper; tensorlake@0.5.144 with valid provenance. |
TanStack: worm meets CI hijack (May 11 2026)
No maintainer token was stolen — TeamPCP hijacked the legitimate release pipeline:
- Pwn Request: fork PR (commit spoofing
claude <claude@users.noreply.github.com>,[skip ci]) against apull_request_targetworkflow sharing the base repo’s cache scope. - Cache poisoning: wrote a 1.1 GB poisoned pnpm store under the exact key
release.ymlrestores (actions/cache@v5post-job save doesn’t block writes); sat ~8 h until a push tomain. - OIDC theft: attacker binaries found
Runner.Workervia/proc/*/cmdlineand dumped/proc/<pid>/memfor the on-demand OIDC token (technique from tj-actions changed-files Compromise). - Published 84 versions with valid SLSA provenance — the first documented malicious npm packages with valid provenance — even though the workflow’s publish step was skipped. Payload
router_init.js; downstream OpenAI had two employee devices compromised and rotated macOS code-signing certs.
The AntV wave went further: anoptionalDependenciesentry pointing at an orphan commit in the realantvis/G2repo (fork created, commit pushed, fork deleted — GitHub keeps the object), plus Fulcio certificates minted with stolen OIDC tokens to forge Sigstore attestations. See SBOM and Provenance.
Notable cases
- Attribution: TeamPCP (aka DeadCatx3, PCPcat, ShellForce, CipherForce) claimed TanStack; shared hardcoded strings link Bitwarden, SAP and TanStack to one codebase. Victims include Trivy, LiteLLM, Mercor, OpenAI, Mistral AI and the European Commission.
- May 2026: TeamPCP open-sourced the worm and ran a BreachForums “biggest attack” contest; clones followed within days (
chalk-tempalte, alongside Axios typosquatsaxois-utils,@deadcode09284814/axios-util). - 26 Aug 2026: AFP/FBI charged two Western Australian men over TeamPCP.
Defenses
- Hunt: GitHub code search
org:<org> path:**/shai-hulud-workflow.yml; branches namedshai-hulud; repos with the 2.0 description or beacon string; self-hosted runners namedSHA1HULUD;DiscussionEventon unexpected repos; outbound*.getsession.org. - Treat any host that installed an affected version as fully compromised: rebuild, then rotate npm/GitHub/cloud/Vault creds. Revoking a GitHub token can trigger the wiper — image first.
npm ci --ignore-scripts/ disable lifecycle scripts (npm 12 disablespreinstallby default); dependency cooldowns / soak time (a 72 h rule blockedtensorlake@0.5.144); isolate CI install from publish.- Publishing: npm trusted publishing (OIDC, short-lived) instead of long-lived tokens, 2FA on publish — but TanStack shows OIDC publishing is only as strong as the workflow; avoid
pull_request_target+ shared caches (GitHub Actions Security). - Commit-signature verification (fake “Linus Torvalds”/
claudeauthors), Harden-Runner style egress monitoring on CI.
Related
- Software Supply Chain Security
- Malicious Packages
- GitHub Actions Security
- Pwn Requests
- tj-actions changed-files Compromise
- CI/CD Pipeline Attacks
- SBOM and Provenance
- Secret Scanning
- Leaked Cloud Credentials
- AI Coding Assistant Risks
Sources
- Shai-Hulud: Self-Replicating Worm Compromises 500+ NPM Packages — StepSecurity · original
- Shai-Hulud npm supply chain attack overview — ReversingLabs · original
- Zero-day Extensive NPM Package Compromise — Snyk · original
- Shai-Hulud: ongoing package supply chain worm — Wiz · original
- Shai-Hulud 2.0 npm worm: analysis — Datadog · original
- Shai-Hulud 2.0: 25K+ Repos Exposed — Wiz · original
- Shai-Hulud 2.0: Detection and Defense Guidance — Microsoft · original
- Shai-Hulud worm compromises npm ecosystem — Unit 42 · original
- The Holiday Whisper: Shai-Hulud 3.0 — Snyk · original
- Shai-Hulud: The Third Coming — Bitwarden CLI backdoored — OX · original
- Mini Shai-Hulud Targets SAP npm Packages — Aikido · original
- TanStack npm Packages Hit by Mini Shai-Hulud — Snyk · original
- Mini Shai-Hulud Hits AntV — Snyk · original
- The @antv Ecosystem Was Compromised — OX · original
- Mini Shai-Hulud's Latest Wave: 280 New Places — GitGuardian · original
- Keyv and friends compromised — Aikido · original
- New Shai-Hulud Miasma Wave — Sonatype · original
- Shai-Hulud Descendant in Malicious Ruby Gem — Socket · original
- First Shai-Hulud Worm Clones Emerge — SecurityWeek · original
- Shai-Hulud hackers: two men charged — Bitdefender · original
- tensorlake@0.5.144: A Worm With Valid Provenance — Hextrap · original
- Lightning / intercom-client infected — OX · original