Self-Spreading "Miasma" Worm Hits npm Registry Using Novel "Phantom Gyp" Attack

"Miasma" Worm Spreads Through npm via "Phantom Gyp" Technique, Stealing Dev Secrets

CRITICAL
June 4, 2026
5m read
Supply Chain AttackMalwareThreat Actor

Related Entities

Organizations

Products & Tech

npmGitHub AWSGCPAzureKubernetesHashiCorp Vault

Other

MiasmaMini Shai-Hulud

Full Report

Executive Summary

A highly sophisticated and self-spreading worm, dubbed Miasma, is actively compromising packages within the npm registry, presenting a severe threat to the software supply chain. The attack leverages a novel technique called "Phantom Gyp," which bypasses common security measures by embedding malicious commands within a binding.gyp file instead of the more frequently monitored package.json scripts. This allows the malware to execute during the standard npm install process. The worm's primary objective is large-scale credential theft from developer environments and CI/CD pipelines, targeting secrets for GitHub, major cloud providers, Kubernetes, and more. The campaign has already impacted dozens of packages, including those published by Red Hat, and demonstrates a significant evolution in supply chain attack methodology.


Threat Overview

The Miasma worm represents a new iteration of the Mini Shai-Hulud malware family. Its most recent wave, observed on June 3, 2026, compromised 57 npm packages with over 286 malicious versions in just two hours. This followed an earlier attack on June 1, 2026, where a Miasma variant compromised 32 packages in the @redhat-cloud-services npm namespace.

The core of the attack is the "Phantom Gyp" technique. node-gyp is a tool used to compile native addon modules for Node.js. It uses a binding.gyp file to define build configurations. Attackers are abusing this legitimate build process by inserting malicious commands into the binding.gyp file. Because security scanners often focus on preinstall and postinstall scripts in package.json, this method allows the malware to evade detection and gain execution on a developer's machine or in a CI/CD environment during a routine package installation.


Technical Analysis

The Miasma worm is a credential harvester with a broad target scope. Once executed via the binding.gyp file, it systematically searches for and exfiltrates sensitive information.

  • Execution: The binding.gyp file contains a malicious entry that executes a script when npm install is run.
  • Credential Theft: The malware is designed to steal:
  • Exfiltration: Stolen data is exfiltrated to a GitHub account, liuende501, which acts as a dead-drop location.

This attack maps to several MITRE ATT&CK techniques:


Impact Assessment

The impact of the Miasma worm is critical and far-reaching:

  • Widespread Compromise: The worm's self-spreading nature means it can rapidly infect a large number of packages and, consequently, a vast number of downstream projects and applications.
  • Developer and CI/CD Pipeline Takeover: Stolen credentials can give attackers full access to source code repositories, cloud infrastructure, and deployment pipelines, enabling further malicious activities like injecting backdoors into production code.
  • Erosion of Trust: Such attacks undermine trust in the open-source ecosystem, forcing development teams to invest heavily in vetting and securing their software dependencies.
  • Financial and Data Loss: Compromised cloud and service credentials can lead to significant financial loss and massive data breaches.

IOCs — Directly from Articles

Type
Other
Value
liuende501
Description
GitHub account used as a dead-drop for exfiltrated data.

Cyber Observables — Hunting Hints

Security teams may want to hunt for the following patterns to detect Miasma or similar attacks:

Type
File Name
Value
binding.gyp
Description
The presence of this file in unexpected dependencies, especially those that shouldn't have native modules.
Type
Command Line Pattern
Value
npm install spawning unexpected child processes or making network connections.
Description
Monitor process execution trees during package installation.
Type
Network Traffic Pattern
Value
Outbound connections to github.com or other unexpected domains from CI/CD runners during a build process.
Description
Could indicate data exfiltration.

Detection & Response

  1. Dependency Scanning: Use advanced dependency scanners that inspect not only package.json but also other build-related files like binding.gyp for suspicious commands or scripts.
  2. Behavioral Analysis: In CI/CD environments, use sandboxing and behavioral analysis (D3-DA: Dynamic Analysis) to monitor npm install commands for anomalous activity, such as unexpected file system access or network connections.
  3. Credential Rotation: If a compromise is suspected, immediately revoke and rotate all potentially exposed credentials, including npm tokens, GitHub keys, and cloud service credentials.
  4. Audit Logs: Review CI/CD build logs and developer workstation process logs for any signs of compromise related to recent npm install operations.

