Security scanner for detecting the Shai-Hulud 2 npm supply chain attack (November 2025).
# Install dependencies
npm install
# Scan current directory (generates JSON, Markdown, and HTML reports)
npm run scan
# Full scan with process and credential checks
npm run scan:fullnpm install worm-busternpm install -g worm-buster
worm-buster --helpgit clone <repository-url>
cd worm-buster
npm install
npm link # Makes 'worm-buster' command available globallyworm-buster [options] [directory1] [directory2] ...
Pass one or more directory paths to scan. If no directories are specified, scans the current directory.
# From the worm-buster directory
node index.js ~/code
node index.js /path/to/project
node index.js --full .# After npm link or global install
# Scan current directory (generates JSON, Markdown, and HTML reports)
worm-buster
worm-buster .
# Scan a specific directory
worm-buster /path/to/project
# Scan multiple directories
worm-buster ~/code/app1 ~/code/app2 ~/code/app3
# Scan all common project directories (~/{code,projects,dev,...})
worm-buster --all
# Full scan with process and credential checks
worm-buster --full ~/projects
# Output reports to a specific directory
worm-buster . -o ./reports
# JSON output only (for CI/CD pipelines)
worm-buster --json /path/to/project| CRITICAL | WARNING | INFO |
|---|---|---|
![]() |
![]() |
![]() |
| Option | Description |
|---|---|
[directories...] |
One or more directories to scan (default: current directory) |
-h, --help |
Show help message |
-v, --verbose |
Show verbose output including parse errors |
--all |
Scan all common project directories |
--processes |
Check for suspicious running processes |
--credentials |
Check credential files that may have been compromised |
--full |
Enable all checks (--processes + --credentials) |
--json |
Output results in JSON format only (no reports) |
-o, --output DIR |
Output directory for reports (default: current directory) |
const { scan, loadInfectedPackages, checkPackageJson } = require('worm-buster');
// Full scan
const findings = await scan({
directories: ['/path/to/project'],
verbose: true,
checkProcesses: true,
});
// Check specific package.json
const infectedPackages = loadInfectedPackages('./worm.md');
const results = checkPackageJson('./package.json', infectedPackages);npm run scan # Basic scan (generates all report formats)
npm run scan:full # Full scan with all checks
npm run scan:all # Scan all common directories
npm run test # Run tests
npm run lint # Run ESLintChecks against 1000+ known infected npm packages from the Shai-Hulud 2 campaign. If your project has an exact infected version, this is flagged as CRITICAL.
If you have a package that was targeted in the attack but you have a SAFE version, the tool shows a CAUTION notice. This warns you not to upgrade to the infected versions.
.github/workflows/discussion.yaml- Backdoor workflowsetup_bun.js,bun_environment.js- Malware payload filescloud.json,environment.json,truffleSecrets.json- Exfiltrated dataformatter_*.ymlworkflows - Suspicious automated workflows
Detects potentially malicious npm lifecycle scripts (preinstall, postinstall) containing:
bun,setup_,curl,wget,evalpatterns
- Running processes matching malware patterns
- Credential files that may have been exfiltrated
All three report formats are generated by default in the current directory (or use -o to specify output directory).
Machine-readable format for automation and CI/CD integration.
Human-readable report suitable for documentation and tickets.
Styled report for sharing with IT/security teams via browser.
| Code | Meaning |
|---|---|
| 0 | No critical issues found |
| 1 | Critical issues detected |
| 2 | Fatal error occurred |
worm-buster/
├── index.js # Main entry point and CLI
├── lib/
│ ├── config.js # IOC definitions and constants
│ ├── loader.js # Infected packages database loader
│ ├── scanner.js # File system scanning
│ ├── analyzer.js # Package analysis
│ ├── system.js # Process and credential checks
│ ├── output.js # Console output formatting
│ └── reporter.js # Report generation (JSON/MD/HTML)
├── test/ # Unit tests
├── worm.md # Infected packages database
└── package.json
If infected packages are found:
- DO NOT run
npm installin affected projects - Remove infected packages from
package.json - Delete
node_modulesandpackage-lock.json - Check
.github/workflowsfor suspicious files - Rotate ALL credentials immediately:
- AWS, Azure, GCP credentials
- GitHub tokens
- npm tokens
- Review GitHub Actions for unauthorized workflows
- Check for unauthorized Bun installation:
which bun
- name: Scan for Shai-Hulud 2
run: |
npx worm-buster --json . > scan-results.json
if [ $? -eq 1 ]; then
echo "::error::Infected packages detected!"
exit 1
fi#!/bin/sh
npx worm-buster --json . > /dev/null
if [ $? -eq 1 ]; then
echo "Error: Infected packages detected. Run 'npx worm-buster' for details."
exit 1
finpm test # Run all tests
npm run test:watch # Watch mode
npm run test:coverage # With coverage- Wiz Security - Shai-Hulud 2.0 Analysis
- Datadog Security Labs - npm Worm Analysis
- Check Point Research - Technical Deep Dive
MIT


