NPM Ecosystem Under Siege: Major Supply Chain Attacks Target Axios and Mastra Frameworks

Última actualización: 06/22/2026
  • High-profile libraries like Axios and Mastra were compromised through hijacked maintainer accounts, affecting millions of weekly downloads.
  • Attackers utilized sophisticated postinstall hooks to deliver cross-platform backdoors and steal sensitive credentials from developer environments.
  • Threat actors, including those linked to North Korean groups, are increasingly exploiting the trust in open-source dependencies rather than seeking software flaws.
  • Security experts recommend disabling lifecycle scripts and implementing strict network egress controls to mitigate the impact of poisoned packages.

npm supply chain security analysis

Developers are finding out the hard way that the modern development landscape is increasingly becoming a minefield where a single forgotten password can compromise thousands of projects. The tech world has seen a massive surge in supply chain incidents recently, proving that even the most trusted tools in a developer’s belt can be turned against them in a matter of minutes without anyone noticing until it is far too late.

Current data suggests that we are witnessing a fundamental shift in how hackers operate, as they move away from traditional exploits to focus on supply chain security. By infiltrating the ecosystems of popular platforms like npm, attackers can distribute malicious code to millions of systems simultaneously, turning legitimate software updates into a delivery mechanism for high-level malware and data theft tools.

auditoría de seguridad npm
Related article:
Deep guide to npm security auditing and supply‑chain attacks

The Mastra Ecosystem and the LinkedIn Phishing Trap

malicious code injection in npm packages

In mid-2026, the Mastra framework, widely used for building AI applications, became the victim of a coordinated campaign that began with a sophisticated social engineering attack. A contributor received a deceptive message on LinkedIn, which eventually led to the compromise of their npm publishing token. The attacker wasted no time, publishing over 140 malicious versions of packages under the Mastra namespace, reaching a user base that generates over a million downloads every single week.

What makes this incident particularly sneaky is that the Mastra code itself remained untouched, as the malware was hidden inside a newly added dependency called easy-day-js. This package was a clone of a popular date library, designed to look completely innocent to any developer briefly scanning their dependency tree. By using a floating version range, the attacker ensured that any fresh installation would automatically pull the poisoned version, effectively opening a backdoor into the developer’s workstation or CI/CD runner.

Research groups have noted slight discrepancies in the total number of affected artifacts, with counts ranging from 116 to 145 packages depending on the timing of the analysis. This highlights the volatile nature of these campaigns, where attackers can publish, modify, and delete evidence rapidly, leaving security teams struggling to map out the full extent of the exposure before the tracks are covered.

npm security
Related article:
npm security under pressure: wormable attacks, maintainer phishing, and GitHub’s tightened rules

Axios Hijacked: The plain-crypto-js Connection

npm supply chain protection strategies

The situation grew even grimmer when Axios, a staple HTTP client for JavaScript developers, was hit by a similar account hijacking event. Versions 1.14.1 and 0.30.4 were released with a hidden dependency named plain-crypto-js, which functioned as a cross-platform Remote Access Trojan (RAT). This malware was specifically engineered to inventory systems, establish persistence, and exfiltrate sensitive data from Windows, macOS, and Linux environments alike.

Security analysts from Unit 42 and ESET have linked the Axios compromise to a threat actor known as Sapphire Sleet or UNC1069, a group reportedly associated with North Korean interests. This connection suggests a strong financial motive, as the malware contained specialized modules to discover and target cryptocurrency wallet extensions. It’s a classic case of high-stakes digital espionage hiding in plain sight within the tools we use to build basic web apps.

The technical execution was frighteningly efficient, often completing the full infection cycle in under fifteen seconds. Once the payload was launched, the installer performed an aggressive cleanup, deleting the malicious setup files and replacing the modified manifest with a clean-looking decoy. This level of forensic awareness means that a developer could look at their node_modules folder just minutes after an infection and see absolutely nothing out of the ordinary.

ataque de la cadena de suministro de Shai-Hulud en npm
Related article:
Alerta por el malware Mini Shai-Hulud en npm y el riesgo para la cadena de suministro

Technical Mechanics of the Postinstall Hook

The primary engine for these attacks is the npm postinstall hook, a feature that allows packages to run scripts automatically after installation. While intended for legitimate configuration tasks, it has become a wide-open door for attackers. In both the Mastra and Axios cases, the postinstall script launched an obfuscated loader that disabled TLS certificate verification, allowing the malware to communicate with command-and-control servers without being flagged by standard network inspection tools.

Once the second stage of the malware was fetched, it often spawned as a detached process, meaning the malicious code would continue to run in the background even after the npm installation process had finished. On Windows systems, the malware was observed hijacking legitimate binaries like PowerShell to execute its scripts, while on macOS and Linux, it utilized system-level services to ensure it would survive a reboot, making simple deletion of the package ineffective.

Beyond just stealing crypto, these implants were capable of capturing browser history and searching for cloud provider credentials or SSH keys. For a tech startup, this is a nightmare scenario where a developer’s local environment becomes a gateway for an attacker to move laterally into production servers or private code repositories. It turns out your company’s security might just depend on a complete stranger not having a bad day with their password management.

Hardening the Pipeline Against Future Threats

Standard security tools like npm audit often fail to catch these incidents in their early stages because they rely on known vulnerability databases that can lag behind active malware campaigns. To truly protect an organization, teams must move toward more proactive defenses, such as running installations with the –ignore-scripts flag by default. This simple step prevents the execution of postinstall hooks, which are the primary vector for most npm-based supply chain attacks.

Another critical strategy involves moving to a zero-trust model for dependencies. By using frozen lockfiles and private registries, companies can create a buffer zone where new package versions are analyzed for behavioral anomalies before being allowed into the main build pipeline. Restricting network egress from CI/CD runners to only approved domains can also break the communication chain that malware needs to fetch its secondary payloads or exfiltrate stolen tokens.

Ultimately, the responsibility falls on both maintainers and consumers of open-source software to tighten access controls and implement multi-factor authentication that cannot be bypassed by automation tokens. As the industry moves forward, treating every third-party library as a potential risk rather than a trusted asset is the only way to navigate an era where the supply chain itself has become one of the most effective weapons in a hacker’s arsenal.

ataque a la cadena de suministro de npm de TanStack
Related article:
Ciberataque a la cadena de suministro de npm en TanStack afecta a OpenAI
Related posts: