Massive NPM Supply Chain Attack Spreads Self-Replicating "Shai-Hulud" Worm

Hundreds of NPM Packages Compromised by "Shai-Hulud" Worm in Major Supply Chain Attack, Crypto Libraries Targeted

CRITICAL
November 24, 2025
5m read
Supply Chain AttackMalwareCloud Security

Related Entities

Organizations

Aikido SecurityWiz

Products & Tech

NPM Ethereum Name Service content-hashaddress-encoder

Full Report

Executive Summary

A large-scale, automated supply chain attack is actively compromising the NPM JavaScript package repository. A self-replicating worm, named Shai-Hulud, has infected over 400 packages, many of which are dependencies for critical cryptocurrency projects. The malware is designed to steal credentials and other secrets from compromised developer environments, posing a significant risk of financial theft and broader system compromise. The attack's rapid spread, infecting thousands of repositories, necessitates immediate investigation and remediation for any organization utilizing the NPM ecosystem.


Threat Overview

The attack involves a worm that propagates by compromising NPM packages. When a developer installs an infected package, the worm activates within their environment. Its primary function is to search for and exfiltrate sensitive information, such as API keys, private keys for cryptocurrency wallets, and other developer secrets. The worm then seeks out other NPM packages maintained by the compromised developer and injects itself into them, continuing the cycle of infection. This self-replicating nature has allowed the attack to reach a massive scale. The primary targets appear to be developers and projects within the cryptocurrency space, with several key libraries for the Ethereum Name Service (ENS) being compromised. This includes high-usage packages like content-hash and address-encoder, which are dependencies for nearly a hundred other projects, creating a cascading impact across the ecosystem.


Technical Analysis

The attack leverages the trust inherent in package manager ecosystems. The initial infection vector is not detailed but likely involves developer account compromise or typosquatting.

Attack Chain:

  1. Initial Compromise: A developer downloads and uses a malicious NPM package containing the Shai-Hulud worm.
  2. Execution: The malware executes on the developer's machine, likely via a postinstall script.
  3. Credential Theft: The worm scans the local environment for credentials, API keys, and cryptocurrency wallet keys. This aligns with techniques like T1555 - Credentials from Password Stores and T1552.001 - Credentials In Files.
  4. Propagation: The worm uses the compromised developer's credentials to publish new versions of other packages they maintain, injecting its own malicious code. This constitutes a supply chain compromise via T1195.002 - Compromise Software Supply Chain.
  5. Data Exfiltration: Stolen credentials and secrets are exfiltrated to an attacker-controlled server.

The scale is significant, with Aikido Security identifying over 400 infected packages and Wiz reporting over 25,000 affected repositories. The rapid growth rate (1,000 new repos every 30 minutes) indicates a highly effective automated propagation mechanism.


Impact Assessment

The business impact is severe, particularly for the cryptocurrency and Web3 sectors. The compromise of foundational ENS libraries could lead to widespread financial loss if stolen wallet keys are exploited. Beyond direct financial theft, the exfiltration of developer credentials and API keys could allow attackers to gain deeper access into corporate networks, cloud environments, and source code repositories, leading to further data breaches, intellectual property theft, and service disruption. The erosion of trust in the NPM ecosystem is another significant consequence, forcing development teams to allocate resources to costly security audits and dependency verification processes.


Cyber Observables for Detection

Type Value Description Context Confidence
file_path node_modules/ Suspicious or obfuscated scripts found within package directories. File Integrity Monitoring high
command_line_pattern npm install or npm ci Monitor for child processes spawning from package manager commands that initiate unexpected network connections. EDR / Process Monitoring medium
network_traffic_pattern Outbound connections to unknown IPs/domains from build servers or developer workstations during package installation. SIEM / Network Flow Logs medium
file_name package.json, package-lock.json Unexpected modifications or additions to dependency lists and scripts. Code Repository Scanning high

Detection & Response

Detection:

  1. Dependency Scanning: Run npm audit to identify known vulnerabilities in dependencies. Use third-party tools like Snyk or Dependabot to scan for malicious packages and suspicious code patterns.
  2. Network Monitoring: Monitor outbound traffic from build environments and developer machines, especially during npm install operations. Alert on connections to new or untrusted domains.
  3. Behavioral Analysis: Use an EDR solution to monitor for suspicious behavior originating from Node.js or npm processes, such as file system scanning, accessing credential stores, or unexpected network activity. Reference D3FEND technique D3-PA - Process Analysis.

