An npm worm describes a self-propagating campaign that exploits the npm (Node Package Manager) registry. These campaigns distribute a large volume of fake or deceptive software packages, often through automated means, to flood the registry. The term ‘worm’ highlights their self-propagating nature, designed to proliferate and obscure legitimate packages within the software supply chain. These financially motivated campaigns can persist for extended periods, sometimes years, systematically publishing junk packages.
How npm Worms Operate
npm worms typically operate through several key mechanisms, often using automation and deceptive tactics:
- Automated Package Publication: Threat actors use automated scripts and tools to rapidly create and publish a vast number of packages to the npm registry. This automation allows them to reach the scale seen in such campaigns, enabling the publication of tens of thousands of packages.
- Deceptive Naming Schemes: Attackers often give packages consistent, thematic, or misleading names to appear legitimate or to bypass immediate detection. These naming patterns can mimic popular libraries or frameworks or use unrelated themes to avoid suspicion.
- Self-Propagating Mechanism: These packages frequently contain scripts, often JavaScript files (e.g.,
auto.jsorpublishScript.js), that, once a user manually executes them (e.g.,node auto.js), create and publish more fake packages. This action extends the ‘worm’ across the registry. These scripts typically require manual activation rather than automatic execution upon installation. - Diverse Payloads: The immediate goal of npm worms varies. Some aim purely for spam or disruption, inundating the registry with noise. Others might carry more malicious payloads, such as malware, credential stealers, or backdoors, which attackers then conceal within the flood of deceptive packages. This tactic often prepares the ground for more sophisticated software supply chain attacks.
- Coordinated Effort: These campaigns are often sustained and coordinated. They involve a network of npm accounts specifically created for deploying these packages rather than compromised legitimate accounts.
The “IndonesianFoods” npm Worm Example
The “IndonesianFoods” npm worm is a prominent example of a large-scale spam campaign. Since early 2024, it has flooded the npm registry with over 67,579 fake packages, according to security researcher Paul McCarty. Researchers observed this coordinated effort staging for over two years. The packages often masqueraded as Next.js projects and consistently used Indonesian names and food terms, a characteristic Endor Labs noted in analyses like “The Great Indonesian TEA Theft: Analyzing a NPM Spam Campaign.” A small network of over a dozen npm accounts supported the campaign. The ‘worm’ component, typically a JavaScript file within each package, required manual execution (e.g., node auto.js) to propagate the campaign. While primarily a spam operation aimed at overwhelming the registry, this campaign highlighted a significant vulnerability: a high volume of deceptive packages could obscure genuine components and erode trust in the software supply chain, potentially paving the way for more severe attacks.
Why npm Worms Matter for Software Supply Chain Security
Understanding npm worms is critical for the integrity and security of the software supply chain:
- Erosion of Trust and Developer Productivity: The proliferation of fake packages makes it challenging for developers to identify and select legitimate, secure components. This wastes time vetting packages, and developers risk security if they adopt deceptive packages.
- Increased Attack Surface: The sheer volume of packages, even those initially designed for spam, expands the overall attack surface within the npm ecosystem. This creates more opportunities for vulnerabilities or future exploitation as malicious actors hide their true intentions within the noise.
- Concealment for Malicious Activity: A cluttered registry can act as a smokescreen, allowing truly malicious packages (carrying malware, credential stealers, or backdoors) to hide among the spam. This makes detection significantly more difficult for both automated tools and human reviewers.
- Facilitation of Software Supply Chain Attacks: By undermining the integrity of package managers like npm, these worms can pave the way for more severe software supply chain attacks. Attackers can leverage the confusion and reduced trust to inject malicious code into widely used software components, impacting a broad range of applications and users.
To mitigate risks posed by deceptive and malicious packages within public registries, developers and organizations should:
- Prioritize vigilant package vetting.
- Employ automated security scanning.
- Stay informed about emerging threats.

