adminlove520/http2-bomb-detector

GitHub: adminlove520/http2-bomb-detector

该工具用于非破坏性地检测 Nginx 和 Apache httpd 是否受 CVE-2026-49975 HTTP/2 远程拒绝服务漏洞影响。

Stars: 1 | Forks: 0

# http2-bomb-detector ## 漏洞背景 CVE-2026-49975 是一个影响广泛的 HTTP/2 协议层远程拒绝服务漏洞,由安全研究员 Quang Luong 发现。该漏洞利用 **HPACK 头部压缩** 和 **流控制机制** 的组合性设计缺陷,攻击者无需身份验证即可在 10-20 秒内耗尽服务器 32GB 内存。 - **CVSS 3.1**: 9.8(高危) - **CWE**: CWE-789 (Memory Allocation with Excessive Size Value) - **别名**: QVD-2026-30962 - **公开时间**: 2026-06-02 - **PoC**: [beichenst/http2-bomb](https://github.com/beichenst/http2-bomb) | [califio/publications](https://github.com/califio/publications/tree/main/MADBugs/http2-bomb) ## 影响范围 | 服务器 | 受影响版本 | 放大比 | 修复状态 | |--------|-----------|--------|---------| | Apache httpd | 2.4.17 – 2.4.67 (mod_http2 < 2.0.41) | ~4,000:1 | ✅ 已修复 | | Nginx | < 1.29.8 | ~70:1 | ✅ 已修复 | | Envoy | ≤ 1.37.2 | ~5,700:1 | ❌ 未修复 | | Microsoft IIS | 含 Windows Server 2025 | ~68:1 | ❌ 未修复 | | Cloudflare Pingora | ≤ 0.8.0 | ~62:1 | ❌ 未修复 | ## 检测原理 本工具基于真实 PoC 实现,采用两种检测模式: ### Nginx 模式 探测 HPACK **索引引用炸弹**:插入动态表项 `("a", "")`,然后发送索引引用。每个引用 1 byte 线上 → 59 bytes 服务器内存(3B pool copy + 56B `ngx_table_elt_t`)。攻击参数 refs=32000,检测仅用 refs=3。 ### Apache 模式 探测 **Cookie crumb 合并炸弹**:利用 `mod_http2` 的 Cookie 合并机制(`apr_table_setn` 用 `"; "` 连接重复 cookie),合并后的 cookie 不计入 `LimitRequestFields`。攻击参数 refs=4091(~4000:1 放大),检测仅用 refs=3。 ### 判断逻辑 - 服务器返回 `ENHANCE_YOUR_CALM` → 🛡️ 已部署防护 - 服务器 `RST_STREAM` 拒绝 → 🛡️ 有防护 - 服务器 `GOAWAY` → 🛡️ 有防护 - 服务器静默接受 → ⚠️ 可能受影响 ## 安装 **零依赖**,仅使用 Python 标准库(`ssl`, `socket`, `struct`)。 git clone https://github.com/adminlove520/http2-bomb-detector.git cd http2-bomb-detector 需要 Python 3.7+。 ## 使用方法 ### 单目标检测 # 自动检测(Nginx + Apache 两种模式) python http2_bomb_detector.py --host example.com # 指定模式 python http2_bomb_detector.py --host example.com --mode nginx python http2_bomb_detector.py --host example.com --mode httpd # 指定端口 python http2_bomb_detector.py --host example.com --port 8443 # 仅输出漏洞信息,不发送探测包 python http2_bomb_detector.py --host example.com --no-probe # JSON 格式输出 python http2_bomb_detector.py --host example.com --json ### 批量检测 # 从文件读取目标列表 python http2_bomb_detector.py -f targets.txt # 输出报告 python http2_bomb_detector.py -f targets.txt -o report.txt `targets.txt` 格式(每行一个,`#` 开头为注释): # Web 服务器列表 example.com https://example.org:8443 192.168.1.100 ## 输出示例 [INFO] 连接 example.com:443 ... [OK] HTTP/2 连接建立 [INFO] --- NGINX 模式检测 --- [INFO] 攻击向量: HPACK 索引引用炸弹:动态表项 ('a','') × 32000 引用 [INFO] 修复版本: 1.29.8 | 放大比: ~70:1 [INFO] 发送探测包 (refs=3, 非破坏性)... [WARN] ⚠️ 服务器静默接受探测包 — 可能受影响! [INFO] --- HTTPD 模式检测 --- [INFO] 攻击向量: Cookie crumb 合并炸弹:空 cookie × 4091 引用 [INFO] 修复版本: mod_http2 2.0.41 / httpd 2.4.68 | 放大比: ~4000:1 [INFO] 发送探测包 (refs=3, 非破坏性)... [OK] 服务器 RST_STREAM 拒绝探测流 — 有防护 ================================================== 🛡️ NGINX: potentially_vulnerable ⚠️ HTTPD: protected ## 免责声明 本工具仅用于**授权安全测试**。使用本工具检测未授权的目标可能违反法律。使用者需自行承担所有法律责任。 ## 参考资料 - [CVE-2026-49975 - NVD](https://nvd.nist.gov/vuln/detail/CVE-2026-49975) - [Apache HTTP Server 安全公告](https://httpd.apache.org/security/vulnerabilities_24.html) - [HTTP/2 Bomb 原始研究博客](https://blog.calif.io/p/codex-discovered-a-hidden-http2-bomb) - [PoC 代码仓库(beichenst)](https://github.com/beichenst/http2-bomb) - [RFC 7541 - HPACK](https://www.rfc-editor.org/rfc/rfc7541) - [RFC 9113 - HTTP/2](https://www.rfc-editor.org/rfc/rfc9113) ## License MIT
标签:Apache httpd, HTTP/2, Nginx, Python, 拒绝服务, 无后门, 逆向工具, 配置错误