针对 CVE-2026-123007 的只读检查。该漏洞是 nginx HTTP/2 流量控制中的内存破坏问题,研究人员已证明它可导致工作进程中的远程代码执行。该工具可在 Kubernetes Pod(包括 ingress-nginx)、Docker 容器或主机上发现 nginx,判断每个实例是否受影响,并生成带时间戳的证据报告,可附在工单或审计中。
TARGET VERDICT NGINX H2MOD HTTP2
web/frontend-7d9f8b6c5-x2k4p/frontend VULNERABLE-H2-OFF 1.31.7 yes no
ingress/ingress-nginx-controller-5f7c9-abcde/controller EXPOSED 1.27.1 yes yes
INGRESS HOST CLASS ALPN
app.example.com nginx h2
Result: 1 exposed, 1 vulnerable with HTTP/2 off, 0 fixed, 0 not affected, 0 undetermined
Evidence: nginx-http2-evidence-my-cluster-web-20261118T193338Z.md
SHA-256: 3b1f9c0e... (also in nginx-http2-evidence-...md.sha256)
以下三个条件必须同时满足:
--with-http_v2_module;官方构建版本包含)。http2 on;(1.25.1+)或 listen ... http2。处于受影响版本范围内但未启用 HTTP/2 的版本不会受此 CVE 影响,但仍应升级:相同的发布版本还修复了另外九个 CVE。
需要 bash(3.2+),以及根据模式所需的 kubectl、docker 或 openssl。
curl -fsSLO https://raw.githubusercontent.com/rogersouzak8s/nginx-http2-check/main/check-nginx-http2.sh
chmod +x check-nginx-http2.sh
./check-nginx-http2.sh k8s --context my-cluster -n my-namespace # a namespace (+ the cluster's ingress controllers)
./check-nginx-http2.sh k8s --context my-cluster -A # the whole cluster
./check-nginx-http2.sh docker # every running container
./check-nginx-http2.sh docker my-container
./check-nginx-http2.sh local # nginx on this host
./check-nginx-http2.sh probe app.example.com # does the endpoint offer HTTP/2?
| 选项 | |
|---|---|
--out FILE | 证据报告路径(默认 nginx-http2-evidence-<target>-<UTC>.md) |
--no-report | 仅打印 |
--no-probe | k8s:跳过对 ingress 主机的 ALPN 检查 |
--no-controllers | 配合 -n 的 k8s:不添加来自其他命名空间的 ingress controller pod |
--parallel N | 同时检查的容器数量(默认 8) |
--timeout S | 每条命令的超时秒数(默认 30) |
| 判定结果 | 含义 |
|---|---|
EXPOSED | 受影响版本,存在 HTTP/2 模块,HTTP/2 已开启 |
VULNERABLE-H2-OFF | 受影响版本,HTTP/2 已关闭:当前不受此 CVE 影响 |
FIXED | 1.30.7+、1.31.9+ 或更新版本 |
NOT-AFFECTED | 低于 1.9.5,或构建时未包含 HTTP/2 模块 |
UNDETERMINED | 无法读取版本或配置 |
若存在任何暴露项,退出码为 2;若没有暴露项但存在无法确定项,退出码为 3;否则为 0,因此可用于流水线门禁。
nginx -v(版本)、nginx -V(HTTP/2 模块)和 nginx -T(配置测试与转储)。当 /proc 显示主进程以 -c FILE 启动时,则使用该文件。在查找 http2 on; 和 listen ... http2 时会忽略注释。kubectl exec。配合 -n 时,它还会检查集群其他位置的 ingress controller pod(ingress-nginx、NGINX Ingress Controller),因为这些 pod 通常为该命名空间终止客户端的 HTTP/2。.sha256 文件。它从不更改配置、从不重载 nginx,也从不发送 HTTP/2 帧。
Kubernetes:在所检查的命名空间(以及 ingress controller 的命名空间)中,对 pod 和 ingress 需要 get/list 权限,对 pods/exec 需要 create 权限。无法 exec 进入的 pod 会显示为 UNDETERMINED。
PATH 中没有 nginx 的镜像只会在常规安装路径中搜索。http2 off;,或在 ingress-nginx ConfigMap 中设置 use-http2: "false")。这是研究人员的建议;F5 未列出缓解措施。这会破坏需要 HTTP/2 的客户端,例如通过 ingress 的 gRPC。./test-unit.sh # version ranges, parsing, HTTP/2 detection, verdicts
./test-integration.sh # real nginx containers (needs Docker)
CI 会运行 shellcheck、在 bash 5.3 和 3.2 上运行单元测试,以及集成测试。
MIT