White search icon
News
Cybersecurity

NPM Malware Incident Highlights Risks of Open Source Dependency Management

The axios HTTP client library was compromised, leading to a sophisticated postinstall script that acts as a remote access trojan (RAT). Learn how this attack works and what developers can do to protect themselves.

31-03-2026 |


The axios HTTP client library was compromised, leading to a sophisticated postinstall script that acts as a remote access trojan (RAT). Learn how this attack works and what developers can do to protect themselves.

In an alarming incident that underscores the inherent risks associated with modern software development practices, StepSecurity disclosed details about two malicious versions of axios, a widely used HTTP client library for JavaScript. These compromised packages were published to npm on March 31, 2026, under the names axios@1.14.1 and axios@0.30.4. The attackers managed to bypass normal security measures by using stolen credentials of a lead axios maintainer.

The Compromised Packages

The malicious versions of axios inject an unused dependency, the package named plain-crypto-js@4.2.1, which serves as a vehicle for executing a postinstall script that functions as a cross-platform remote access trojan (RAT). This RAT is designed to target macOS, Windows, and Linux systems.

The postinstall script contacts a live command-and-control server upon execution, delivering platform-specific second-stage payloads. Once the malware has established control over the system, it deletes itself from the node_modules folder and replaces its package.json file with an innocuous version, making forensic detection extremely difficult for developers who might inspect their project files after installation.

Technical Details

The axios versions in question do not contain any malicious code directly. Instead, they leverage a clever trick: the inclusion of plain-crypto-js@4.2.1, which is never used within the axios source itself but serves as an entry point for the postinstall script.

This script's primary function is to act as a dropper that downloads and executes second-stage payloads tailored to each operating system, thereby providing attackers with full control over compromised systems without leaving obvious traces. The stealthy nature of this attack makes it particularly insidious because developers may not realize their systems are under threat until significant damage has been done.

Impact on Developers

The incident highlights the critical importance of maintaining vigilance in software development practices, especially when dealing with open-source libraries. Given that axios is a widely used and trusted library, its compromise serves as a stark reminder to developers about potential vulnerabilities within their dependency management processes.

To mitigate risks, StepSecurity advises pinning to safe versions: axios@1.14.0 (for the 1.x branch) or axios@0.30.3 (for the 0.x branch). Additionally, developers should rotate all secrets and credentials on affected machines immediately and carefully review network logs for any unauthorized connections to known indicators of compromise.

The broader implications extend beyond just axios; this incident serves as a cautionary tale about the need for robust security practices in open-source ecosystems. Developers must remain vigilant against such threats, regularly updating dependencies, and employing comprehensive security measures to protect their systems from potential breaches.

4

An unhandled error has occurred. Reload 🗙

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.