Axios NPM Attack: Check Systems, Rotate Secrets Now
Axios 1.14.1 & 0.30.4 compromised via fake crypto-js dep with post-install RAT stealing credentials; run OS-specific checks, rotate all secrets/API keys, use pnpm/bun min release age for prevention.
Compromise Mechanics: Maintainer Account Hijack Enables Rapid Poisoning
Attackers compromised a maintainer's NPM account to publish axios 1.14.1 and 0.30.4, affecting 80M+ weekly downloads. They added a malicious dependency, plain-crypto-js (created 18 hours prior), whose sole purpose was a post-install script. This script downloads an obfuscated (Base64-encoded) remote access trojan (RAT) tailored for macOS, Windows, and Linux, exfiltrating credentials, API keys, and crypto tokens from dev machines, PCs, or VPS. The poisoning spanned 39 minutes starting midnight UTC, bypassing expected Trusted Publishing safeguards on the 1.x branch (no GitHub commit/tag found; possibly via long-lived NPM token). Similar to Shai Hulud (multiple NPM pkgs) and Lite-LLM (Python), attacks exploit post-install scripts auto-executing on npm/bun install/update, not runtime in apps/websites.
Rising frequency ties to AI-driven code explosion (GitHub repos at all-time high), lowering attacker skill barriers for malicious code gen, overwhelming maintainers, and expanding surfaces via AI tools like Claude/Copilot installing deps.
Detection: Run These Commands to Confirm Infection
Follow StepSecurity's guide: execute OS-specific scans to detect RAT artifacts.
- macOS/Linux:
curl -s https://gist.githubusercontent.com/maximilian-schwarzmuller/... | bash(or equivalent from linked report). - Windows: PowerShell script variant.
Positive hit? Assume total compromise: rotate ALL passwords, disable/revoke API keys (OpenAI, etc.), credentials from .env/dotenv files, system tokens. Thousands to tens of thousands likely affected given download volume peaks.
Defenses: Layer Package Managers, Secrets, and Isolation
Block Fresh Poisons: Switch to pnpm (add min-release-age=3d in pnpm-workspace.yaml) or bun (minInstallAge=3d in bunfig.toml)—rejects versions <3 days old, dodging short-lived attacks (most caught in hours). NPM lacks this natively.
Secure Secrets: Avoid plaintext .env; use Doppler (or self-hosted alt) to inject encrypted env vars at runtime, denying RATs local access.
Minimize Blast Radius: Develop in isolated VPS (SSH access) or Docker containers—limits trojan to sandbox, preventing full-system credential grabs.
No 100% fix (even Trusted Publishing failed here), but multi-layer reduces risk as attacks proliferate.