Armando found that @ctrl/magnet-link v4.0.3, an npm package with 242,999 downloads used to parse and encode magnet links, was backdoored on September 15, 2025 as part of a coordinated worm attack targeting the @ctrl npm namespace. The malicious release adds a worm payload that executes automatically at install time and exfiltrates AWS, GCP, and ECS cloud credentials to an attacker-controlled endpoint.
Key Findings
- Malicious version: v4.0.3, published 2025-09-15; v4.0.2 is clean
- Entry point: postinstall lifecycle hook fires automatically on npm install
- Targets: developer machines and CI/CD pipelines; harvests AWS, GCP, and ECS metadata credentials
- Detection: Script-JS.Worm.SupplyChain, Text.Worm.SupplyChain
Package Background
@ctrl/magnet-link provides magnet link parsing and encoding for JavaScript and TypeScript, first published in 2018. With 242,999 downloads, it is used in torrent and peer-to-peer application development. The malicious v4.0.3 was published at 19:52 UTC on September 15, 2025 -- simultaneously with multiple other @ctrl packages in the same attack wave.
Attack Analysis
Two file changes separate v4.0.3 from the clean v4.0.2: a new bundle.js was added and package.json was modified to add a postinstall hook pointing at it. On npm install, Node.js executes bundle.js automatically with no user interaction.
The bundle.js payload -- SHA256 46faab8ab153fae6e80e7cca38eab363075bb524edd79e42269217a083628f09 -- is the same worm payload Armando identified across the entire @ctrl wave published on September 15, 2025. It is a 3.5 MB minified JavaScript bundle embedding the AWS SDK v3, Octokit GitHub API client, and credential harvesting routines targeting AWS IMDS (169.254.169.254), GCP Metadata server (metadata.google.internal), and AWS ECS Task Metadata endpoint (169.254.170.2). Collected credentials are exfiltrated to https://webhook.site/bb8ca5f6-4175-45d2-b042-fc9ebb8170b7. The bundled npm registry client enables worm self-propagation to other packages.
Malicious Files
bundle.js is the worm payload added in v4.0.3. Its SHA256 matches the payload found across all known @ctrl packages in the September 15, 2025 attack wave, confirming shared attacker infrastructure. It harvests cloud credentials from metadata endpoints and environment variables and exfiltrates to https://webhook.site/bb8ca5f6-4175-45d2-b042-fc9ebb8170b7.