Shai-Hulud 2.0 (Sha1-Hulud, The Second Coming), an npm worm that stole developer and cloud credentials
A second npm worm stole npm, GitHub and cloud keys.
Are you affected?
The free scanner that answers this opens soon. Until then, the steps below work by hand.
What happened
A second npm worm wave stole developer and cloud keys. Socket reported on 2025-11-24 more than 500 packages and 700 versions carrying a preinstall script that runs setup_bun.js, which installs the Bun runtime and runs a 10 MB obfuscated payload, bun_environment.js. Socket says it captured the environment (including GITHUB_TOKEN, NPM_TOKEN, AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY), ran TruffleHog over the home directory, and read AWS Secrets Manager, GCP Secret Manager and Azure Key Vault secrets and GitHub Actions secrets. Stolen data went, triple base64-encoded, to a new GitHub repository in the victim's account, some described as "Sha1-Hulud: The Second Coming". Unit 42 counts over 25,000 such repositories across about 350 users and says it took npm tokens from .npmrc files; Socket says stolen npm tokens were used to poison more packages. With no usable GitHub or npm token it tries to wipe the user's home directory. Microsoft first saw the files on 2025-11-24.
- Exposure starts
- 2025-11-24
- Exposure ends
- Not known yet (no source says when the last compromised version was removed; Microsoft last saw the files on 2025-12-01)
- Confidence
- medium
- Scope
- every credential readable on a developer machine or CI runner that installed a compromised version, the cloud secret stores those credentials could read, and every package its npm identity could publish
What to do, in this order
- Remove compromised versions, delete node_modules and clear cached copies before rotating
Socket's first step; a cached compromised version re-runs the preinstall payload and steals the new credentials.
- npm tokens
Unit 42 says the worm takes npm tokens from .npmrc files; Socket says it mines stolen GitHub Actions secrets for npm tokens and uses them to poison additional packages.
npm_token
- GitHub tokens, then remove repositories described as "Sha1-Hulud: The Second Coming", the discussion.yaml workflow and any self-hosted runner named SHA1Hulud
Unit 42 names GitHub personal access tokens; the stolen data was published to repositories in the victim's account and the runner gives the attacker command execution.
github_pat
- AWS keys, then every secret in AWS Secrets Manager, GCP Secret Manager and Azure Key Vault those keys could read
Socket says the payload read environment AWS keys and pulled secrets from all three cloud secret stores; Microsoft says to rotate and revoke exposed credentials rapidly.
aws_access_key_id, aws_secret_access_key, anything else stored there
- Every other secret on the host, including GitHub Actions secrets and SSH keys
Socket says TruffleHog scanned the home directory and GitHub Actions secrets were taken; Unit 42 says to rotate all developer credentials, including SSH keys.
private_key, anything else stored there
- Require 2FA for publishing and move to npm trusted publishing
Microsoft's recommendation, so a stolen token alone cannot publish.
Notes
- Only eight packages from Socket's list of more than 500 are listed here; the full list is TODO, so rotateit's installed-package check covers these alone.
- Persistence: Unit 42 says the worm adds a GitHub Actions workflow named discussion.yaml that registers the machine as a self-hosted runner, and Microsoft names that runner SHA1Hulud.
- PostHog's own compromise, per Socket's 2025-11-26 update, came from a pull request that changed a script run by pull_request_target and stole a bot token that led to an npm publish token.
- Socket also found the payload in the Maven Central package org.mvnpm:posthog-node 4.18.1; Maven is not a package ecosystem in this schema.
How to tell if you’re affected
- A preinstall script in package.json that runs setup_bun.js
- A file named bun_environment.js of about 10 MB in a package
- A GitHub repository in your account described as "Sha1-Hulud: The Second Coming" holding cloud.json, contents.json, environment.json, truffleSecrets.json or actionsSecrets.json
- A workflow file .github/workflows/discussion.yaml
- A self-hosted GitHub Actions runner named SHA1Hulud
Sources
- Socket: Shai Hulud strikes again (v2)
- Unit 42: Shai-Hulud worm compromises npm ecosystem (updated November 26)
- Microsoft: Shai-Hulud 2.0, guidance for detecting, investigating, and defending against the supply chain attack
Rotating the keys
Pro, $49 a year when it opens, plans the rotation of each affected key for this incident, in this order. Automatic rotation is in testing and included.
By hand, free: the steps above.