chainrecon/chainrecon

GitHub: chainrecon/chainrecon

从攻击者视角评估 npm 包供应链风险,在攻击发生前识别高价值攻击目标

Stars: 1 | Forks: 0

# chainrecon **预测下一次供应链攻击。** [![Go](https://img.shields.io/badge/Go-1.26-00ADD8?logo=go)](https://go.dev) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE) [![CI](https://static.pigsec.cn/wp-content/uploads/repos/2026/04/ed72357928115600.svg)](https://github.com/chainrecon/chainrecon/actions/workflows/ci.yml) [![Release](https://img.shields.io/github/v/release/chainrecon/chainrecon)](https://github.com/chainrecon/chainrecon/releases/latest) [![Homebrew](https://img.shields.io/badge/Homebrew-chainrecon%2Ftap-FBB040?logo=homebrew)](https://github.com/chainrecon/homebrew-tap) chainrecon 从攻击者的角度剖析 npm 包,在攻击发生之前挖掘出使其成为诱人攻击目标的信号。 ## 快速开始 ``` $ brew install chainrecon/tap/chainrecon $ chainrecon scan axios Package: axios Version: 1.14.0 Weekly Downloads: 99,988,070 ┌─────────────────────────┬───────────┬─────────────────────────────────────────────┐ │ Signal │ Score │ Detail │ ├─────────────────────────┼───────────┼─────────────────────────────────────────────┤ │ Provenance │ 7.5/10 │ Provenance is intermittent across versions │ │ Publishing Hygiene │ 5.0/10 │ Mixed publishing methods detected │ │ Maintainer Risk │ 9.0/10 │ Single maintainer with full publish access │ │ Identity Stability │ 8.0/10 │ Maintainer email changed between versions │ │ Scorecard (imported) │ 4.5/10 │ OpenSSF Scorecard: 5.5/10 │ │ Blast Radius │ 10.0/10 │ Extremely high blast radius │ ├─────────────────────────┼───────────┼─────────────────────────────────────────────┤ │ Attack Surface │ 6.9/10 │ │ │ Target Score │ 69.0 │ HIGH │ └─────────────────────────┴───────────┴─────────────────────────────────────────────┘ Key Findings: [HIGH] Provenance is intermittent across versions [MEDIUM] Mixed publishing methods detected [CRITICAL] Single maintainer with full publish access [HIGH] All maintainers using personal email addresses [MEDIUM] Unscoped package with limited maintainer access [CRITICAL] Extremely high blast radius [CRITICAL] Maintainer email changed between versions [HIGH] Unknown publisher on recent version [LOW] Multiple different publishers across recent versions [MEDIUM] OpenSSF Scorecard: 5.5/10 [HIGH] Scorecard Token-Permissions: 0/10 [HIGH] Scorecard Pinned-Dependencies: 1/10 ``` ## 信号 | 信号 | 描述 | |---|---| | `Provenance Consistency` | 跟踪跨版本的 npm 来源证明。检测缺失和断档。 | | `Publishing Hygiene` | 对发布方式进行分类:CI/CD、直接 token、混合或旧模式。 | | `Maintainer Concentration` | Bus factor(公车系数)、单一发布者检测、个人与企业邮箱对比。 | | `Identity Stability` | 邮箱变更、成熟包出现新发布者、发布频率异常。 | | `OpenSSF Scorecard` | 数据导入自 [scorecard.dev](https://scorecard.dev),已反转(数值越高 = 越脆弱)。 | | `Blast Radius` | 周下载量、依赖项数量、安全工具系数。 | | `Tag Correlation` | 标记没有匹配 GitHub release 或 tag 的 npm 版本。 | ## 评分 ``` target_score = attack_surface × blast_radius ``` 攻击面是上述信号的加权平均值(0 到 10)。爆炸半径对其进行缩放。目标评分范围为 0 到 100。 | | 评分 | |---|---| | ![LOW](https://img.shields.io/badge/LOW-3CB371) | 低于 25 | | ![MEDIUM](https://img.shields.io/badge/MEDIUM-F0AD4E) | 25 到 49 | | ![HIGH](https://img.shields.io/badge/HIGH-E87D2F) | 50 到 69 | | ![CRITICAL](https://img.shields.io/badge/CRITICAL-D9534F) | 70+ | 该评分表示包作为攻击目标的吸引力程度,而非其是否已被入侵。 ## CLI 参考 | 命令 | 描述 | |---|---| | `chainrecon scan ` | 扫描 npm 包 | | `chainrecon watch` | 监控包的新版本 | | `chainrecon version` | 打印版本信息 | ### scan flags | 标志 | 默认值 | 描述 | |---|---|---| | `--format` | `table` | 输出格式(`table`、`json` 或 `sarif`) | | `--depth` | `20` | 检查来源历史的版本数量 | | `--threshold` | `0` | 如果目标评分达到或超过此值,则退出码为 1 | | `--timeout` | `2m` | 请求超时时间 | | `--no-cache` | `false` | 绕过本地缓存 | | `--no-scorecard` | `false` | 跳过 OpenSSF Scorecard 查询 | | `--no-github` | `false` | 跳过 GitHub release/tag 查询 | | `--github-token` | | 用于提高速率限制的 GitHub API token | ### watch flags | 标志 | 默认值 | 描述 | |---|---|---| | `--config` | `.chainrecon.yml` | 监控列表 YAML 文件的路径 | | `--once` | `false` | 单次运行模式,用于 CI | | `--state-file` | | 用于在运行之间持久化的状态文件路径 | | `--depth` | `20` | 每次扫描检查的版本数量 | | `--timeout` | `2m` | 单次扫描超时时间 | 这两个命令均支持 `GITHUB_TOKEN` 环境变量。 ## 从源码构建 ``` git clone https://github.com/chainrecon/chainrecon.git cd chainrecon make build ./bin/chainrecon scan axios ``` ## 许可证 Apache 2.0。详见 [LICENSE](LICENSE)。
标签:DevSecOps, EVTX分析, Go, Golang, Homebrew, NPM安全, Ruby工具, 上游代理, 依赖包扫描, 包管理器安全, 威胁预测, 安全态势感知, 安全编程, 开源软件安全, 文档安全, 日志审计, 暗色界面, 漏洞防御, 维护者风险, 软件开发工具包