The open-source ecosystem just experienced one of the most sophisticated supply chain attacks in recent memory. On March 31, 2026, axios—arguably the most popular HTTP client for JavaScript with over 100 million weekly downloads—was temporarily hijacked on the NPM registry.
If your team ran npm install during a specific three-hour window, your local machines and CI/CD pipelines might be compromised. Here is a breakdown of how the attack worked, the malicious payloads involved, and how to protect your infrastructure.
The Attack Vector: Hijacking the Maintainer
The attack didn't exploit a vulnerability in the Axios source code itself. Instead, threat actors (suspected to be a state-sponsored group known as UNC1069) compromised the NPM account of the project's lead maintainer.
Using a stolen long-lived NPM access token, the attackers bypassed GitHub Actions' OIDC Trusted Publisher safeguards and manually published two poisoned versions of the library directly to the NPM registry:
axios@1.14.1(Targeting the modernlatesttag)axios@0.30.4(Targeting the legacy0.xbranch)
Because the push happened directly to NPM, the malicious code never appeared in the official GitHub repository, completely evading diff-based security analysis.
The "Phantom Dependency" Method
The attackers were careful not to modify the Axios codebase. Instead, they added a single, hidden "phantom dependency" to the package.json file called plain-crypto-js.
To avoid triggering "new package" security alarms, the attackers had published a clean, decoy version of plain-crypto-js 18 hours prior. Right before the attack went live, they updated it to contain a malicious postinstall hook.
When an unsuspecting developer or automated CI/CD pipeline ran npm install, NPM automatically downloaded plain-crypto-js and executed an obfuscated JavaScript dropper (setup.js) in the background.
The Payload: A Cross-Platform RAT
Once triggered, the dropper detected the host's operating system and deployed a tailored Remote Access Trojan (RAT) for macOS, Windows, or Linux.
The malware's capabilities included:
- Credential Theft: Instantly sweeping environment variables, AWS/GCP cloud access keys, database passwords, and API tokens.
- System Fingerprinting: Identifying hostnames, architectures, and running processes.
- Persistence: On Windows, it established reboot survival by modifying registry Run keys.
- Anti-Forensics: The
setup.jsscript was designed to delete itself and overwrite its own package manifest with a clean file immediately after execution, making post-infection detection incredibly difficult.
Are You Affected?
The poisoned packages were live on NPM for approximately three hours (roughly between 00:21 and 03:29 UTC on March 31, 2026) before the NPM security team detected and removed them.
You are NOT affected if:
- Your lockfile pinned Axios to version
1.14.0or older. - You use a corporate proxy that caches known-good versions.
- Your environment restricts
postinstallscripts (npm install --ignore-scripts).
You MAY BE affected if:
You use caret ranges (e.g., "axios": "^1.1x.x") without locked dependencies, and a build triggered or a developer ran an install during that three-hour window.
Immediate Remediation Steps
If you suspect exposure, treating the environment as fully compromised is the only safe path forward.
- Check Lockfiles: Search your
package-lock.json,yarn.lock, orbun.lockfor references toaxios@1.14.1,axios@0.30.4, orplain-crypto-js. - Downgrade & Pin: Immediately downgrade Axios to
1.14.0(or0.30.3for legacy) and explicitly pin the version. - Rotate Secrets: Assume all environment variables and local credentials on the affected machine (or CI pipeline) have been exfiltrated. Rotate AWS tokens, database credentials, SSH keys, and NPM publishing tokens immediately.
- Clear Caches: Run
npm cache clean --forceto ensure the malicious package isn't lingering locally.
Lessons for the Ecosystem
The 2026 Axios hack proves that the attack surface of modern applications isn't just your code—it's your vendor's vendor's vendor. As full-stack developers, we must prioritize strict dependency pinning, enforce lockfile integrity (npm ci over npm install in pipelines), and routinely audit our dependency trees. Convenience cannot come at the cost of security.
