NEWS

Supply Chain Attack Discovered in Popular NPM Packages

Security researchers have discovered malicious code injected into several popular NPM packages with millions of weekly downloads. Developers urged to...

Dylan H.

Security Engineer

January 18, 2026
3 min read
Supply Chain Attack Discovered in Popular NPM Packages

A sophisticated supply chain attack has been discovered affecting multiple popular NPM packages. The malicious code, designed to steal environment variables and credentials, was present in packages with combined weekly downloads exceeding 8 million.

Affected Packages

Security researchers at Socket.dev identified the following compromised packages:

PackageWeekly DownloadsAffected Versions
config-utils-pro2.1M4.2.1 - 4.2.3
auth-helper-lib3.4M2.0.5 - 2.0.7
data-transform-kit1.8M1.5.0 - 1.5.2
log-formatter-x0.9M3.1.1

Attack Details

Initial Compromise

The attacker gained access through:

  • Compromised maintainer credentials (possibly via phishing)
  • No evidence of NPM infrastructure breach
  • Targeted attack on specific package maintainers

Malicious Behavior

The injected code:

  1. Collected environment variables
  2. Harvested .env files from project directories
  3. Exfiltrated AWS, database, and API credentials
  4. Sent data to attacker-controlled servers
  5. Self-deleted traces after execution

Code Analysis

The malicious code was obfuscated but researchers identified:

// Simplified representation of malicious behavior
// Actual code was heavily obfuscated
const e = process.env;
const d = require('fs').readFileSync('.env', 'utf8');
// Exfiltration to attacker server

Timeline

  • Jan 12: First malicious version published
  • Jan 15: Initial reports of suspicious behavior
  • Jan 17: Socket.dev confirms supply chain attack
  • Jan 18: NPM removes affected packages

Detection

Check If Affected

# Check for affected packages
npm ls config-utils-pro
npm ls auth-helper-lib
npm ls data-transform-kit
npm ls log-formatter-x
 
# Or use npm audit
npm audit

Indicators of Compromise

Review logs for connections to:

# Suspicious domains (defanged)
cdn-pkg-analytics[.]com
npm-stats-collector[.]net
package-telemetry[.]io

Remediation Steps

Immediate

  1. Audit your package.json and package-lock.json
  2. Remove affected package versions
  3. Run npm audit fix
  4. Rotate any credentials that may have been exposed

Credential Rotation Priority

If affected, rotate immediately:

  • AWS access keys
  • Database credentials
  • API tokens
  • SSH keys in environment variables
  • Any secrets in .env files

NPM's Response

NPM has:

  • Removed all affected package versions
  • Suspended associated accounts pending investigation
  • Enabled additional security monitoring
  • Reminded users about 2FA for publishing

Prevention Recommendations

For Developers

  1. Lock dependencies: Use exact versions in package-lock.json
  2. Enable 2FA: Require 2FA for npm publishing
  3. Use npm audit: Run regularly in CI/CD
  4. Review updates: Audit dependency updates before merging

For Organizations

  1. Private registry: Consider npm Enterprise or Artifactory
  2. Dependency scanning: Integrate tools like Snyk or Socket
  3. Allow-listing: Only permit approved packages
  4. Secrets management: Never store secrets in environment variables

Industry Impact

This incident highlights ongoing supply chain security challenges:

  • Open source maintainers remain high-value targets
  • Single points of failure in dependency chains
  • Need for improved package integrity verification

Expert Commentary

"This attack shows how a single compromised maintainer account can impact millions of developers," noted a security researcher. "The JavaScript ecosystem needs stronger integrity verification mechanisms."


Sources: GitHub Security, Socket.dev, npm Security