ALL POSTS

article / September 23, 2025

Recent NPM Supply Chain Attacks

Last week was crazy for the JavaScript ecosystem đŸ« 

If you work with Node.js or do front-end, the week of Sept 8–15, 2025, delivered a disaster: a short, intense compromise of popular npm packages, followed by a wormable campaign that spread through maintainers’ accounts. It was a so-called "supply chain attack."

So, what is a supply chain attack exactly? It’s when fraudsters poison the components or pipelines you trust — such as dependencies, build steps, or maintainer accounts, so malicious code rides along into downstream apps and CI/CD systems. The recent npm activity shows both flavors: a high-impact package compromise and a maintainer-centric worm.

Now let's go through what happened last week.

Sept 8: A maintainer account takeover led to malicious releases of widely used packages, including debug and chalk (plus related deps). The bad versions were live for roughly two hours. The browser-side code tried to divert crypto transactions by hooking wallet/network APIs in affected web assets.

Sept 16–19: A separate, ongoing “Shai-Hulud” (I really like the name, btw 😄) worm compromised 180+ npm packages. It ran a post-install script that scraped secrets (npm tokens, GitHub PATs, AWS/GCP/Azure keys), created a public GitHub repo named “Shai-Hulud” to dump them, and then auto-published backdoored versions of other packages the maintainer controls, which enabled self-propagation.

What did the attackers do:

Account takeover: Phishing/MFA-reset led to seizing npm/GitHub access, then publishing malicious versions. Their goal was to hit browsers and reroute crypto during signing flows.

Post-install script execution and worming: steal npm tokens, cloud creds, SSH keys, spin up “Shai-Hulud” repos, run malicious GitHub Actions workflows, and republish poisoned packages to spread further.

How to defend right now and the ways to mitigate such attacks:

Pin versions via lockfiles and blocklist known-bad versions in your private registry/proxy, and rebuild from clean caches (local + CI).

Invalidate CDN caches for affected JS bundles; scan recent artifacts for the obfuscated interceptor patterns noted by researchers.

Rotate secrets. Treat developer machines and CI as exposed: npm tokens, GitHub PATs/SSH keys, AWS/GCP/Azure keys. Check for unexpected “Shai-Hulud” repos and malicious GitHub Actions.

Enforce strong MFA (prefer hardware keys) on npm/GitHub; separate publish tokens; monitor for anomalous publishes and post-install scripts in builds.

Use pnpm: since version 10, pnpm disables the automatic execution of postinstall scripts in dependencies. Also, they recently shipped the minimumReleaseAge setting, which defines the minimum number of minutes that must pass after a version is published before pnpm will install it.

Don't trust dependencies 😄: yes, sometimes it's just better to write some code yourself, especially when LLMs can help you with some basic utils (but be careful here as well since it’s trained on code from GitHub, which may also have vulnerabilities).

Was your project affected by this attack?

Do you know any other ways to mitigate or reduce the risk of being affected by such attacks?

VIEW ON LINKEDIN