796+ npm packages compromised in November 2025. Is your project infected?
Fast, comprehensive scanner to detect the fastest-spreading npm supply chain attack ever observed. Scans for malicious files, stolen credentials, and automated worm propagation patterns.
Shai Hulud 2.0 is one of the fastest-spreading npm supply chain attacks ever observed. The automated worm:
- Hijacked 796+ unique npm packages (1,092+ total versions)
- Stole credentials (npm tokens, GitHub tokens, cloud credentials)
- Created malicious GitHub repositories
- Exfiltrated secrets using TruffleHog
- Spread automatically to maintainer's other packages
Timeline: Active November 2025 Vector: Stolen npm credentials β automated package hijacking β credential harvesting loop
# Download and run (no installation required)
curl -sSL https://raw.githubusercontent.com/nxgn-kd01/shai-hulud-scanner/main/scan.sh | bash -s /path/to/your/project
# Or clone and run
git clone https://github.com/nxgn-kd01/shai-hulud-scanner.git
cd shai-hulud-scanner
chmod +x scan.sh
./scan.sh /path/to/your/projectResults in seconds: π¨ Critical findings |
This tool performs 8 comprehensive security checks:
setup_bun.js- Malicious preinstall scriptbun_environment.js- Obfuscated payload (6 known variants)
Validates files against known malicious SHA-256 hashes:
a3894003ad1d293ba96d77881ccd2071446dc3f65f434669b49b3da92421901a(setup_bun.js)- 6 known hashes for bun_environment.js variants
- Detects suspicious lifecycle scripts in package.json:
preinstall(highest risk - runs before npm install)postinstall(runs after npm install)install(runs during npm install)prepare(runs after package is packed)
- Identifies references to setup_bun or bun_environment
- Flags unexpected script modifications
Checks for packages from affected ecosystems:
@asyncapi/*(~60 compromised packages)@voiceflow/*(~90 compromised packages)posthog-*(~80 compromised packages)@ensdomains/*(~40 compromised packages)quickswap-*(~10 compromised packages)zapier-*(~15 compromised packages)
- Scans for TruffleHog secret scanning tool
- Used by malware for credential harvesting
- Reviews package.json changes in last 30 days
- Identifies suspicious patch version bumps
- Helps spot unexpected modifications
- Detects repos with description: "Sha1-Hulud: The Second Coming."
- Identifies suspicious 18-character lowercase alphanumeric repo names
- Flags unusual repository creation patterns
- Checks for non-standard registry URLs in lockfiles
- Detects git-based dependencies (potential supply chain risk)
- Validates package-lock.json and yarn.lock integrity
Required:
- macOS or Linux (Bash 4.0+)
findcommand (pre-installed)
Optional (recommended for full scanning):
git- For analyzing modification historygh(GitHub CLI) - For scanning GitHub repositoriesshasumorsha256sum- For file hash verification (usually pre-installed)
Option A: Clone (Recommended for users)
# Clone the repository
git clone https://github.com/nxgn-kd01/shai-hulud-scanner.git
cd shai-hulud-scanner
# Make script executable
chmod +x scan.shOption B: Fork (Recommended for contributors)
# Fork on GitHub (click "Fork" button on repository page)
# Then clone your fork
git clone https://github.com/YOUR_USERNAME/shai-hulud-scanner.git
cd shai-hulud-scanner
# Make script executable
chmod +x scan.sh
# Add upstream remote to stay updated
git remote add upstream https://github.com/nxgn-kd01/shai-hulud-scanner.gitOption C: Quick Download (No git required)
# Download and run directly
curl -sSL https://raw.githubusercontent.com/nxgn-kd01/shai-hulud-scanner/main/scan.sh -o scan.sh
chmod +x scan.sh
./scan.sh /path/to/your/projectTo scan your GitHub repositories for suspicious patterns, you'll need the GitHub CLI:
Install GitHub CLI:
# macOS
brew install gh
# Linux (Debian/Ubuntu)
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update
sudo apt install gh
# Linux (RHEL/Fedora)
sudo dnf install ghAuthenticate with GitHub:
# Login to GitHub
gh auth login
# Follow the prompts:
# 1. Select "github.com"
# 2. Select "HTTPS" or "SSH" (HTTPS recommended)
# 3. Select "Login with a web browser"
# 4. Copy the one-time code shown
# 5. Press Enter to open browser
# 6. Paste code and authorize
# Verify authentication
gh auth statusScan a Local Project:
# Scan the current directory
./scan.sh
# Scan a specific project
./scan.sh /path/to/your/project
# Example: Scan your Node.js project
./scan.sh ~/code/my-appScan Multiple Projects:
# Scan all projects in a directory
for dir in ~/code/*/; do
echo "===================="
echo "Scanning: $(basename $dir)"
echo "===================="
./scan.sh "$dir"
echo ""
doneWhat Happens During a Scan:
- π Searches for malicious files (
setup_bun.js,bun_environment.js) - π Verifies file hashes against known malware
- π¦ Checks
package.jsonfor suspicious scripts - π Scans dependencies for compromised packages
- π¨ Looks for TruffleHog secret scanner
- π
Analyzes recent
package.jsonmodifications - π Checks your GitHub repos for suspicious patterns (if
ghauthenticated)
Console Output:
The scanner displays color-coded results:
- π¨ RED (Critical) - Immediate action required, malware detected
β οΈ YELLOW (Warning) - Suspicious patterns, review recommended- β GREEN (Success) - Check passed, no issues
- βΉοΈ BLUE (Info) - Informational findings
Detailed Report:
A full report is saved to shai-hulud-scan-report.txt in the current directory:
# View the report
cat shai-hulud-scan-report.txt
# Or open in your editor
code shai-hulud-scan-report.txtScan GitHub Repos Without Cloning:
# List your repos
gh repo list --limit 100
# Clone and scan a specific repo
gh repo clone YOUR_ORG/repo-name /tmp/scan-temp
./scan.sh /tmp/scan-temp
rm -rf /tmp/scan-temp
# Or create a helper script
cat > scan-remote.sh <<'EOF'
#!/bin/bash
REPO=$1
TEMP_DIR=$(mktemp -d)
echo "Cloning $REPO to temporary directory..."
gh repo clone "$REPO" "$TEMP_DIR"
echo "Scanning..."
./scan.sh "$TEMP_DIR"
echo "Cleaning up..."
rm -rf "$TEMP_DIR"
EOF
chmod +x scan-remote.sh
# Use it:
./scan-remote.sh YOUR_USERNAME/repo-nameIssue: "Permission denied"
# Make script executable
chmod +x scan.shIssue: "gh: command not found"
# Install GitHub CLI (see Step 2)
# Or skip GitHub repo scanning (other checks will still run)Issue: "shasum: command not found"
# Install coreutils (usually pre-installed on macOS)
# Linux:
sudo apt-get install coreutils # Debian/Ubuntu
sudo yum install coreutils # RHEL/CentOS
# Or use sha256sum instead (scanner auto-detects)Issue: Scan shows "INFO" items but you want details
# View the full report file
less shai-hulud-scan-report.txt
# Or use grep to find specific issues
grep -A 5 "WARNING\|CRITICAL" shai-hulud-scan-report.txtScan the current directory:
./scan.sh./scan.sh /path/to/your/project# Scan all projects in a parent directory
for dir in /Users/username/code/*/; do
echo "Scanning $dir"
./scan.sh "$dir"
doneFor automation and SIEM integration:
# Get JSON output
./scan.sh /path/to/project --json
# Pipe to jq for processing
./scan.sh /path/to/project --json | jq '.summary'
# Save results
./scan.sh /path/to/project --json > scan-results.jsonExample JSON output:
{
"scanner": "shai-hulud-scanner",
"version": "1.1.0",
"scanDate": "2025-01-02T12:00:00Z",
"scanDirectory": "/path/to/project",
"summary": {
"critical": 0,
"warning": 1,
"info": 2
},
"findings": [
{
"severity": "warning",
"category": "scripts",
"message": "postinstall script found",
"file": "/path/to/project/package.json"
}
],
"references": [...]
}Quick Integration:
name: Security Scan
on: [push, pull_request]
jobs:
shai-hulud-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run Shai Hulud Scanner
run: |
curl -sSL https://raw.githubusercontent.com/nxgn-kd01/shai-hulud-scanner/main/scan.sh | bash -s .Full Example Workflow:
See examples/github-actions-workflow.yml for a complete workflow with:
- Artifact uploads
- PR comments with scan results
- Automatic issue creation on detection
- Scheduled daily scans
The scanner provides color-coded results:
- π¨ RED (Critical): Immediate action required
β οΈ YELLOW (Warning): Review recommended- β GREEN (Success): Check passed
- βΉοΈ BLUE (Info): Informational findings
A detailed report is saved to shai-hulud-scan-report.txt containing:
- Scan metadata (date, directory, version)
- Detailed findings for each check
- Recommended actions if issues found
- References to security resources
0- No issues found or warnings only1- Critical issues detected
=== Shai Hulud 2.0 Scanner v1.1.0 ===
Scanning directory: /Users/username/project
=== 1. Scanning for Malicious Files ===
β
No malicious files found
=== 2. Checking File Hashes ===
β
No known malicious file hashes detected
=== 3. Checking package.json for Suspicious Scripts ===
β
No suspicious scripts found
=== 4. Checking for Compromised Package Ecosystems ===
β
No packages from compromised ecosystems found
=== 5. Scanning for TruffleHog ===
β
No TruffleHog installations found
=== 6. Analyzing Recent package.json Changes ===
β
No recent package.json modifications
=== 7. Checking GitHub Repository Patterns ===
β
No suspicious repository descriptions
β
No suspicious repository names
=== 8. Checking Package Lockfile Integrity ===
β
Lockfile integrity checks passed
=== Scan Summary ===
Critical Issues: 0
Warnings: 0
Info Items: 0
β
All clear! No indicators of compromise found.
βΉοΈ Detailed report saved to: shai-hulud-scan-report.txt
Install shasum (usually part of coreutils):
# macOS (built-in)
# Linux
sudo apt-get install coreutils # Debian/Ubuntu
sudo yum install coreutils # RHEL/CentOSInstall GitHub CLI:
# macOS
brew install gh
# Linux
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update
sudo apt install gh
# Authenticate
gh auth loginRead the full guide: REMEDIATION.md
The guide includes:
- β Immediate response steps (first 15 minutes)
- β Complete credential rotation procedures (npm, GitHub, AWS, GCP, Azure, etc.)
- β Code cleanup instructions
- β Investigation and forensics procedures
- β Disclosure and reporting requirements
- β Post-incident hardening measures
- β Recovery checklist
-
Isolate Affected Systems
# Stop deployments immediately # Move compromised code to quarantine mkdir ~/quarantine-$(date +%Y%m%d) mv /path/to/compromised-project ~/quarantine-$(date +%Y%m%d)/
-
Rotate ALL Credentials Immediately
# npm tokens npm token revoke --all # GitHub tokens gh auth logout && gh auth login # AWS/GCP/Azure - see REMEDIATION.md for full instructions
-
Remove Malicious Code
find . -name "setup_bun.js" -delete find . -name "bun_environment.js" -delete git add -A && git commit -m "SECURITY: Remove malicious files"
-
Report the Incident
- npm security: security@npmjs.com
- GitHub security: security@github.com
- Follow disclosure guidelines in REMEDIATION.md
-
Follow Complete Guide
- See REMEDIATION.md for detailed step-by-step instructions
- Use the recovery checklist to track progress
- Document everything for post-mortem
If you get warnings (not critical issues):
-
Review the scan report
cat shai-hulud-scan-report.txt
-
Verify legitimacy of flagged items
-
Update dependencies if needed:
npm audit && npm update -
Re-run scanner to confirm:
./scan.sh .
- Detailed Guide: REMEDIATION.md - Complete incident response procedures
- Community: GitHub Discussions
- Professional IR: If severe, consider engaging professional incident response
- CISA: Report to https://www.cisa.gov/report
- DataDog IOC Repository: github.com/DataDog/indicators-of-compromise
- DataDog Analysis: securitylabs.datadoghq.com/articles/shai-hulud-2.0-npm-worm
- Microsoft Security Blog: Shai-Hulud 2.0 Guidance
- Wiz Research: Shai-Hulud 2.0 Ongoing Attack
- CISA Alert: Widespread Supply Chain Compromise
- Consolidated IOC List: 1,000+ compromised packages tracked
Shai Hulud 2.0 Detection:
- Shai-Hulud-2.0-Detector - GitHub Action with SARIF support
- sha1-hulud-scanner - npm package scanner
Related Vulnerability Scanners:
- react2shell-scanner - Detect CVE-2025-55182 (React2Shell) RCE vulnerability in React Server Components
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/improvement) - Commit your changes (
git commit -m 'Add new detection') - Push to the branch (
git push origin feature/improvement) - Open a Pull Request
- Add support for additional IOC sources
- Implement JSON output format (v1.1.0)
- Add lockfile integrity checks (v1.1.0)
- Detect all lifecycle scripts (v1.1.0)
- Add Docker container support
- Create npm package version
- Add integration tests
- Support for other package managers (pip, cargo, etc.)
This project is licensed under the MIT License - see the LICENSE file for details.
This tool is provided "as is" for security research and defensive purposes only. While we make every effort to keep the IOC list current, new variants may emerge. Always:
- Keep the scanner updated
- Follow official security advisories
- Report suspected compromises to npm security
- Maintain defense-in-depth security practices
- DataDog Security Labs for comprehensive IOC research and analysis
- npm Security Team for rapid response
- Community security researchers: Koi.ai, StepSecurity, ReversingLabs, HelixGuard, SocketDev, Wiz
- Issues: GitHub Issues
- Security: Report vulnerabilities privately to security@yourdomain.com
- Discussions: GitHub Discussions
Stay Safe! π‘οΈ
Remember to run this scanner:
- β
Before
npm installoperations - β Before merging dependency updates
- β Regularly in CI/CD pipelines
- β After inheriting or acquiring projects