一键扫描器,用于检测 Mini Shai-Hulud npm 供应链攻击(CVE-2026-45321,CVSS 9.6)。
该蠕虫会安装一个持久化守护进程(gh-token-monitor),一旦检测到凭据吊销,就会执行 rm -rf ~。在确认该守护进程已被清除之前,请勿轮换你的 GitHub PAT 或 npm 令牌。 检测 → 移除守护进程 → 然后 再轮换。
curl -fsSL https://raw.githubusercontent.com/prashanthnataraj/mini-shai-hulud-detector/main/shai-hulud-detector.sh | bash
或者先下载并检查(对于任何要通过管道传给 shell 的脚本,强烈推荐这样做):
curl -fsSL https://raw.githubusercontent.com/prashanthnataraj/mini-shai-hulud-detector/main/shai-hulud-detector.sh -o shai-hulud-detector.sh
# 阅读脚本。然后:
bash shai-hulud-detector.sh
| 步骤 | 检测项 |
|---|
| 1 | package-lock.json 中的幽灵包 @tanstack/setup |
| 2 | 已知的恶意载荷文件(router_init.js、tanstack_runner.js) |
| 3 | 载荷 SHA-256 哈希值与已知恶意哈希列表比对 |
| 4 | gh-token-monitor 持久化守护进程(LaunchAgent / systemd / pgrep) |
| 5 | ~/.claude/settings.json 中意外的 PreToolUse / PostToolUse 钩子 |
| 6 | .github/workflows 中的 pull_request_target 触发器和未固定版本的操作引用 |
| 退出码 | 判定结果 |
|---|---|
0 | 干净 —— 未发现任何指标 |
1 | 可疑 —— 需要人工审查 |
2 | 已感染 —— 严格按照脚本输出的补救顺序执行 |
若
package-lock.json缺失,默认返回“可疑”——请在npm install后再运行扫描。
npm install、npm uninstall 或 git push。rm -rf node_modules && npm install --ignore-scripts。在 .npmrc 中添加:
ignore-scripts=true
minimum-release-age=4320
将所有 GitHub Actions 引用固定到完整的提交 SHA,而非版本标签。
本工具由 Lume AI 团队在 2026 年 5 月遭遇真实的 CVE-2026-45321 攻击后编写。该脚本为只读 —— 下载后不进行任何网络调用,也不会写入磁盘。运行前请审查源代码。
MIT —— 参见 LICENSE。