Skip to main content
COSMICBYTEZLABS
NewsSecurityHOWTOsToolsStudyTraining
ProjectsChecklistsAI RankingsNewsletterStatusTagsAbout
Subscribe

Press Enter to search or Esc to close

News
Security
HOWTOs
Tools
Study
Training
Projects
Checklists
AI Rankings
Newsletter
Status
Tags
About
RSS Feed
Reading List
Subscribe

Stay in the Loop

Get the latest security alerts, tutorials, and tech insights delivered to your inbox.

Subscribe NowFree forever. No spam.
COSMICBYTEZLABS

Your trusted source for IT intelligence, cybersecurity insights, and hands-on technical guides.

744+ Articles
120+ Guides

CONTENT

  • Latest News
  • Security Alerts
  • HOWTOs
  • Projects
  • Exam Prep

RESOURCES

  • Search
  • Browse Tags
  • Newsletter Archive
  • Reading List
  • RSS Feed

COMPANY

  • About Us
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CosmicBytez Labs. All rights reserved.

System Status: Operational
  1. Home
  2. News
  3. New npm Supply Chain Attack Self-Spreads to Steal Developer Auth Tokens
New npm Supply Chain Attack Self-Spreads to Steal Developer Auth Tokens
NEWS

New npm Supply Chain Attack Self-Spreads to Steal Developer Auth Tokens

A newly discovered supply chain attack targeting the npm ecosystem steals developer authentication tokens and uses compromised accounts to publish infected packages, creating a self-spreading worm that propagates through the JavaScript ecosystem.

Dylan H.

News Desk

April 22, 2026
4 min read

A Self-Spreading npm Worm Is Stealing Developer Credentials

Security researchers have uncovered a new supply chain attack targeting the npm (Node Package Manager) ecosystem that goes beyond a typical package compromise. Unlike most npm malware campaigns that rely on a single poisoned package to spread, this attack features a self-spreading mechanism — once a developer installs an infected package, the malware attempts to steal their npm authentication tokens and use those credentials to publish new infected versions of other packages the victim maintains.

The result is a worm-like propagation model that can spread laterally through the npm registry, potentially compromising hundreds or thousands of packages before being detected and removed.

How the Attack Works

The attack chain combines credential theft with autonomous propagation:

StageDescription
Initial InfectionDeveloper installs a malicious or compromised package
Token HarvestingMalware locates and exfiltrates npm auth tokens from ~/.npmrc
Account TakeoverStolen tokens are used to authenticate as the victim developer
PropagationMalware publishes malicious updates to packages the victim maintains
PersistenceEach new infected package extends the campaign's reach

The attack is particularly effective because npm authentication tokens stored in ~/.npmrc typically have broad publish permissions across all packages the developer owns. A single stolen token can be used to backdoor an entire developer's portfolio of open source packages.

Targeting Developers Through Dependency Chains

This attack exploits the trust relationships inherent in the npm ecosystem. Developers routinely install packages from the registry without inspecting source code, trusting that packages from established maintainers are safe. By hijacking maintainer accounts, the attackers bypass the normal suspicion threshold applied to unknown packages.

Key characteristics of the campaign:

  • Targets ~/.npmrc — the standard location for npm authentication credentials on Linux, macOS, and Windows
  • Exfiltrates tokens via HTTP to attacker-controlled infrastructure
  • Selectively publishes to packages with high download counts to maximize spread
  • Uses legitimate npm CLI to publish infected updates, making the activity appear normal in registry logs
  • Adds obfuscated postinstall scripts that execute on package installation in victim environments

Scope and Impact

Supply chain attacks that spread through stolen developer credentials represent an evolution in npm ecosystem threats. Previous high-profile npm attacks — including the event-stream poisoning in 2018 and the ua-parser-js compromise in 2021 — relied on manual takeover of individual accounts or abandoned packages. A self-spreading worm significantly amplifies the potential blast radius.

If a widely-used package maintainer's token is stolen, their packages could be trojaned before the maintainer is even aware. Downstream users installing routine dependency updates would receive malicious code.

Immediate Actions for Developers

Rotate npm Authentication Tokens

# Log out and generate a new token
npm logout
npm login
 
# Revoke all existing tokens via npm website or CLI
npm token list
npm token revoke <token-id>
 
# Review active tokens at: https://www.npmjs.com/settings/tokens

Audit Your ~/.npmrc

# Check what tokens are stored
cat ~/.npmrc
 
# Review for unexpected entries
# Token format: //registry.npmjs.org/:_authToken=<token>

Enable Two-Factor Authentication on npm

# Enable 2FA for package publishing
npm profile enable-2fa auth-and-writes
 
# This requires a TOTP code for all publish operations
# Even if a token is stolen, 2FA prevents unauthorized publishing

Review Recently Published Package Versions

If you maintain npm packages, check your recent publish history:

# Check recent versions of your package
npm view <your-package-name> versions --json | tail -5
 
# Review what was published and when
npm view <your-package-name> time --json

Defensive Recommendations for Organizations

Organizations consuming npm packages should implement additional controls:

  1. Pin dependencies to exact versions (5.2.1 instead of ^5.2.1) to prevent unexpected updates
  2. Use a private npm registry with a curated allow-list of approved packages
  3. Implement npm audit in CI/CD pipelines to catch known-malicious packages
  4. Monitor for unexpected network connections from Node.js processes at runtime
  5. Review package-lock.json changes carefully during code review — unexpected version bumps are a red flag

Broader Supply Chain Context

This attack joins a growing list of npm supply chain incidents in 2026. The self-spreading mechanism echoes the canisterworm blockchain C2 npm worm documented in March 2026, suggesting threat actors are increasingly investing in persistence and propagation mechanisms for npm-based attacks.

The npm registry's security team has been notified and is working to identify and remove infected packages. Affected maintainers are being contacted to rotate credentials and review their published packages for unauthorized changes.

References

  • BleepingComputer — New npm Supply Chain Attack Self-Spreads to Steal Auth Tokens
  • npm Security Advisories
  • npm Token Management Documentation
#Supply Chain#npm#JavaScript#Auth Tokens#Malware#BleepingComputer

Related Articles

Critical Flaw in protobuf.js Library Enables JavaScript Code Execution

A critical remote code execution vulnerability in protobuf.js, the widely used JavaScript implementation of Google's Protocol Buffers, has been disclosed...

4 min read

36 Malicious npm Packages Exploited Redis, PostgreSQL to Deploy Persistent Implants

Cybersecurity researchers discovered 36 malicious npm packages disguised as Strapi CMS plugins that abused Redis and PostgreSQL connections to harvest...

5 min read

Claude Code Leak Used to Push Infostealer Malware on GitHub

Threat actors are capitalising on the Claude Code source code leak by creating fake GitHub repositories that impersonate the leaked source to deliver...

6 min read
Back to all News