Armando found a self-propagating npm worm in @things-factory/attachment-base v9.0.52, published 2025-09-16. The malicious version adds a postinstall lifecycle hook to the package manifest, executing a webpack bundle at npm install time. That bundle collects GitHub personal access tokens, AWS cloud credentials from the Instance Metadata Service and Security Token Service, GCP service account credentials from the metadata endpoint, and secrets found by the bundled Truffle scanner -- then exfiltrates them to a webhook.site endpoint controlled by the attacker. The same bundle republishes infected packages to the npm registry, propagating the worm further. The @things-factory/attachment-base package, a server-side file upload utility maintained by the Hatiolab organization since August 2019, has 447,836 total downloads and 34 direct dependents.
Key Findings
- Malicious version: v9.0.52, published 2025-09-16; v9.0.41 is clean
- Entry point: postinstall lifecycle hook fires automatically on npm install
- Targets: developer machines and CI/CD pipelines running Node.js -- harvests AWS, GCP, and GitHub credentials
- Detection: Script-JS.Worm.SupplyChain, Text.Worm.SupplyChain, Archive-GZIP.Worm.SupplyChain, Archive-TAR.Worm.SupplyChain
Package Background
@things-factory/attachment-base is a server-side Node.js module for handling file upload attachments, supporting both Amazon S3 and local folder storage. It is part of the things-factory ecosystem published by Hatiolab, a software organization that has maintained the package since August 13, 2019. Across more than 1,031 published versions, the package has accumulated 447,836 downloads and 34 direct dependents. Its long history of active maintenance and broad use across the things-factory project ecosystem made it an effective vehicle for a supply chain attack: any project that ran npm install while this version was current was silently compromised.
Attack Analysis
The attack follows a two-step model. First, the attacker modified the package manifest (package.json) to add a postinstall script entry pointing to bundle.js, a file absent from the clean v9.0.41. Second, a webpack bundle was added as bundle.js. This bundle executes automatically when any developer or CI/CD pipeline installs the package.
The bundle is a self-contained credential harvester and worm engine. It imports dedicated modules for operating system enumeration, GitHub API interaction, AWS credential collection, Google Cloud Platform credential collection, Truffle secret scanning, and npm registry publishing. A main() function orchestrates the full attack chain on execution.