MathMain npm Supply Chain Attack

discovered 2026-09-18

Multi-incident, multi-identity npm supply chain operation running an environmentally-keyed AES-256-GCM remote access loader inside mathjs clones and other math/matrix/events/mutex/btree/graph utility packages. The payload decrypts only when a caller runs the package's lusolve() solver on the trigger matrix [[1,1,1],[1,2,3],[1,3,6]], whose LU lower factor JSON [[1,0,0],[1,1,0],[1,0.5,1]] is the decryption password; there is no install hook and a plain require never reaches the loader. SafeDep independently analyzed and confirmed the loader in [email protected], [email protected], and [email protected]/1.0.1/1.0.2 with full hashes. Deployment A (mathmain + math-universe) uses a Base Sepolia contract 0xac0bfC4C48A679b667732128278EACBA1c191894; Deployment B ([email protected]) uses an Ethereum Sepolia contract 0xE390863Dac96a7118C71227C2b099B50cF602D31; both share Alchemy project key D2-TbkB2m05WXSnSDOCDI. The multi-stage implant does os/fs recon, generates an X25519 keypair, reads the smart contract via bundled ethers 5.7.2 over public Infura/Alchemy RPC for operator tasking, and runs a Slack agent (conversations.history polling, operator-gated, 140-char chunked file transfer, Slack Workspace B bot token prefix xoxb-11307403103236-11289767127959-...) plus a Telegram channel, ultimately writing and running lib/cjs/utils/subwatcher and marking LICENSE with 'REDISTRIBUTION REQUIRES INCLUSION OF THIS LICENSE.'. The wider operation (about 24 npm packages, 14 smart-contract C2 endpoints, Slack/Telegram infrastructure, throwaway npm/GitHub identities, and a 30-repo GitHub-Actions download-count inflation worker farm over roughly six months) is tracked by external campaign research as 'Equation of Compromise' and is included here for coverage but is reported, not independently verified by SafeDep. Unattributed actor.

Objective

Deliver an operator-controlled remote access implant to quantitative/DeFi developers via trojanized math/utility npm packages, gated behind an environmental key so only the intended caller workflow activates it. Victim scope unknown; no operator-delivered later-stage code recovered.

Packages

Indicators

Techniques

Read the full analysis →