
用 0.06 秒回答“我的 nginx 是否暴露于 HTTP/2 RCE 漏洞组合?”——一条命令,零网络调用,零依赖。
一个仅使用标准库的 Python CLI,用于检查决定主机是否暴露于 CVE-2026-123007 和 CVE-2026-123633 的两件事:nginx 版本,以及配置中是否启用了 HTTP/2。一次真实检查的中位耗时为 0.062 秒(7 次运行,2026-11-19 在本机测得)——比打开公告页面还快。无 payload、无网络扫描、无漏洞利用代码:仅是一个防御性检查器。
在 2026-11-18,Wiz、Ikotas Labs、Metnir、Rapid7 和 Xint 披露了 nginx HTTP/2 处理中的两个未认证远程代码执行漏洞——CVE-2026-123007(HTTP/2 流控中的整数下溢)和 CVE-2026-123633(代理连接上 HTTP/2 的释放后使用)。两者均为 CVSS 4.0 9.2(CVSS 3.1 8.1);nginx.org 将 123007 评为“严重”,将 123633 评为“中等”。该事件于 2026-11-19 登上 Hacker News 榜首(约 1,152 分),而 nginx 支撑着 2.25 亿+ 网站——因此补丁窗口以小时计,而非以周计。
以下内容已根据下方来源核实:
http2 off 只是针对这两个漏洞的临时缓解措施,不能替代升级。来源:Wiz 文章 · deploybase 解读 · IFIN 公告摘要 · nginx.org 安全公告
git clone https://github.com/Mahgal/nginx-http2-rce-check.git
cd nginx-http2-rce-check
python3 nginx_http2_check.py # check this machine
无需 pip 安装,无依赖——仅需 Python 3。可在未安装 nginx 的情况下试用:
python3 nginx_http2_check.py --demo # labelled fixtures: 1 vulnerable, 1 patched
python3 nginx_http2_check.py --version 1.31.8 --config examples/nginx-http2-on.conf
python3 nginx_http2_check.py --version 1.30.7 --config examples/nginx-http2-on.conf
python3 nginx_http2_check.py --nginx-path examples/fake-nginx-vulnerable.sh --config examples/nginx-http2-on.conf
python3 nginx_http2_check.py --json # machine-readable output for CI
已从干净副本验证(在 /tmp 中全新检出,2026-11-19):--demo 可运行,完整测试套件全部通过,40/40,退出码 0。
python3 nginx_http2_check.py --demo 的真实输出(逐字捕获到 demo.txt;重新运行可逐字节复现,sha256 e6a50babb87a98a704b802b3bbab6d5db6da256b45a45b9628ab1a930eae7f27):
[demo 1/2] vulnerable fixture — nginx 1.31.8 with HTTP/2 on
nginx: 1.31.8 (fixture)
HTTP/2: ENABLED in the scanned config
Verdict: VULNERABLE
CVE-2026-123007: AFFECTED — nginx 1.31.8 is in the affected range (first affected 1.9.5; fixed in 1.30.7 (stable) / 1.31.9 (mainline))
CVE-2026-123633: AFFECTED — nginx 1.31.8 is in the affected range (first affected 1.19.7; fixed in 1.30.7 (stable) / 1.31.9 (mainline))
config: 1 listen directive(s) with the http2 parameter
HTTP/2 is on and the version is affected — pre-auth RCE in the HTTP/2 handler is reachable.
Fix: upgrade to 1.30.7 (stable) / 1.31.9 (mainline).
Mitigation until patched: `http2 off;` (nginx 1.25.1+) and remove `http2` from every listen directive, then test and reload — and confirm old workers have exited.
[demo 2/2] patched fixture — nginx 1.30.7 with HTTP/2 on
nginx: 1.30.7 (fixture)
HTTP/2: ENABLED in the scanned config
Verdict: PATCHED
CVE-2026-123007: PATCHED — nginx 1.30.7 is at or above a fixed release (1.30.7 (stable) / 1.31.9 (mainline))
CVE-2026-123633: PATCHED — nginx 1.30.7 is at or above a fixed release (1.30.7 (stable) / 1.31.9 (mainline))
config: 1 listen directive(s) with the http2 parameter
Fixed build — both HTTP/2 CVEs are closed in this release.
Restart nginx so the fixed binary is the one running (a reload is not enough if the old binary is still loaded).
Demo uses labelled fixtures only — not this machine.
Run without --demo to check this machine.
针对真实标志的相同用例:
$ python3 nginx_http2_check.py --version 1.31.8 --config examples/nginx-http2-on.conf
Verdict: VULNERABLE # exit 1 — HTTP/2 on, version affected
$ python3 nginx_http2_check.py --version 1.30.7 --config examples/nginx-http2-on.conf
Verdict: PATCHED # exit 0 — same config, fixed build
$ python3 nginx_http2_check.py --version 1.31.8 --config examples/nginx-http2-off.conf
Verdict: NOT_AFFECTED # exit 0 — HTTP/2 off closes both flaws
$ python3 nginx_http2_check.py --version 1.24.0-0ubuntu1 --config examples/nginx-http2-on.conf
Verdict: UNKNOWN # exit 3 — distro package: version string says nothing
1.30.7 已修复,但 1.31.0–1.31.8 仍然存在漏洞。 一个简单的检查——“版本 ≥ 1.30.7 即表示安全”——会把 1.31.8 判定为安全。事实并非如此。本工具会对照每个分支的明确范围进行比较,而绝不使用简单的数值阈值:
| 版本 | CVE-2026-123007 | CVE-2026-123633 |
|---|---|---|
| < 1.9.5 | 不受影响 | 不受影响 |
| 1.9.5 – 1.19.6 | 受影响 | 不受影响 |
| 1.19.7 – 1.30.6 | 受影响 | 受影响 |
| 1.30.7(稳定版修复) | 已修补 | 已修补 |
| 1.31.0 – 1.31.8 | 受影响 | 受影响 |
| 1.31.9+ / 1.32.0+(主线修复) | 已修补 | 已修补 |
| 判定 | 含义 |
|---|---|
VULNERABLE | 版本处于受影响范围内 且 扫描的配置中启用了 HTTP/2。请立即升级。 |
PATCHED | 版本等于或高于已修复版本。请重启 nginx,使正在运行的是已修复的二进制文件。 |
NOT_AFFECTED | 版本早于这两个缺陷,或者扫描的配置中 HTTP/2 已关闭。 |
UNKNOWN | 未找到 nginx、版本字符串无法解析、该构建是发行版软件包(见下文)、Plus 系列没有已发布的修复,或者在版本受影响时无法确定 HTTP/2 状态。请勿假定其安全。 |
| 代码 | 含义 |
|---|---|
0 | PATCHED 或 NOT_AFFECTED |
1 | VULNERABLE——这是有意设计的,以便用作 CI 门禁 |
2 | 用法错误(错误的标志、无法读取的 --nginx-path / --config 路径) |
3 | UNKNOWN(本工具自身的代码——见判定结果) |
| 产品 | CVE-2026-123007 | CVE-2026-123633 |
|---|---|---|
| NGINX OSS | 1.9.5 – 1.31.8 | 1.19.7 – 1.31.8 |
| 已修复(OSS) | 1.30.7 稳定版 / 1.31.9 主线版 | 1.30.7 稳定版 / 1.31.9 主线版 |
| NGINX Plus | R33+ | R33+ |
| 已修复(Plus) | 37.0.8.1 / 37.3.0.1 | 37.0.7.1 / 37.2.0.1 |
| Plus,无修复 | R33–R36(迁移到 37.x 系列) | R33–R36(迁移到 37.x 系列) |
37.0.8.1 和 37.3.0.1 修复了 两个 CVE;37.0.7.1 和 37.2.0.1 仅修复了 123633,仍然受 123007 影响。37.1 系列没有针对这两个 CVE 的已发布修复,会被报告为 UNKNOWN。
如果版本字符串来自发行版软件包,那么像 1.24.0 这样的版本字符串并不能说明任何问题。 Debian、Ubuntu、Alpine 等发行版会将安全修复向后移植到旧版本号中,因此 nginx/1.24.0-0ubuntu1 可能已经修补——也可能没有。本工具拒绝猜测:任何带有软件包后缀(-0ubuntu1、~deb12u1、-1、(Ubuntu))的版本字符串都会被报告为 UNKNOWN,并附上说明以及指向你所用发行版 CVE 跟踪器的指引。请检查该跟踪器,或安装上游构建(1.30.7 / 1.31.9)后重新运行。
http2 off;(nginx 1.25.1+)并且 从每个 listen 指令中移除 http2,然后测试、重新加载,并确认旧工作进程已退出。仅使用标准库 unittest——不使用 pytest,不访问网络:
python3 tests/run_tests.py
40 个测试全部通过(退出码 0),覆盖:版本表中的每一行边界(1.9.4 安全、1.9.5 存在漏洞、1.19.6 仅 123007、1.19.7 存在漏洞、1.30.6 存在漏洞、1.30.7 已修复、1.31.0 存在漏洞、1.31.8 存在漏洞、1.31.9 已修复、1.32.0 已修复)、1.30.7 与 1.31.8 的分支陷阱、配置解析(http2 on / http2 off / listen ... http2 / 被注释掉的指令 / 相互冲突的指令)、发行版未知情况的处理(Ubuntu、Debian、裸 -1 后缀)、完整的 NGINX Plus 表(R32 安全、R33–R36 无修复、37.0.7.1 仅修复 123633、37.0.8.1 和 37.3.0.1 修复两者、37.2.0.1 仅修复 123633、37.1 系列未知、无构建号的 R37 未知)、格式错误的版本字符串、缺少 nginx、演示的确定性(两次运行逐字节相同),以及使用 fixture nginx 二进制文件和示例配置进行的 CLI 端到端运行。