GHES CVE 扫描器
检测 GitHub Enterprise Server (GHES) 实例是否受 CVE-2026-3854 和 CVE-2026-4821 影响。
CVE 背景
CVE-2026-3854 (CVSS 8.7)
Git Push 远程代码执行 — babeld 组件未对 git push 选项中的分号进行清理,导致可远程执行代码。
受影响版本:
| 主版本 | 受影响范围 | 最低安全版本 |
|---|
| 3.14.x | <= 3.14.24 | 3.14.25 |
| 3.15.x | <= 3.15.19 | 3.15.20 |
| 3.16.x | <= 3.16.15 | 3.16.16 |
| 3.17.x | <= 3.17.12 | 3.17.13 |
| 3.18.x | <= 3.18.6 | 3.18.7 |
| 3.19.x | <= 3.19.3 | 3.19.4 |
| 3.20.x+ | 不受影响 | — |
CVE-2026-4821 (CVSS 7.2)
管理控制台代理注入 — 代理配置字段未对 shell 元字符进行清理。
受影响版本:
- 3.20.0
- 3.15.x <= 3.15.20
- 3.14.x 及所有更早版本
修复版本:3.20.1、3.15.21
安装
方式一:pip
pip install ghes-cve-scanner
方式二:从源码安装
git clone https://github.com/isagoakira/ghes-cve-scanner.git
cd ghes-cve-scanner
pip install -e .
使用方法
单实例扫描
python scanner.py scan https://ghes.company.com
批量扫描
python scanner.py scan-batch instances.csv -o report.html
CSV 格式
url,ip,port
https://ghes1.company.com,10.0.1.1,443
https://ghes2.company.com,10.0.1.2,443
CLI 选项
全局选项
| 选项 | 说明 | 默认值 |
|---|
--timeout N | HTTP 超时时间(秒) | 5 |
--retries N | 重试次数 |
scan 子命令
scan-batch 子命令
退出码
| 代码 | 含义 |
|---|
| 0 | 所有实例均安全 |
| 1 | 至少一个实例存在漏洞 |
| 2 | 至少一个实例无法扫描 |
版本快速参考
示例脚本
# 单实例扫描
./examples/single_instance.sh https://ghes.company.com
# 批量扫描
./examples/batch_scan.sh instances.csv report.html
# CI 集成
# 参见 examples/ci_integration.sh
功能特性
- 零外部依赖 — 仅使用 Python 标准库
- 隐私保护 — 不向外部服务发送任何数据
- 优雅降级 — 若 paramiko 不可用则回退到 HTTP
- 并行扫描 — 使用 ThreadPoolExecutor 进行批量扫描
- 多种格式 — JSON/CSV/HTML/控制台输出
许可证
MIT 许可证