# How we caught the Axios supply chain attack

Attackers hijacked an axios maintainer's npm account and published malicious versions adding a phantom dependency whose postinstall hook deployed cross-platform malware.

- Payout: Real-world hack
- Severity: critical
- Program: Axios
- Analysis by: Joe Desimone
- Disclosed: 2026-04-02
- Write-up quality: 6/10
- Original: https://www.elastic.co/security-labs/threat-command/how-we-caught-the-axios-supply-chain-attack
- Library page: https://bugbountylibrary.com/r/blog%3Aelastic-co-security-labs-threat-command-how-we-caught-the-axios-supply-chain-attack
- Tags: area:oss domain:oss impact:data-leak impact:rce kind:incident platform:threat-intel sev:critical tech:nodejs technique:chained technique:source-review vuln:secrets-leak

**Target:** npm package (axios) and its postinstall dependency
**Root cause:** A maintainer's npm account was compromised (email swapped to an attacker-controlled ProtonMail), letting attackers publish two malicious axios versions (1.14.1, 0.30.4) that added a phantom dependency, plain-crypto-js, whose postinstall hook deployed cross-platform malware.
**Steps:**
1. Compromise a maintainer's npm account and change its email to an attacker-controlled ProtonMail address
2. Publish malicious axios versions `1.14.1` and `0.30.4` without injecting code directly into axios
3. Add a phantom dependency `plain-crypto-js` to package.json
4. On install, the dependency's `postinstall` hook runs and deploys cross-platform malware
5. Malware beacons to a hardcoded C2 (which was overwhelmed by request volume)
**How found:** Desimone built a monitor polling npm's CouchDB _changes feed and PyPI changelog for top-15k packages, diffed old vs new versions without executing them, and sent diffs to an LLM (Cursor Composer 2, read-only) prompted to flag obfuscation, base64, exec/eval, unexpected network calls, steganography, persistence and lifecycle-script abuse; a Slack alert flagged axios 0.30.4 as MALICIOUS.
**Exploitation:** Anyone installing the malicious axios versions triggered the plain-crypto-js postinstall hook, which dropped cross-platform malware and beaconed to the attacker C2; Elastic Defend alerts fired on an infected host and telemetry showed impacted orgs in the wild before npm pulled the packages.
**Escalation:** Part of a broader campaign: credentials stolen from the Trivy GitHub Action compromise were reused against LiteLLM and Telnyx before the axios account takeover; presumed DPRK attribution.
**Insight:** Diff registry releases without installing them and have an LLM review the diff for lifecycle-script and phantom-dependency additions — a new dependency appearing in package.json with a postinstall hook is a high-signal supply-chain indicator even when the main package code is untouched.

## Proof of concept (copied exactly from the original report)

**Slack alert for malicious axios 0.30.4**

```
🚨 Supply Chain Alert: axios 0.30.4
Verdict: MALICIOUS
npm: https://www.npmjs.com/package/axios/v/0.30.4
```

**Commands to enforce package soak time**

```
npm config set min-release-age 7
pnpm config set minimum-release-age 10080
yarn config set npmMinimumReleaseAge 10080
uv --exclude-newer "7 days ago"
```

