Axios npm Supply Chain Attack
On 31st March 2026, two malicious versions of the axios HTTP client library were published to the npm registry: [email protected] and [email protected]. Axios has in excess of 83 million weekly downloads, making it one of the most widely used packages in the JavaScript ecosystem.
This article covers the attack, what it does, how to determine whether your environment is affected, and how to scan container images at scale, including images stored as tar archives.
The Attack
The malicious versions were published using the compromised npm credentials of the lead axios maintainer. The attacker changed the account email to an anonymous ProtonMail address and published both versions directly via the npm CLI, bypassing the project's normal GitHub Actions pipeline entirely.
Both versions inject a new dependency [email protected] which is not referenced anywhere in the legitimate axios source. Its sole purpose is to execute a postinstall script that acts as a cross-platform RAT dropper, targeting macOS, Windows, and Linux. After execution, the malware deletes itself and replaces its own package.json with a clean copy to hinder detection efforts and forensic analysis.
A clean decoy version ([email protected]) was published approximately 18 hours prior to avoid triggering "brand-new package" alerts from security scanners. Both malicious axios versions were published within 39 minutes of each other.
Socket's automated detection flagged the malicious package within six minutes of publication. Both versions have since been removed from the npm registry.
Does This Affect Browser/CDN Usage?
The attack relies entirely on npm's postinstall lifecycle hook which is a Node.js-specific mechanism that executes shell commands on the installing machine. If you are loading axios via a CDN such as unpkg, none of this executes. The browser fetches the JavaScript bundle directly so the lifecycle scripts never run.
Based on current analysis, the malicious code resided within the plain-crypto-js dependency, not within the axios bundle itself. End users loading axios via https://unpkg.com/[email protected]/dist/axios.min.js are not at risk from this specific attack.
The target was developer machines and CI/CD pipelines and not end users.
Indicators of Compromise
[email protected] or [email protected] in node_modules
Vulnerable version installed
plain-crypto-js directory present anywhere on disk
Strong IOC - no legitimate use case
package-lock.json resolving axios to 1.14.1 or 0.30.4
Malicious version was pulled during npm install
Outbound connections to sfrclak[.]com
C2 contact - assume active compromise
The removal of the package from the npm registry means npm audit and most vulnerability scanners will not flag this. The CVE has not yet landed in databases such as Trivy's at time of writing. Manual inspection is currently the most reliable detection method.
Immediate Remediation
Pin axios to a known safe version:
If plain-crypto-js is found on any system, treat it as fully compromised. Rotate all secrets, API keys, and credentials accessible from that environment. Review outbound network connections for contact with sfrclak[.]com.
CI/CD pipelines that ran during the window the packages were live (approximately 23:59β02:00 UTC, 31st March) warrant particular attention, as any secrets present in those environments may have been exfiltrated.
Scanning Docker Images
Given the npm registry removal, tooling which relies on a vulnerability database may not detect this. The following approaches work regardless of database state.
Locally Running Images (via Docker Socket)
The following script iterates all locally available Docker images, scanning each for the vulnerable axios versions and the plain-crypto-js IOC.
Scanning Image Tar Archives (OCI Format)
Images exported via docker save or pulled from a registry in OCI format follow this structure:
Each layer blob is itself a tar archive containing the filesystem for that layer. The script below handles this two-level structure which extracts the outer tar, identify layer blobs using file, then streams package.json contents directly from each layer without secondary extraction to disk.
Run it against any OCI image tar:
Using Trivy
Trivy can scan image tars directly without requiring Docker to be running, which avoids socket permission issues:
As noted, the CVE is unlikely to be in Trivy's database yet. To inspect package versions regardless of database state, use the JSON output:
For use in a pipeline where you need an exit code:
Trivy also supports generating a full SBOM, which provides a complete package inventory independent of any vulnerability database:
Output from Trivy Script
Output from Trivy (scanning Docker socket directly)
Summary
The npm registry removal creates a false sense of safety. Standard tooling will not flag this. If your environment runs Node.js-based containers, or your CI/CD pipeline installs npm packages, manual inspection using the methods above is currently the most reliable approach.
The presence of plain-crypto-js anywhere on disk, in any layer of any image, should be treated as a confirmed compromise regardless of the axios version reported.
If you need a test image to validate your detection logic, feel free to reach out (contact details on contact page).
References / IOCs / Further Reading
https://www.wiz.io/blog/axios-npm-compromised-in-supply-chain-attack https://www.aikido.dev/blog/axios-npm-compromised-maintainer-hijacked-rat https://thehackernews.com/2026/03/axios-supply-chain-attack-pushes-cross.html https://www.stepsecurity.io/blog/axios-compromised-on-npm-malicious-versions-drop-remote-access-trojan
Last updated