Critical NPM Security Alert: 18 Core Packages Compromised

URGENT: On September 8, 2025, 18 essential npm packages with 2+ billion weekly downloads were compromised with malicious code. Immediate action required.

Quick Detection Commands

Check Your System Now (30 seconds)

NPM Users – Run this immediately:

npm ls --depth=100 | grep -E '[email protected]|[email protected]|[email protected]|[email protected]|[email protected]|[email protected]' || echo "✅ System Clean"

Yarn Users:

yarn list --pattern '' | grep -E '[email protected]|[email protected]|[email protected]' || echo "✅ System Clean"

Compromised Packages

PackageMalicious VersionWeekly DownloadsRisk Level
debug4.4.2357.6MCRITICAL
chalk5.6.1299.99MCRITICAL
ansi-styles6.2.2371.41MCRITICAL
strip-ansi7.1.1261.17MCRITICAL
color-convert3.1.1193.5MCRITICAL
+ 13 additional packages

Immediate Response Plan

Step 1: Remove Compromised Packages

#!/bin/bash
# Clear npm cache
npm cache clean --force

# Remove malicious packages
npm uninstall debug chalk ansi-styles strip-ansi color-convert wrap-ansi

# Delete node_modules and lock files
rm -rf node_modules package-lock.json

Step 2: Install Safe Versions

// Add to package.json
"overrides": {
  "debug": "4.3.4",
  "chalk": "4.1.2",
  "ansi-styles": "4.3.0",
  "strip-ansi": "6.0.1",
  "color-convert": "2.0.1"
}
# Reinstall dependencies
npm install
npm audit

AWS Automated Response

SSM Document for EC2 Scanning

For AWS users, we’ve created an automated scanning solution using Systems Manager:

  1. Create SSM Document: Deploy our scanning document to automatically check all EC2 instances
  2. Run Command: Execute across your entire fleet with one command
  3. Auto-tagging: Infected instances are automatically tagged for isolation
  4. Reporting: Results uploaded to S3 with SNS notifications
# Execute scanning across all environments
aws ssm send-command \
  --document-name "NPM-Security-Scanner" \
  --targets "Key=tag:Environment,Values=Production,Staging,Development" \
  --parameters '{"S3BucketName":"security-audits"}'

# Check infected instances
aws ec2 describe-instances \
  --filters "Name=tag:npm-scan-status,Values=INFECTED" \
  --query 'Reservations[*].Instances[*].InstanceId'

Attack Details

Malicious Payload Capabilities

  • Credential Theft: Steals NPM_TOKEN, AWS keys, GitHub tokens
  • Backdoor Installation: Downloads and executes remote scripts
  • Cryptomining: Installs hidden cryptocurrency miners
  • Data Exfiltration: Sends environment variables to attacker servers

CI/CD Pipeline Protection

GitHub Actions Security Check

name: NPM Security Check
on: [push, pull_request]

jobs:
  security-scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Check for malicious packages
        run: |
          if npm ls --depth=100 | grep -E '[email protected]|[email protected]'; then
            echo "::error::Malicious packages detected!"
            exit 1
          fi
      - name: Audit
        run: npm audit --audit-level=high

Prevention Checklist

  • [ ] Implement package version pinning
  • [ ] Enable npm audit in CI/CD pipelines
  • [ ] Use private npm registry (Verdaccio/Artifactory)
  • [ ] Regular dependency audits (weekly)
  • [ ] Monitor package integrity hashes
  • [ ] Implement least-privilege IAM policies
  • [ ] Enable IMDSv2 on all EC2 instances
  • [ ] Set up real-time security monitoring

Complete Package List

All 18 affected packages:

Resources & Support

  • Download SSM Document: Available on GitHub repository
  • NPM Security Guide: https://docs.npmjs.com/packages-and-modules/securing-your-code
  • Report Issues: [email protected]

Last Updated: September 10, 2025
Severity: CRITICAL
Impact: Global – All Node.js applications
Action Required: Immediate

Stay updated: Subscribe to security alerts and check back regularly for updates on this evolving situation. Report any suspicious activity to [email protected] immediately.


Twodragon에서 더 알아보기

구독을 신청하면 최신 게시물을 이메일로 받아볼 수 있습니다.

댓글 남기기

위로 스크롤

Twodragon에서 더 알아보기

지금 구독하여 계속 읽고 전체 아카이브에 액세스하세요.

계속 읽기