Supply chain · November 24, 2025

Shai-Hulud 2.0: npm worm hit hundreds of packages, including PostHog SDKs, via preinstall scripts

On 24 November 2025 a second wave of the Shai-Hulud worm published malicious versions of hundreds of npm packages, including PostHog's SDKs, that ran a preinstall script to install the Bun runtime and steal GitHub, npm and AWS, Google Cloud and Azure credentials. Stolen data went to public GitHub repositories described as "Sha1-Hulud: The Second Coming", and stolen npm tokens were used to infect more packages. Anyone who installed an affected version that day should rotate every credential on that machine or runner and check for a rogue self-hosted runner.

DisclosedNovember 24, 2025
Earliest known activityNovember 18, 2025
Affectednpm, GitHub, posthog-node, posthog-js, PostHog
TypeSupply chain
StatusContained

What was exposed

Environment variables, local credential files such as Google Cloud application default credentials, cloud instance-metadata credentials, secrets read from AWS, Google Cloud and Azure secret stores, GitHub and npm tokens, and anything TruffleHog found on disk. Because the hook ran at preinstall, it executed even if the install later failed. Data was published to public GitHub repositories with 18-character random names. The malware also registered the machine as a GitHub self-hosted runner named SHA1HULUD, giving the attacker a remote command channel, and Datadog reports it tried to delete files in the home directory when it found no tokens to use.

Am I affected?

You are affected if a developer machine or CI runner installed a compromised version on or after 24 November 2025. PostHog's affected versions are posthog-node 4.18.1, 5.13.3 and 5.11.3, posthog-js 1.297.3, posthog-react-native 4.11.1, posthog-docusaurus 2.0.6, posthog-react-native-session-replay 1.2.2, @posthog/agent 1.24.1, @posthog/ai 7.1.2 and @posthog/cli 0.5.15; the PostHog script tag was not affected. For other packages, compare your lockfiles with Datadog's consolidated indicator list. On disk, look for setup_bun.js, bun_environment.js, truffleSecrets.json or a ~/.dev-env directory, and in GitHub look for a runner named SHA1HULUD or repositories with the description "Sha1-Hulud: The Second Coming".

What to do now

  1. Compare lockfiles and caches with the published indicator lists, delete node_modules, clear npm, yarn and pnpm caches, and reinstall versions published after the attack was contained.
  2. Rotate GitHub tokens, npm tokens and cloud credentials on every affected machine and runner, and rotate secrets stored in AWS Secrets Manager, Google Secret Manager and Azure Key Vault that those credentials could read.
  3. Remove any self-hosted runner named SHA1HULUD, delete the ~/.dev-env directory, and review workflows that run on discussion events.
  4. Delete any exfiltration repositories in your GitHub accounts and organizations, after saving what they reveal about which secrets leaked.
  5. Disable install scripts by default (pnpm 10 does) and set a minimum release age for new versions, as PostHog did after the incident.

Keys to rotate

Guides to the credentials this incident put at risk:

Timeline

  1. An external pull request to a PostHog repository abuses a pull_request_target workflow to send a bot's GitHub token to an attacker-controlled webhook, according to PostHog. Source
  2. PostHog says the attacker used that token to push a workflow change that dumped the repository's secrets, including the npm publishing token. Source
  3. Malicious PostHog versions are published from 04:11 UTC. PostHog deletes them, revokes publishing tokens and starts rotating credentials by 09:30 UTC. Source
  4. Datadog counts 796 unique packages and 1,092 versions affected, with the last affected package published at about 18:00 UTC, and more than 14,000 exfiltration repositories. Source

Indicators

From the advisories listed below. Use them to search your logs, lockfiles and workflow runs.

  • Files setup_bun.js and bun_environment.js with a new preinstall script in package.json.
  • GitHub repositories described as "Sha1-Hulud: The Second Coming" with 18-character lowercase alphanumeric names.
  • A self-hosted GitHub Actions runner named SHA1HULUD installed under ~/.dev-env.
  • A local file named truffleSecrets.json.

Frequently asked questions

Am I affected by the npm incident?

You are affected if a developer machine or CI runner installed a compromised version on or after 24 November 2025. PostHog's affected versions are posthog-node 4.18.1, 5.13.3 and 5.11.3, posthog-js 1.297.3, posthog-react-native 4.11.1, posthog-docusaurus 2.0.6, posthog-react-native-session-replay 1.2.2, @posthog/agent 1.24.1, @posthog/ai 7.1.2 and @posthog/cli 0.5.15; the PostHog script tag was not affected. For other packages, compare your lockfiles with Datadog's consolidated indicator list. On disk, look for setup_bun.js, bun_environment.js, truffleSecrets.json or a ~/.dev-env directory, and in GitHub look for a runner named SHA1HULUD or repositories with the description "Sha1-Hulud: The Second Coming".

What was exposed in the npm incident?

Environment variables, local credential files such as Google Cloud application default credentials, cloud instance-metadata credentials, secrets read from AWS, Google Cloud and Azure secret stores, GitHub and npm tokens, and anything TruffleHog found on disk. Because the hook ran at preinstall, it executed even if the install later failed. Data was published to public GitHub repositories with 18-character random names. The malware also registered the machine as a GitHub self-hosted runner named SHA1HULUD, giving the attacker a remote command channel, and Datadog reports it tried to delete files in the home directory when it found no tokens to use.

Which keys should I rotate?

Rotate any GitHub, npm, AWS (IAM access keys), Google Cloud (service account keys and API keys), Azure (Microsoft Entra app client secrets) credentials that were reachable from affected systems, starting with the ones that can publish code or reach production.

Keep keys out of reach of the next compromised package

BotPassword is in early access. Request an invite and we'll email you when your spot opens.