Response:

  1. Isolate: Immediately isolate affected build servers and developer machines from the network.
  2. Credential Rotation: Rotate all developer credentials, API keys, and secrets found on compromised systems.
  3. Audit Packages: Identify and remove all infected packages from your projects. Revert to known-good versions.
  4. Revoke Tokens: Revoke any NPM access tokens associated with compromised developer accounts.

Mitigation

Strategic:

  1. Private Registry: Host vetted, internal copies of third-party dependencies in a private package registry to control which packages can be used.
  2. Strict Governance: Implement a formal process for vetting and approving new third-party dependencies before they are introduced into projects.

Tactical:

  1. Dependency Pinning: Use package-lock.json or yarn.lock to pin dependencies to specific, known-good versions. This prevents the automatic installation of newly published, potentially malicious versions. This is a form of D3-ACH - Application Configuration Hardening.
  2. Scoped Permissions: Use NPM tokens with the least privilege necessary. Use read-only tokens for CI/CD environments where package publishing is not required.
  3. MFA for Developers: Enforce multi-factor authentication on all developer accounts, including NPM, GitHub, and other code repository platforms.

Timeline of Events

1
November 24, 2025
This article was published

MITRE ATT&CK Mitigations

Use application control policies to prevent the execution of unauthorized scripts during package installation.

Enforce policies that require dependencies to be signed by trusted authors, although this is not universally supported in NPM.

Configure package managers to use a private, vetted registry and disable arbitrary script execution.

Enforce MFA on developer accounts for package registries (NPM, GitHub) to prevent account takeover and malicious publishing.

D3FEND Defensive Countermeasures

To defend against NPM supply chain attacks like the one involving Shai-Hulud, organizations must harden their development and CI/CD environments. This involves configuring NPM clients to use a private, internal package registry (e.g., Nexus, Artifactory) as the primary source for dependencies. This private registry should only contain versions of packages that have been vetted and approved by a security team. Additionally, configure NPM to disable or restrict the execution of arbitrary preinstall and postinstall scripts by using the --ignore-scripts flag during installation in automated environments. For local development, use tools that can analyze these scripts before execution. This hardening breaks the attack chain by preventing the initial execution of the malicious payload and controlling the provenance of all software dependencies, directly mitigating the risk of introducing a compromised package.

Implement robust process analysis on developer workstations and build servers to detect anomalous behavior during package management operations. Use an Endpoint Detection and Response (EDR) tool to monitor process chains originating from npm.exe or node.exe. Create detection rules that alert when these processes attempt to access sensitive files (e.g., ~/.aws/credentials, ~/.ssh/, cryptocurrency wallet files), spawn shell commands to enumerate system information, or initiate network connections to untrusted external endpoints. By establishing a baseline of normal npm install behavior, security teams can quickly identify deviations indicative of a malicious package like Shai-Hulud attempting to perform reconnaissance or exfiltrate data. This provides a critical detection layer even if the malicious package itself is unknown.

Sources & References

New NPM supply-chain attack compromises major ENS and crypto libraries
TradingView (tradingview.com) November 24, 2025

Article Author

Jason Gomes

Jason Gomes

• Cybersecurity Practitioner

Cybersecurity professional with over 10 years of specialized experience in security operations, threat intelligence, incident response, and security automation. Expertise spans SOAR/XSOAR orchestration, threat intelligence platforms, SIEM/UEBA analytics, and building cyber fusion centers. Background includes technical enablement, solution architecture for enterprise and government clients, and implementing security automation workflows across IR, TIP, and SOC use cases.

Threat Intelligence & AnalysisSecurity Orchestration (SOAR/XSOAR)Incident Response & Digital ForensicsSecurity Operations Center (SOC)SIEM & Security AnalyticsCyber Fusion & Threat SharingSecurity Automation & IntegrationManaged Detection & Response (MDR)

Tags

NPMJavaScriptSupply Chain AttackShai-HuludWormCredential StealingCryptocurrencyENS

📢 Share This Article

Help others stay informed about cybersecurity threats

Continue Reading