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:

  1. Execution at install — injected lifecycle hook (postinstall in wave 1; preinstall from 2.0 on, so it runs before tests/scans; binding.gyp in the Miasma wave; prepare on an injected git optionalDependencies entry in TanStack).
  2. Harvest — process.env dump (catches GITHUB_TOKEN, NPM_TOKEN, cloud keys), ~/.npmrc, ~/.aws/credentials, cloud SDK/IMDS calls, and trufflehog filesystem / --json for 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/*.jsonl session history), Jenkins and crypto wallets.
  3. 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.
  4. 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.
  5. Persist / destroy — malicious workflows, self-hosted runners, IDE/agent hooks, OS daemons; wiper fallbacks.

Waves

WaveDateMechanics / 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 2025796 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 / descendantsJun–Nov 2026binding.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:

  1. Pwn Request: fork PR (commit spoofing claude <claude@users.noreply.github.com>, [skip ci]) against a pull_request_target workflow sharing the base repo’s cache scope.
  2. Cache poisoning: wrote a 1.1 GB poisoned pnpm store under the exact key release.yml restores (actions/cache@v5 post-job save doesn’t block writes); sat ~8 h until a push to main.
  3. OIDC theft: attacker binaries found Runner.Worker via /proc/*/cmdline and dumped /proc/<pid>/mem for the on-demand OIDC token (technique from tj-actions changed-files Compromise).
  4. 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: an optionalDependencies entry pointing at an orphan commit in the real antvis/G2 repo (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 typosquats axois-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 named shai-hulud; repos with the 2.0 description or beacon string; self-hosted runners named SHA1HULUD; DiscussionEvent on 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 disables preinstall by default); dependency cooldowns / soak time (a 72 h rule blocked tensorlake@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”/claude authors), Harden-Runner style egress monitoring on CI.

Sources