AiTM Phishing To Self-Replicating Worms: Inside The 2025 Npm Attacks
Christophe Tafani-Dereeper (Cloud Security Researcher · Datadog)
Insomni'hack 2026 · Day 1 · Main Track
Overview
Software supply chain security has undergone a radical and dangerous evolution. While malicious packages have long plagued public repositories, 2025 marked a watershed moment characterized by sophisticated adversary-in-the-middle (AiTM) phishing campaigns targeting legitimate maintainers, followed by the emergence of fully autonomous, self-replicating NPM worms. In this talk, Christophe Tafani-Dereeper, a cloud security researcher at Datadog, examines how threat actors transitioned from simply uploading rogue packages to actively hijacking trusted developer accounts, backdooring high-profile libraries, and deploying worms that leverage native developer infrastructure as command-and-control and propagation mechanisms.

Key moments
- 0:00 Introduction and historical context of worms
- 2:00 Overview of the scale of NPM ecosystem
- 5:57 Analysis of phishing attacks and compromised packages
- 9:59 Attacker playbook and introduction to NPM worms
- 14:02 Shay Hulud 2.0 and new persistence mechanisms
- 18:02 Send Worm, MCP persistence, and polymorphism
- 22:00 Defense strategies and security best practices for NPM
- 27:58 The role of AI and LLMs in supply chain attacks
AiTM Phishing To Self-Replicating Worms: Inside The 2025 Npm Attacks
Speakers: Christophe Tafani-Dereeper (Cloud Security Researcher, Datadog)
Conference: Insomni'hack
YouTube: https://www.youtube.com/watch?v=_3ULyoUQ4dA
Overview
Software supply chain security has undergone a radical and dangerous evolution. While malicious packages have long plagued public repositories, 2025 marked a watershed moment characterized by sophisticated adversary-in-the-middle (AiTM) phishing campaigns targeting legitimate maintainers, followed by the emergence of fully autonomous, self-replicating NPM worms. In this talk, Christophe Tafani-Dereeper, a cloud security researcher at Datadog, examines how threat actors transitioned from simply uploading rogue packages to actively hijacking trusted developer accounts, backdooring high-profile libraries, and deploying worms that leverage native developer infrastructure as command-and-control and propagation mechanisms.
The implications of these attacks extend far beyond isolated compromises. With nearly 4 million packages and hundreds of billions of downloads, the Node Package Manager ecosystem represents a high-leverage attack surface. When a single compromised legitimate package can reach millions of developers and downstream applications within hours, traditional signature-based detection and perimeter security fall short. This technical breakdown explores the mechanics behind these campaigns, the anatomy of modern NPM worms like Shai-Hulud and Send Worm, and actionable strategies for defenders to harden their development pipelines.
Background
▶ Watch: Introduction and historical context of worms (0:00)
The NPM registry, established in 2010, has scaled massively to encompass nearly 4 million packages and billions of weekly downloads. Historically, threats on the platform were dominated by typosquatting or low-impact malicious packages—novice attempts to exfiltrate environment variables, as seen with the 2017 cross-env incident. However, malicious actors quickly realized that publishing obscure packages yields little return. The real leverage lies in compromising legitimate packages maintained by trusted developers.
Targeting maintainers is economically and strategically efficient. Developer email addresses are publicly exposed via registry endpoints (e.g., registry.npmjs.org/express), enabling automated, large-scale phishing operations. Cybercriminal forums routinely trade access credentials for platforms like NPM, PyPI, and RubyGems, as well as access via remote access trojans (RATs) embedded in popular developer tools.
Prior to 2025, session hijacking via phishing was constrained by basic multi-factor authentication (MFA). However, the widespread adoption of AiTM phishing kits—originally popularized by tools like EvilGinx—allows attackers to proxy authentication flows in real-time, capturing session cookies and 2FA tokens seamlessly. This capability set the stage for a dramatic surge in account takeovers throughout 2025, ultimately culminating in self-propagating supply chain worms.
Key Findings
▶ Watch: Analysis of phishing attacks and compromised packages (5:57)
Tafani-Dereeper highlighted several critical findings regarding the 2025 threat landscape:
- AiTM Phishing Dominance: Attackers successfully utilized targeted phishing domains (such as
npmjs.helpand variations using TLDs like.com.wtf) equipped with AiTM proxies to bypass standard MFA and harvest active session tokens from NPM maintainers. - Widespread Maintainer Compromise: Multiple high-profile maintainers fell victim, resulting in backdoored versions of widely used libraries. For instance, a compromised cryptocurrency-related library was modified to hook JavaScript
fetchandXMLHttpRequestfunctions, as well aswindow.ethereum, quietly swapping cryptocurrency wallet addresses to redirect funds to the attacker. - The Speed of Propagation: Datadog's research across enterprise organizations revealed that 50% of organizations adopt library versions released on the very same day, enabling backdoors to sweep through enterprise codebases almost instantaneously.
- Rise of Self-Replicating NPM Worms: The introduction of worms like Shai-Hulud and Send Worm demonstrated that malware could autonomously harvest local credentials, abuse GitHub repositories for exfiltration, and programmatically publish backdoored updates to every package an infected maintainer controls.
Technical Deep Dive
▶ Watch: Shay Hulud 2.0 and new persistence mechanisms (14:02)
The technical architecture of modern NPM supply chain attacks combines credential theft, automated API abuse, and novel persistence mechanisms.
The Maintainer Account Takeover Playbook
Once an attacker uses an AiTM phishing kit to capture a maintainer's session cookie, they immediately establish persistence by generating a new, long-lived NPM API token. They then query the NPM API to enumerate all packages owned by the maintainer—whether personal packages or organizational projects. For each target package, the attacker injects a malicious payload, typically wrapped in a bundle.js file triggered via postinstall scripts in package.json, before bumping the minor semver version and publishing the update.
Anatomy of the Shai-Hulud Worm
Shai-Hulud represents a massive escalation in automation. Upon execution on an infected developer machine, the worm operates in distinct phases:
- Credential Harvesting: It executes TruffleHog, a legitimate blue-team secrets-scanning tool, alongside custom routines to scrape environment variables, cloud credentials, and local configuration files.
- GitHub Exfiltration & Sabotage: Rather than using a standard C2 server, the worm uses the victim's GitHub token to create a new public repository containing the stolen credentials. It simultaneously iterates through the victim's first 20 private repositories, flipping their visibility to public and modifying their descriptions to aid attacker scraping.
- Self-Propagation: The worm hunts for NPM tokens in local
.npmrcfiles and environment variables, authenticates to the NPM registry, and programmatically backdoors every package the maintainer controls.
Shai-Hulud 2.0 introduced even more aggressive capabilities, including scraping cloud secrets managers (GCP, AWS, and Azure Key Vault), stealing browser cookies, and leveraging stolen GitHub tokens from other victims to exfiltrate data. Most notably, it achieved persistence by enrolling the infected machine as a GitHub Actions self-hosted runner, deploying malicious workflows that created a native, firewall-bypassing command-and-control channel over GitHub infrastructure.
Send Worm and Advanced Evasion
Discovered in early 2025, Send Worm introduced advanced multi-stage encryption and novel persistence vectors:
- Model Context Protocol (MCP) Poisoning: It injects local MCP server configurations into developer environments (supporting tools like Claude Code, Cursor, and Windsurf). It registers malicious MCP tools (
index_project,lint_check,scan_dependencies) containing prompt injection payloads designed to trick AI assistants into exfiltrating SSH keys and credentials. - Git Hook Infiltration: It installs malicious Git hooks across all repositories in the user's home directory and modifies global Git templates, ensuring that every future commit and push automatically injects malicious dependencies and exfiltrates NPM tokens.
- Advanced Capabilities: Send Worm incorporates a Domain Generation Algorithm (DGA) for resilient C2 communications, DNS-based exfiltration fallbacks, and support for local LLMs (via Ollama or LM Studio running models like DeepSeek) to achieve polymorphism—dynamically rewriting its own code structure, variable names, and control flows to evade static analysis.
Demo / Proof of Concept
▶ Watch: Send Worm, MCP persistence, and polymorphism (18:02)
No live proof-of-concept demonstration was executed during this conference session; the speaker relied instead on code diffs, architectural diagrams, and empirical data sets.
Defensive Implications
▶ Watch: The role of AI and LLMs in supply chain attacks (27:58)
Defending against automated supply chain worms and AiTM account takeovers requires a defense-in-depth strategy split between maintainers and consumers.
For Maintainers
- Phishing-Resistant MFA: Hardware security keys like YubiKeys cryptographically bind authentication to the legitimate origin hostname, completely neutralizing AiTM session-hijacking proxies.
- NPM Trusted Publishing: Maintainers should migrate away from long-lived static tokens in CI/CD pipelines. By integrating OpenID Connect (OIDC) tokens from platforms like GitHub Actions, CircleCI, or GitLab, CI runners can exchange short-lived, single-purpose JWTs directly with NPM for automated publishing.
For Consumers and Organizations
- Strict Package Manager Policies: Utilize package managers like PNPM, which enforces a minimum release age parameter (delaying updates for transitive dependencies by a set time window to allow community detection of compromises) and disables automatic code execution by default.
- Supply Chain Firewalls: Implement tools like Datadog's open-source supply chain firewall, a transparent wrapper around package managers that blocks known malicious packages using IOC lookups against databases like OSV.dev with zero false positives.
- Disable Lifecycle Scripts: Prevent arbitrary code execution during installation by disabling
preinstall,install, andpostinstallscripts where feasible (npm config set ignore-scripts true). - Software Bill of Materials (SBOM): Generate and maintain SBOMs (using tools like Sift) for all software releases to rapidly audit dependency trees during an incident response.
Key Takeaways
- Account Takeover is Industrialized: AiTM phishing kits allow attackers to bypass standard MFA and capture session tokens, transforming single maintainer compromises into widespread ecosystem threats.
- Worms Leverage Native Infra: Modern NPM worms like Shai-Hulud and Send Worm weaponize legitimate developer tools—abusing GitHub Actions self-hosted runners, Git hooks, and AI Model Context Protocol (MCP) servers for persistence and C2.
- Velocity is the Enemy: With 50% of organizations adopting new library versions on their release day, automated backdoors can propagate through enterprise software supply chains in mere hours.
- AI Lowers the Barrier: Attackers leverage un-safety-tuned local LLMs (or compromised open-source models) to generate malware, build self-replicating logic, and implement polymorphic code evasion.
- Proactive Defenses are Essential: Organizations must adopt supply chain firewalls, enforce minimum package release ages, disable installation lifecycle scripts, and transition maintainers to hardware security keys and trusted publishing.
About the Speaker(s)
- Christophe Tafani-Dereeper (Cloud Security Researcher, Datadog): Christophe is based in Switzerland and works on cloud security research and open source at Datadog, having previously worked as a software developer, penetration tester, and cloud security engineer. He is the maintainer of several open-source projects including Stratus Red Team, Adaz, and the Managed Kubernetes Auditing Toolkit (MKAT), and has spoken at DEF CON and KubeCon.