PostHog: its npm SDKs were briefly malicious in November 2025; the script snippet was not
Reported by Oliver Browne, PostHog, "Post-mortem of Shai-Hulud attack on November 24th, 2025" — posthog.com/blog/nov-24-shai-hulud-attack-post-mortem · distilled by Leon Mallett (captivated.online) with Claude Code · reviewed 2026-10-24
PostHog’s own post-mortem: at 04:11 UTC on 24 November 2025, malicious versions of its JavaScript SDKs were published to npm, including posthog-js 1.297.3 and posthog-node 4.18.1, 5.11.3 and 5.13.3. A preinstall script searched the machine running the install for credentials, published them to a public GitHub repository, and used any npm tokens it found to spread to other packages. PostHog removed the versions by 09:30 UTC. Sites using the script-tag snippet were not affected, because the worm ran during dependency installation. The attacker got PostHog’s publishing token through a GitHub Actions workflow that ran code from pull requests submitted by outside contributors.
For an agent, the exposure is the install. “Add PostHog” usually means installing the latest SDK, and an install that ran during those five hours would have run the payload with the agent’s environment.
- Pin PostHog’s SDKs to a known version and update deliberately, not by default.
- Set a minimum release age. PostHog’s own advice is to use the
minimumReleaseAgesetting in pnpm or yarn, at something like three days, so a malicious release is usually withdrawn before you can install it. - Do not let install scripts run by default. PostHog moved to pnpm 10 to disable them.
- Where the browser snippet is enough, it avoids the install entirely.