
A highly sophisticated supply chain attack has struck one of the most widely used JavaScript libraries in the world. Two malicious versions of the popular HTTP client axios—1.14.1 and 0.30.4—were published to npm after a maintainer account was hijacked, introducing a stealthy remote access trojan (RAT) affecting macOS, Windows, and Linux systems.
With over 100 million weekly downloads, axios sits at the core of countless applications. This incident represents one of the most precise and operationally advanced attacks ever observed in the npm ecosystem.
Immediate warning
If you installed:
Assume your system is compromised.
How the attack worked
1. Maintainer account hijack
The attacker gained control of a primary axios maintainer’s npm account and used it to publish malicious versions directly to npm—bypassing the project’s secure GitHub Actions release pipeline.
These releases:
- Appeared legitimate (same maintainer identity)
- Had no corresponding GitHub commits or tags
- Were published using a stolen long-lived npm token (not secure OIDC publishing)
2. Pre-staged malicious dependency
The attacker quietly published a package named:
This package:
- Mimicked a legitimate crypto library
- Included no obvious malicious code in its main files
-
Contained a hidden
postinstallscript:“postinstall”: “node setup.js”
This script executed automatically during installation—no import required.
3. Dependency Injection into axios
The compromised axios versions added a single new dependency:
That’s it.
No other files changed. No malicious code inside axios itself.
This is what made the attack so dangerous:
- Static code inspection shows nothing suspicious
- The payload executes during install, not runtime
- The dependency is never actually used in the code
The payload: Cross-platform RAT dropper
Once triggered, the malicious dependency:
- Executes instantly during
npm install - Contacts a live command-and-control (C2) server
- Downloads a platform-specific second-stage payload
- Installs a remote access trojan
- Deletes itself and wipes evidence
Within 2 seconds, the infected system is already beaconing to the attacker.
Anti-forensics: Designed to disappear
This attack didn’t just infect systems—it actively hid itself.
After execution:
- The malware deletes its own files
- Replaces its
package.jsonwith a clean decoy - Spoofs its version to appear harmless (
4.2.0instead of4.2.1)
Result:
npm listshows a safe version- No malicious scripts remain
- Only a leftover directory hints at compromise
Key detection signal:
If node_modules/plain-crypto-js exists at all, the dropper has already executed.
Attack timeline (condensed)
- ~18 hours before attack: Clean decoy package published
- Moments before release: Malicious version deployed
- 00:21 UTC: axios
1.14.1published - 01:00 UTC: axios
0.30.4published - ~03:15 UTC: Both versions removed from npm
- ~04:26 UTC: Malicious dependency replaced with security stub
Total exposure window: ~3 hours
Why this attack is exceptional
This wasn’t opportunistic—it was engineered:
- Pre-staged infrastructure and payloads
- Multi-version targeting (both modern and legacy users)
- Near-zero footprint in source code
- Rapid execution and self-destruction
- Anti-forensic version spoofing
- Bypassing trusted publishing pipelines
Every detail suggests deliberate, high-skill execution.
Detection & discovery
The attack was identified through behavioral monitoring tools that flagged:
- Unexpected outbound network connections
- Calls to a previously unseen domain during CI runs
- Anomalies in dependency trees
Notably, detection did not come from code review—but from runtime behavior analysis.
What you should do
If you may be affected:
- Isolate the system immediately
-
Check for:
node_modules/plain-crypto-js - Assume credentials and secrets are compromised
- Rotate:
- API keys
- SSH keys
- Tokens
- Passwords
- Rebuild systems from clean environments
- Audit logs for suspicious outbound connections
Bigger picture: A supply chain wake-up call
This incident highlights a critical reality:
Modern supply chain attacks no longer rely on visible code changes—they exploit trust, automation, and developer workflows.
Key lessons:
- “No code changes” does not mean “safe”
- Dependencies can execute code without being imported
- Trusted publisher pipelines are essential—but not foolproof
- Behavioral monitoring is now mandatory, not optional
Source: StepSecurity