Mitigation

  1. Pin Dependencies: Use lockfiles (package-lock.json, yarn.lock) to pin dependencies to specific, vetted versions. This prevents the automatic installation of newly published malicious versions.
  2. Scoped Tokens: Use fine-grained access tokens for CI/CD pipelines. Tokens should have the minimum permissions necessary and be short-lived.
  3. Vet Dependencies: Before adding a new dependency, inspect its health, popularity, and maintainers. Scrutinize its build scripts, including binding.gyp files.
  4. CI/CD Hardening: Implement strict egress filtering on CI/CD runners to block unauthorized outbound network connections, preventing data exfiltration (D3-OTF: Outbound Traffic Filtering).

Timeline of Events

1
June 1, 2026
A variant of Miasma compromises 32 packages within the @redhat-cloud-services npm namespace.
2
June 3, 2026
A new wave of the Miasma worm compromises 57 npm packages across 286 malicious versions in two hours.
3
June 4, 2026
This article was published

MITRE ATT&CK Mitigations

Running build processes in isolated, ephemeral environments can limit the blast radius of a compromised dependency.

Audit

M1047enterprise

Auditing build logs for anomalous behavior, such as unexpected network connections or file system access, can help detect this type of attack.

Using egress filtering to block outbound connections from CI/CD runners to non-essential destinations can prevent data exfiltration.

D3FEND Defensive Countermeasures

Implement dynamic analysis and sandboxing for all CI/CD build processes, specifically for the npm install step. This involves running the package installation in a controlled, instrumented environment that monitors for suspicious behavior like unexpected network calls, file system modifications outside the project directory, or execution of sensitive commands. By establishing a baseline of normal behavior for package installations, you can create alerts for any deviations, which would be indicative of a malicious package like Miasma. This can catch novel threats that signature-based scanners might miss.

Configure strict egress firewall rules for all developer workstations and CI/CD environments. By default, block all outbound traffic and only allow connections to known, trusted endpoints such as your company's official artifact repository, the official npm registry (registry.npmjs.org), and required source code repositories. This 'allowlist' approach would prevent the Miasma worm from successfully exfiltrating stolen credentials to an arbitrary GitHub account like liuende501, rendering the attack far less effective even if the initial execution succeeds.

Deploy EDR agents on developer workstations to monitor for suspicious processes and file access patterns. Specifically, configure rules to detect when a process spawned by npm or node attempts to access sensitive files like ~/.ssh/id_rsa, ~/.aws/credentials, or ~/.kube/config. The Miasma worm's primary goal is to harvest these files. Alerting on any access to these credential stores by a package manager or its child processes can provide an early warning of a compromise and allow for rapid response.

Timeline of Events

1
June 1, 2026

A variant of Miasma compromises 32 packages within the @redhat-cloud-services npm namespace.

2
June 3, 2026

A new wave of the Miasma worm compromises 57 npm packages across 286 malicious versions in two hours.

Sources & References

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

npmMiasmaPhantom GypSupply Chain AttackRed HatCredential TheftWorm

📢 Share This Article

Help others stay informed about cybersecurity threats

🎯 MITRE ATT&CK Mapped

Every tactic, technique, and sub-technique used in this threat has been identified and mapped to the MITRE ATT&CK framework for consistent, actionable threat language.

🧠 Enriched & Analyzed

Observables and indicators of compromise (IOCs) have been extracted and cataloged. Risk has been assessed and correlated with known threat actors and historical campaigns.

🛡️ Actionable Guidance

Detection rules, incident response steps, and D3FEND-aligned mitigation strategies are included so your team can act on this intelligence immediately.

🔗 STIX Visualizer

Structured threat data is packaged as a STIX 2.1 bundle and can be visualized as an interactive graph — relationships between actors, malware, techniques, and indicators.

Sigma Generator

Sigma detection rules are derived from the threat techniques in this article and can be converted for deployment across any major SIEM or EDR platform.