From 72e6acf358183fbd4bcce774a2ecc4edc41ba1eb Mon Sep 17 00:00:00 2001 From: Diptendu Kar Date: Wed, 18 Nov 2026 13:44:48 -0500 Subject: [PATCH 1/2] nginx: cover CVE-2026-121810 (HTTP/3) and CVE-2026-113425 (mail proxy) The detector checked three of the five nginx CVEs fixed in 1.30.7 and 1.31.9. A host with HTTP/2 off and no resolver, but with a QUIC listener or a mail proxy, came back "not impacted" while still exposed. This adds the other two, in the same shape as the existing checks: - version: CVE-2026-121810 from 1.25.0, CVE-2026-113425 from 0.5.33. NGINX Plus fixes both in 37.0.8 / 37.3.0, with CVE-2026-123007 and CVE-2026-123634 (release notes for PLS.37.0.8.1 and PLS.37.3.0.1). - http/3: built with --with-http_v3_module, and a listen directive with the quic parameter in an http server{}. - mail: built with --with-mail (or --with-mail=dynamic), and a server{} in mail{}. The backport check needs no change: it already looks for each CVE that applies. Two existing fixtures contain a mail server and now report the mail CVE; their expectations are updated. Co-Authored-By: Claude Mythos 5.2 --- .github/workflows/nginx-http2-linux.yml | 2 +- CVE-2026-123633.CVE-2026-123007/README.md | 99 ++++++--- .../linux/detect-nginx-http2.sh | 101 +++++++-- .../linux/k8s-nginx-http2.yaml | 4 +- .../linux/ssh-nginx-http2.sh | 5 +- .../linux/tests/fake-nginx | 15 +- .../linux/tests/run-tests.sh | 198 ++++++++++++++---- README.md | 2 +- 8 files changed, 334 insertions(+), 92 deletions(-) diff --git a/.github/workflows/nginx-http2-linux.yml b/.github/workflows/nginx-http2-linux.yml index 5ce40bd..d120ad4 100644 --- a/.github/workflows/nginx-http2-linux.yml +++ b/.github/workflows/nginx-http2-linux.yml @@ -1,4 +1,4 @@ -name: nginx (CVE-2026-123007, CVE-2026-123633, CVE-2026-123634) bash detector +name: nginx (CVE-2026-123007, CVE-2026-123633, CVE-2026-123634, CVE-2026-121810, CVE-2026-113425) bash detector on: push: diff --git a/CVE-2026-123633.CVE-2026-123007/README.md b/CVE-2026-123633.CVE-2026-123007/README.md index 13b1eaf..628d047 100644 --- a/CVE-2026-123633.CVE-2026-123007/README.md +++ b/CVE-2026-123633.CVE-2026-123007/README.md @@ -1,6 +1,6 @@ -# CVE-2026-123007, CVE-2026-123633 and CVE-2026-123634 (nginx) detection +# CVE-2026-123007, CVE-2026-123633, CVE-2026-123634, CVE-2026-121810 and CVE-2026-113425 (nginx) detection -Fleet checks for three nginx worker memory-corruption bugs that were fixed +Fleet checks for five nginx worker memory-corruption bugs that were fixed together in nginx 1.30.7 and 1.31.9 on 2026-11-18. Each one is reached through a feature the config has to turn on: @@ -9,6 +9,8 @@ through a feature the config has to turn on: | CVE-2026-123007 | Memory corruption in HTTP/2 flow control | major | HTTP/2 | 1.9.5-1.31.8 | 1.30.7+, 1.31.9+ | | CVE-2026-123633 | Use-after-free in HTTP/2 | medium | HTTP/2 | 1.19.7-1.31.8 | 1.30.7+, 1.31.9+ | | CVE-2026-123634 | Use-after-free during response processing in resolver | medium | `resolver` | 0.6.18-1.31.8 | 1.30.7+, 1.31.9+ | +| CVE-2026-121810 | Use-after-free in HTTP/3 | medium | HTTP/3 (QUIC) | 1.25.0-1.31.8 | 1.30.7+, 1.31.9+ | +| CVE-2026-113425 | Use-after-free in mail proxy module | major | mail proxy | 0.5.33-1.31.8 | 1.30.7+, 1.31.9+ | **The HTTP/2 pair.** Wiz rates both CVSS 4.0 9.2 and shows remote code execution in a worker process. @@ -24,9 +26,19 @@ freeing it. The stated impact is a segmentation fault in a worker process, "or might have potential other impact". Turning HTTP/2 off does nothing for this one; it needs an upgrade. -The same releases fix seven other CVEs, including CVE-2026-121810, a similar -use-after-free in HTTP/3. These scripts check only the three CVEs above; see -the nginx.org advisories page for the others. +**HTTP/3 and the mail proxy.** Neither is in the Wiz write-up; both are in +Xint's. +- CVE-2026-121810 is the HTTP/3 counterpart of CVE-2026-123633. The nginx + changelog says a "use-after-free might occur in a worker process when + using HTTP/3 if worker_connections were not enough". +- CVE-2026-113425 is a "use-after-free [that] might occur in a worker + process in the mail proxy server". It is reached during login, before any + credentials are checked. + +Turning HTTP/2 off does nothing for these two either. + +The same releases fix five other CVEs. These scripts check only the five +above; see the nginx.org advisories page for the others. ## Directory contents @@ -34,7 +46,7 @@ the nginx.org advisories page for the others. | File | Purpose | |---|---| -| `linux/detect-nginx-http2.sh` | Host detector (bash 3.2+). The name predates CVE-2026-123634; it checks all three CVEs. | +| `linux/detect-nginx-http2.sh` | Host detector (bash 3.2+). The name predates the CVEs outside HTTP/2; it checks all five. | | `linux/ssh-nginx-http2.sh` | Fleet run over plain SSH | | `linux/k8s-nginx-http2.yaml` | Fleet run as a privileged Kubernetes DaemonSet | @@ -49,15 +61,16 @@ show `[!]`. An nginx is impacted when at least one CVE applies, and the result line lists the CVEs that do (`=> [!] impacted: CVE-2026-123634`). 1. **version**: `nginx -V` reports a version that has at least one of the bugs. - - nginx open source: from 0.6.18 (CVE-2026-123634), 1.9.5 - (CVE-2026-123007) or 1.19.7 (CVE-2026-123633), through 1.31.8. 1.30.7 - and later 1.30.x releases are fixed. + - nginx open source: from 0.5.33 (CVE-2026-113425), 0.6.18 + (CVE-2026-123634), 1.9.5 (CVE-2026-123007), 1.19.7 (CVE-2026-123633) + or 1.25.0 (CVE-2026-121810), through 1.31.8. 1.30.7 and later 1.30.x + releases are fixed. - NGINX Plus (read from `(nginx-plus-r...)` in the version string): - R-series (R36 and earlier): affected; no R-series fix exists. - - PLS.37.0.x LTS: all three before 37.0.7; CVE-2026-123007 and - CVE-2026-123634 in 37.0.7; fixed from 37.0.8. - - PLS.37.x CR: all three in 37.1.x; CVE-2026-123007 and CVE-2026-123634 - in 37.2.x; fixed from 37.3.0. + - PLS.37.0.x LTS: all five before 37.0.7; all but CVE-2026-123633 in + 37.0.7; fixed from 37.0.8. + - PLS.37.x CR: all five in 37.1.x; all but CVE-2026-123633 in 37.2.x; + fixed from 37.3.0. - 38 and later: not affected. - OpenResty: judged on its nginx core (`openresty/1.27.1.2` → 1.27.1). A fixed core is `OK`; an affected core is `[?]`, because OpenResty may ship @@ -93,6 +106,14 @@ result line lists the CVEs that do (`=> [!] impacted: CVE-2026-123634`). modules (`auth_request`, SSI, `mirror`, `slice`, `addition`, njs, Lua), so the script does not try to rule them out: a configured resolver counts as exposed. + - **http/3** (CVE-2026-121810): the binary was built with + `--with-http_v3_module`, and a `listen` directive in an http `server {}` + has the `quic` parameter. As with the HTTP/2 use-after-free, the script + does not try to tell whether `worker_connections` can run out: an + attacker fills them. + - **mail** (CVE-2026-113425): the binary was built with `--with-mail` + (or `--with-mail=dynamic`), and `mail {}` has at least one `server {}`. + Any protocol counts: IMAP, POP3 or SMTP. The script reads the config files itself, starting at the master's `-c` file (or the binary's built-in `--conf-path`) and following `include` directives, @@ -109,24 +130,29 @@ edited them without reloading, the running config may differ. ## Output ``` -nginx check: CVE-2026-123007, CVE-2026-123633 (HTTP/2) and CVE-2026-123634 (resolver) +nginx check: CVE-2026-123007, CVE-2026-123633 (HTTP/2), CVE-2026-123634 (resolver), CVE-2026-121810 (HTTP/3) and CVE-2026-113425 (mail proxy) legend: [!] impacted | OK not impacted | [?] could not check | n/a not checked -checks: version, backport, then http/2 (CVE-2026-123007, CVE-2026-123633) or resolver (CVE-2026-123634). +checks: version, backport, then http/2 (CVE-2026-123007, CVE-2026-123633), resolver (CVE-2026-123634), + http/3 (CVE-2026-121810) or mail (CVE-2026-113425). A CVE applies only if version, backport and its own check all show [!]. host: Linux x86_64 /usr/sbin/nginx (pid 812) - version: nginx/1.24.0 (Ubuntu): CVE-2026-123007 CVE-2026-123633 CVE-2026-123634 [!] - backport: nginx 1.24.0-2ubuntu7.19 (dpkg), changelog does not list CVE-2026-123007 CVE-2026-123633 CVE-2026-123634 [!] + version: nginx/1.24.0 (Ubuntu): CVE-2026-123007 CVE-2026-123633 CVE-2026-123634 CVE-2026-113425 [!] + backport: nginx 1.24.0-2ubuntu7.19 (dpkg), changelog does not list CVE-2026-123007 CVE-2026-123633 CVE-2026-123634 CVE-2026-113425 [!] http/2: on, listen 443 ssl http2 (/etc/nginx/sites-enabled/default) [!] resolver: not set (/etc/nginx/nginx.conf) OK + http/3: - n/a + mail: no mail server (/etc/nginx/nginx.conf) OK => [!] impacted: CVE-2026-123007 CVE-2026-123633 /usr/sbin/nginx (pid 40211, container web-6c9f7d8b5-x2x7q) - version: nginx/1.30.6: CVE-2026-123007 CVE-2026-123633 CVE-2026-123634 [!] + version: nginx/1.30.6: CVE-2026-123007 CVE-2026-123633 CVE-2026-123634 CVE-2026-121810 CVE-2026-113425 [!] backport: nginx 1.30.6-1~trixie (dpkg), nginx.org package: fixed only by upgrading [!] http/2: off (/etc/nginx/nginx.conf) OK resolver: on, resolver 10.96.0.10 valid=10s (/etc/nginx/conf.d/default.conf) [!] + http/3: off (/etc/nginx/nginx.conf) OK + mail: no mail server (/etc/nginx/nginx.conf) OK => [!] impacted: CVE-2026-123634 impacted @@ -139,7 +165,7 @@ Each nginx instance gets one block. Each check ends in one of four markers: - `[?]`: could not check. - `n/a`: not checked, because no open CVE depends on it. For example, the feature checks are `n/a` once the version or the backport rules out every - CVE they gate. + CVE they gate, and `http/3` is `n/a` on a version older than 1.25.0. The title line names the binary and where it came from: @@ -149,8 +175,8 @@ The title line names the binary and where it came from: is the pod name; in Docker it is the short container ID. - `-n`: a binary passed on the command line. -The http/2 and resolver lines name the file and directive that turned the -feature on. `-q` prints only the verdict line. +The http/2, resolver, http/3 and mail lines name the file and directive that +turned the feature on. `-q` prints only the verdict line. ## Exit codes @@ -195,8 +221,8 @@ as cloud load balancers or a CDN. Check those vendors' advisories. ### Kubernetes ingress `ingress-nginx` controller pods run nginx with HTTP/2 enabled by default and -set `resolver` to the cluster DNS, so expect the detector to report all three -CVEs for them. The DaemonSet below checks them like any other container. The +set `resolver` to the cluster DNS, so expect the detector to report the HTTP/2 +pair and the resolver CVE for them. The DaemonSet below checks them like any other container. The `kubernetes/ingress-nginx` project ended maintenance in March 2026 and releases no security fixes ([Kubernetes blog](https://kubernetes.io/blog/2025/11/11/ingress-nginx-retirement/)). @@ -255,7 +281,7 @@ script into your own image. ## Remediation -1. **Upgrade.** This is the only fix that covers all three CVEs. +1. **Upgrade.** This is the only fix that covers all five CVEs. - Install nginx 1.30.7 / 1.31.9 or later, NGINX Plus PLS.37.0.8.1 LTS / PLS.37.3.0.1 CR, or your distribution's patched package. - Then make sure the old master is gone: a binary upgrade or a restart. @@ -282,6 +308,14 @@ script into your own image. Without a resolver, those fail. In most setups that use a resolver, upgrading is the practical fix. +4. **Until you can upgrade, CVE-2026-121810:** turn HTTP/3 off. Remove the + `quic` listeners (`listen ... quic`), stop advertising HTTP/3 in + `Alt-Svc`, and reload. Clients fall back to HTTP/2 or HTTP/1.1 over TCP. + Re-run the detector: the http/3 line names any listener it still finds. +5. **Until you can upgrade, CVE-2026-113425:** keep untrusted clients away + from the mail proxy. Bind its listeners to loopback if nothing remote + needs them, or restrict them with a firewall to the addresses you trust. + The bug is reached before authentication, so credentials do not help. ## Sources @@ -293,18 +327,25 @@ script into your own image. 1.30.7+". - CVE-2026-123634: "Vulnerable: 0.6.18-1.31.8. Not vulnerable: 1.31.9+, 1.30.7+". + - CVE-2026-121810: "Vulnerable: 1.25.0-1.31.8. Not vulnerable: 1.31.9+, + 1.30.7+". + - CVE-2026-113425: "Vulnerable: 0.5.33-1.31.8. Not vulnerable: 1.31.9+, + 1.30.7+". - Changelogs: `CHANGES` for 1.31.9 and `CHANGES-1.30` for 1.30.7, both dated 18 Nov 2026. -- F5 advisories: K000163926 (CVE-2026-123007), K000163928 (CVE-2026-123633) - and K000163925 (CVE-2026-123634). +- F5 advisories: K000163926 (CVE-2026-123007), K000163928 (CVE-2026-123633), + K000163925 (CVE-2026-123634), K000163927 (CVE-2026-121810) and K000163931 + (CVE-2026-113425). - NGINX Plus fix versions: the release notes at - . CVE-2026-123634 is listed under - PLS.37.0.8.1 LTS and PLS.37.3.0.1 CR. + . CVE-2026-123634, CVE-2026-121810 + and CVE-2026-113425 are listed under PLS.37.0.8.1 LTS and PLS.37.3.0.1 CR. - `resolver` contexts: the `ngx_http_core_module` and `ngx_http_upstream_module` docs on nginx.org. - Wiz Research write-up (HTTP/2 CVEs only): . +- Xint write-up (all five, including HTTP/3 and the mail proxy): + . As of 2026-11-18, no Debian, Ubuntu or AlmaLinux package changelog listed any -of the three CVEs. When vendors ship fixes, the backport check picks them up +of the five CVEs. When vendors ship fixes, the backport check picks them up with no script change. diff --git a/CVE-2026-123633.CVE-2026-123007/linux/detect-nginx-http2.sh b/CVE-2026-123633.CVE-2026-123007/linux/detect-nginx-http2.sh index 284639a..7d13d0b 100755 --- a/CVE-2026-123633.CVE-2026-123007/linux/detect-nginx-http2.sh +++ b/CVE-2026-123633.CVE-2026-123007/linux/detect-nginx-http2.sh @@ -2,7 +2,7 @@ # # detect-nginx-http2.sh # -# Checks whether this host has an nginx exposed to three worker memory- +# Checks whether this host has an nginx exposed to five worker memory- # corruption bugs fixed in nginx 1.30.7 and 1.31.9 (2026-11-18), each reached # through a feature the config has to turn on: # @@ -11,8 +11,11 @@ # connections run out # CVE-2026-123634 resolver use-after-free when the same nginx 0.6.18-1.31.8 # name is resolved in subrequests +# CVE-2026-121810 HTTP/3 use-after-free when worker nginx 1.25.0-1.31.8 +# connections run out +# CVE-2026-113425 mail proxy use-after-free nginx 0.5.33-1.31.8 # -# All three are fixed in nginx 1.30.7+ (stable) and 1.31.9+ (mainline), and +# All five are fixed in nginx 1.30.7+ (stable) and 1.31.9+ (mainline), and # in NGINX Plus PLS.37.0.8.1 LTS / PLS.37.3.0.1 CR. (PLS.37.0.7.1 and # PLS.37.2.0.1 fix CVE-2026-123633 only.) # @@ -35,6 +38,10 @@ # other trigger, come from too many modules # (auth_request, ssi, mirror, slice, njs, Lua) to # rule out, so they are assumed. +# http/3 (CVE-2026-121810) built with --with-http_v3_module, +# and a listen directive with the quic parameter. +# mail (CVE-2026-113425) built with --with-mail, and a +# server{} in mail{}. # An nginx is impacted when at least one CVE applies. # # What gets checked: @@ -67,6 +74,9 @@ PROBE_TIMEOUT="${NGINX_HTTP2_PROBE_TIMEOUT:-15}" CVE_WIN=CVE-2026-123007 CVE_UAF=CVE-2026-123633 CVE_RES=CVE-2026-123634 +CVE_H3=CVE-2026-121810 +CVE_MAIL=CVE-2026-113425 +ALL_CVES="$CVE_WIN $CVE_UAF $CVE_RES $CVE_H3 $CVE_MAIL" QUIET=0 VERBOSE=0 @@ -176,9 +186,10 @@ single() { } header() { - say "nginx check: $CVE_WIN, $CVE_UAF (HTTP/2) and $CVE_RES (resolver)" + say "nginx check: $CVE_WIN, $CVE_UAF (HTTP/2), $CVE_RES (resolver), $CVE_H3 (HTTP/3) and $CVE_MAIL (mail proxy)" say "legend: [!] impacted | OK not impacted | [?] could not check | n/a not checked" - say "checks: version, backport, then http/2 ($CVE_WIN, $CVE_UAF) or resolver ($CVE_RES)." + say "checks: version, backport, then http/2 ($CVE_WIN, $CVE_UAF), resolver ($CVE_RES)," + say " http/3 ($CVE_H3) or mail ($CVE_MAIL)." say " A CVE applies only if version, backport and its own check all show [!]." } @@ -210,9 +221,11 @@ ver_key() { echo $(( 10#${1:-0} * 1000000 + 10#${2:-0} * 1000 + 10#${3:-0} )) } +K_FIRST_MAIL=$(ver_key 0.5.33) # CVE-2026-113425 from here; the oldest of the five K_FIRST_RES=$(ver_key 0.6.18) # CVE-2026-123634 from here K_FIRST_WIN=$(ver_key 1.9.5) # HTTP/2 module added; CVE-2026-123007 from here K_FIRST_UAF=$(ver_key 1.19.7) # CVE-2026-123633 from here +K_FIRST_H3=$(ver_key 1.25.0) # HTTP/3 module added; CVE-2026-121810 from here K_FIXED_STABLE=$(ver_key 1.30.7) K_NEXT_MAIN=$(ver_key 1.31.0) K_FIXED_MAIN=$(ver_key 1.31.9) @@ -224,6 +237,8 @@ from_base() { [ "$1" -ge "$K_FIRST_WIN" ] && out="$CVE_WIN" [ "$1" -ge "$K_FIRST_UAF" ] && out="$out $CVE_UAF" [ "$1" -ge "$K_FIRST_RES" ] && out="$out $CVE_RES" + [ "$1" -ge "$K_FIRST_H3" ] && out="$out $CVE_H3" + [ "$1" -ge "$K_FIRST_MAIL" ] && out="$out $CVE_MAIL" echo "${out# }" } @@ -241,7 +256,7 @@ affected_oss() { # BASE: the open source version it is built on, e.g. 1.29.8 # The R-series (R36 and older) got no fix. PLS.37: LTS track 37.0.P, CR track # 37.M.P (M >= 1). 37.0.7 / 37.2.0 fixed CVE-2026-123633; 37.0.8 / 37.3.0 -# fixed CVE-2026-123007 and CVE-2026-123634 as well. +# fixed the other four as well. affected_plus() { local tag=$1 major rest minor patch out="" major=${tag%%[!0-9]*} @@ -264,7 +279,7 @@ affected_plus() { out="$out $CVE_UAF" fi if ! { [ "$minor" -eq 0 ] && [ "$patch" -ge 8 ]; } && [ "$minor" -lt 3 ]; then - out="$out $CVE_RES" + out="$out $CVE_RES $CVE_H3 $CVE_MAIL" fi echo "${out# }" } @@ -393,8 +408,8 @@ END { endword() }' -# Reads FILETYPEWORDS lines from conf_stream and prints two lines, -# "h2STATEWHERE" and "resSTATEWHERE", where STATE is +# Reads FILETYPEWORDS lines from conf_stream and prints four lines, +# "KEYSTATEWHERE" for the keys h2, res, h3 and mail, where STATE is # on the feature is used; WHERE names the directive and its file # off it is not # unknown it is not used in what could be read, but WHERE could not be read @@ -403,15 +418,18 @@ END { # The resolver is on when a "resolver" directive appears anywhere in http{} # (http, server, location or upstream level). stream{} and mail{} resolvers # do not count: the bug needs HTTP subrequests. +# HTTP/3 is on when a listen directive in an http server{} has the quic +# parameter. The mail proxy is on when mail{} has a server{}. # shellcheck disable=SC2016 EVALUATE=' -BEGIN { FS = "\t"; US = sprintf("%c", 31); d = 0; ns = 0; hv = ""; hf = ""; on = ""; res = ""; bad = "" } +BEGIN { FS = "\t"; US = sprintf("%c", 31); d = 0; ns = 0; hv = ""; hf = ""; on = ""; res = ""; h3 = ""; ml = ""; bad = "" } $1 == "!" { if (bad == "") bad = $2; next } { f = $1; t = $2; nw = split($3, w, US) if (t == "{") { d++; ctx[d] = (nw ? w[1] : "") if (d == 2 && ctx[1] == "http" && ctx[2] == "server") { ns++; sv[ns] = ""; sf[ns] = "" } + if (d == 2 && ctx[1] == "mail" && ctx[2] == "server" && ml == "") ml = "mail server (" f ")" next } if (t == "}") { if (d > 0) d--; next } @@ -432,6 +450,15 @@ $1 == "!" { if (bad == "") bad = $2; next } on = on " (" f ")" } } + if (w[1] == "listen" && h3 == "") { + h = 0 + for (k = 2; k <= nw; k++) if (w[k] == "quic") h = 1 + if (h) { + h3 = "listen" + for (k = 2; k <= nw; k++) h3 = h3 " " w[k] + h3 = h3 " (" f ")" + } + } } } END { @@ -445,6 +472,12 @@ END { if (res != "") print "res\ton\t" res else if (bad != "") print "res\tunknown\t" bad else print "res\toff\t" + if (h3 != "") print "h3\ton\t" h3 + else if (bad != "") print "h3\tunknown\t" bad + else print "h3\toff\t" + if (ml != "") print "mail\ton\t" ml + else if (bad != "") print "mail\tunknown\t" bad + else print "mail\toff\t" }' # conf_glob ROOT PATTERN: the files an include PATTERN names, one per line, @@ -638,8 +671,8 @@ backport() { probe() { local title=$1 prefix=$2 bin=$3 root=$4 exe=$5 conf=$6 pfx=$7 replaced=$8 local out vline vstr prod ver tag cargs aff core plus=0 ev result - local remain c g need_h2=0 need_rs=0 imp="" unk=0 - local s_ver v_ver s_bp v_bp s_h2 v_h2 s_rs v_rs + local remain c g need_h2=0 need_rs=0 need_h3=0 need_ml=0 imp="" unk=0 + local s_ver v_ver s_bp v_bp s_h2 v_h2 s_rs v_rs s_h3 v_h3 s_ml v_ml # shellcheck disable=SC2086 out=$($TO $prefix "$bin" -V 2>&1 /dev/null > "$OUT/.all" || true -echo "nginx CVE-2026-123007/123633/123634 fleet detection ($n host(s))" +echo "nginx CVE-2026-123007/123633/123634/121810/113425 fleet detection ($n host(s))" for v in impacted unknown "not impacted"; do hs=$(awk -F'\t' -v V="$v" '$1==V{print $2}' "$OUT/.all" 2>/dev/null | sort | tr '\n' ' ') printf ' %-13s %s\n' "$v:" "${hs:-(none)}" diff --git a/CVE-2026-123633.CVE-2026-123007/linux/tests/fake-nginx b/CVE-2026-123633.CVE-2026-123007/linux/tests/fake-nginx index 2dfd553..4512658 100755 --- a/CVE-2026-123633.CVE-2026-123007/linux/tests/fake-nginx +++ b/CVE-2026-123633.CVE-2026-123007/linux/tests/fake-nginx @@ -6,6 +6,9 @@ # FAKE_CONF --conf-path value (default /etc/nginx/nginx.conf) # FAKE_PREFIX --prefix value (default /usr/share/nginx) # FAKE_NO_H2 set: build without --with-http_v2_module +# FAKE_NO_H3 set: build without --with-http_v3_module +# FAKE_NO_MAIL set: build without --with-mail (keeps --with-mail_ssl_module) +# FAKE_MAIL_DYNAMIC set: build with --with-mail=dynamic # FAKE_FAIL set: fail to run case "${1:-}" in -V) ;; @@ -15,8 +18,16 @@ if [ -n "${FAKE_FAIL:-}" ]; then echo "fake-nginx: error while loading shared libraries: libssl.so.3" >&2 exit 127 fi -mods="--with-http_ssl_module --with-http_v2_module --with-http_v3_module" -[ -n "${FAKE_NO_H2:-}" ] && mods="--with-http_ssl_module" +mods="--with-http_ssl_module" +[ -n "${FAKE_NO_H2:-}" ] || mods="$mods --with-http_v2_module" +[ -n "${FAKE_NO_H3:-}" ] || mods="$mods --with-http_v3_module" +if [ -n "${FAKE_MAIL_DYNAMIC:-}" ]; then + mods="$mods --with-mail=dynamic --with-mail_ssl_module" +elif [ -z "${FAKE_NO_MAIL:-}" ]; then + mods="$mods --with-mail --with-mail_ssl_module" +else + mods="$mods --with-mail_ssl_module" +fi { echo "${FAKE_VLINE:-nginx version: nginx/1.24.0}" echo "built with OpenSSL 3.0.13 30 Jan 2024" diff --git a/CVE-2026-123633.CVE-2026-123007/linux/tests/run-tests.sh b/CVE-2026-123633.CVE-2026-123007/linux/tests/run-tests.sh index 1ec2370..1a0e037 100755 --- a/CVE-2026-123633.CVE-2026-123007/linux/tests/run-tests.sh +++ b/CVE-2026-123633.CVE-2026-123007/linux/tests/run-tests.sh @@ -127,56 +127,143 @@ http { } EOF ) +H3ON=$(conf h3/nginx.conf <<'EOF' +events {} +http { + server { listen 443 quic reuseport; listen 443 ssl; } +} +EOF +) +MAILON=$(conf mail/nginx.conf <<'EOF' +events {} +mail { + auth_http 127.0.0.1:9000/auth; + server { listen 143; protocol imap; } +} +http { + server { listen 80; } +} +EOF +) ALL3="CVE-2026-123007 CVE-2026-123633 CVE-2026-123634" +# before 1.25.0 there is no HTTP/3 module, so no CVE-2026-121810 +ALL4="$ALL3 CVE-2026-113425" +ALL5="$ALL3 CVE-2026-121810 CVE-2026-113425" run "${F[@]}" -c "$H2ON"; check "default fake 1.24.0, http2 on -> impacted" 1 \ - "legend: [!] impacted" "checks: version, backport, then http/2 (CVE-2026-123007, CVE-2026-123633) or resolver (CVE-2026-123634)." \ - " version: nginx/1.24.0: $ALL3 [!]" \ + "legend: [!] impacted" "checks: version, backport, then http/2 (CVE-2026-123007, CVE-2026-123633), resolver (CVE-2026-123634)," \ + " http/3 (CVE-2026-121810) or mail (CVE-2026-113425)." \ + " version: nginx/1.24.0: $ALL4 [!]" \ " backport: not owned by a package [!]" " http/2: on, http2 on ($H2ON) [!]" \ - " resolver: not set ($H2ON) OK" " => [!] impacted: CVE-2026-123007 CVE-2026-123633" + " resolver: not set ($H2ON) OK" " http/3: - n/a" " mail: no mail server ($H2ON) OK" \ + " => [!] impacted: CVE-2026-123007 CVE-2026-123633" run "${F[@]}" -c "$H2ON" -q; check "quiet prints verdict only" 1 [ "$(printf '%s\n' "$OUT" | wc -l | tr -d ' ')" -eq 1 ] || { FAIL=$((FAIL + 1)); echo "FAIL quiet printed more than one line"; } -run "${F[@]}" -c "$H2OFF"; check "http2 off, no resolver -> not impacted" 0 " http/2: off ($H2OFF) OK" " resolver: not set ($H2OFF) OK" " => OK" +run "${F[@]}" -c "$H2OFF"; check "http2 off, no resolver -> not impacted" 0 " http/2: off ($H2OFF) OK" " resolver: not set ($H2OFF) OK" " mail: no mail server ($H2OFF) OK" " => OK" run "${F[@]}" -c "$RES"; check "http2 off, resolver set -> impacted by CVE-2026-123634 only" 1 \ " http/2: off ($RES) OK" " resolver: on, resolver 10.0.0.2 valid=30s ($RES) [!]" " => [!] impacted: CVE-2026-123634" for spec in \ - "0.6.17|0|nginx/0.6.17 (older than 0.6.18) OK" \ - "0.6.18|0|nginx/0.6.18: CVE-2026-123634 [!]" \ - "1.9.4|0|nginx/1.9.4: CVE-2026-123634 [!]" \ - "1.9.5|1|nginx/1.9.5: CVE-2026-123007 CVE-2026-123634 [!]" \ - "1.19.6|1|nginx/1.19.6: CVE-2026-123007 CVE-2026-123634 [!]" \ - "1.19.7|1|nginx/1.19.7: $ALL3 [!]" \ - "1.29.8|1|nginx/1.29.8: $ALL3 [!]" \ - "1.30.6|1|nginx/1.30.6: $ALL3 [!]" \ + "0.5.32|0|nginx/0.5.32 (older than 0.5.33) OK" \ + "0.5.33|0|nginx/0.5.33: CVE-2026-113425 [!]" \ + "0.6.17|0|nginx/0.6.17: CVE-2026-113425 [!]" \ + "0.6.18|0|nginx/0.6.18: CVE-2026-123634 CVE-2026-113425 [!]" \ + "1.9.4|0|nginx/1.9.4: CVE-2026-123634 CVE-2026-113425 [!]" \ + "1.9.5|1|nginx/1.9.5: CVE-2026-123007 CVE-2026-123634 CVE-2026-113425 [!]" \ + "1.19.6|1|nginx/1.19.6: CVE-2026-123007 CVE-2026-123634 CVE-2026-113425 [!]" \ + "1.19.7|1|nginx/1.19.7: $ALL4 [!]" \ + "1.24.9|1|nginx/1.24.9: $ALL4 [!]" \ + "1.25.0|1|nginx/1.25.0: $ALL5 [!]" \ + "1.29.8|1|nginx/1.29.8: $ALL5 [!]" \ + "1.30.6|1|nginx/1.30.6: $ALL5 [!]" \ "1.30.7|0|nginx/1.30.7 (fixed) OK" \ "1.30.12|0|nginx/1.30.12 (fixed) OK" \ - "1.31.0|1|nginx/1.31.0: $ALL3 [!]" \ - "1.31.8|1|nginx/1.31.8: $ALL3 [!]" \ + "1.31.0|1|nginx/1.31.0: $ALL5 [!]" \ + "1.31.8|1|nginx/1.31.8: $ALL5 [!]" \ "1.31.9|0|nginx/1.31.9 (fixed) OK" \ "1.32.0|0|nginx/1.32.0 (fixed) OK" \ - "1.24.0 (Ubuntu)|1|nginx/1.24.0 (Ubuntu): $ALL3 [!]"; do + "1.24.0 (Ubuntu)|1|nginx/1.24.0 (Ubuntu): $ALL4 [!]"; do v=${spec%%|*}; rest=${spec#*|}; want=${rest%%|*}; text=${rest#*|} V "nginx/$v"; run "${F[@]}" -c "$H2ON"; check "version $v (http2 on)" "$want" "$text" done V "nginx/0.6.18"; run "${F[@]}" -c "$RES"; check "0.6.18 with a resolver -> impacted" 1 "http/2: - n/a" "=> [!] impacted: CVE-2026-123634" V "nginx/1.19.6"; run "${F[@]}" -c "$H2ON"; check "1.19.6: only CVE-2026-123007 applies" 1 "=> [!] impacted: CVE-2026-123007" -V "nginx/1.30.7"; run "${F[@]}" -c "$H2ON"; check "fixed: later checks not run" 0 " backport: - n/a" " http/2: - n/a" " resolver: - n/a" +V "nginx/1.30.7"; run "${F[@]}" -c "$H2ON"; check "fixed: later checks not run" 0 " backport: - n/a" " http/2: - n/a" " resolver: - n/a" " http/3: - n/a" " mail: - n/a" V "nginx/1.31.9"; run "${F[@]}" -c "$RES"; check "fixed, resolver set -> ok" 0 " resolver: - n/a" +echo +echo "## HTTP/3 and mail" +V "nginx/1.31.8"; run "${F[@]}" -c "$H3ON"; check "quic listener -> impacted by CVE-2026-121810 only" 1 \ + " version: nginx/1.31.8: $ALL5 [!]" " http/2: off ($H3ON) OK" " resolver: not set ($H3ON) OK" \ + " http/3: on, listen 443 quic reuseport ($H3ON) [!]" " mail: no mail server ($H3ON) OK" \ + " => [!] impacted: CVE-2026-121810" +V "nginx/1.25.0"; run "${F[@]}" -c "$H3ON"; check "1.25.0, the first release with HTTP/3 -> impacted" 1 "=> [!] impacted: CVE-2026-121810" +V "nginx/1.24.9"; run "${F[@]}" -c "$H3ON"; check "quic listener before 1.25.0 -> not impacted" 0 " http/3: - n/a" " => OK" +V "nginx/1.31.8"; run "${F[@]}" -c "$MAILON"; check "mail server -> impacted by CVE-2026-113425 only" 1 \ + " http/2: off ($MAILON) OK" " http/3: off ($MAILON) OK" " mail: on, mail server ($MAILON) [!]" \ + " => [!] impacted: CVE-2026-113425" +V "nginx/0.5.33"; run "${F[@]}" -c "$MAILON"; check "0.5.33 with a mail server -> impacted" 1 \ + "http/2: - n/a" "resolver: - n/a" "http/3: - n/a" "=> [!] impacted: CVE-2026-113425" +V "nginx/0.5.32"; run "${F[@]}" -c "$MAILON"; check "0.5.32 with a mail server -> not impacted" 0 "(older than 0.5.33) OK" +V "nginx/1.31.9"; run "${F[@]}" -c "$MAILON"; check "fixed, mail server -> ok" 0 " mail: - n/a" +P=$(conf h23/nginx.conf <<'EOF' +events {} +http { + server { listen 443 quic; listen 443 ssl; http2 on; } +} +EOF +) +V "nginx/1.31.8"; run "${F[@]}" -c "$P"; check "http2 and quic on one server -> all three" 1 \ + "=> [!] impacted: CVE-2026-123007 CVE-2026-123633 CVE-2026-121810" +P=$(conf mailempty/nginx.conf <<'EOF' +events {} +mail { + auth_http 127.0.0.1:9000/auth; +} +http { server { listen 80; } } +EOF +) +V "nginx/1.31.8"; run "${F[@]}" -c "$P"; check "mail{} without a server -> not impacted" 0 " mail: no mail server ($P) OK" +P=$(conf quicstream/nginx.conf <<'EOF' +events {} +stream { + server { listen 443 udp; proxy_pass 10.0.0.5:443; } +} +http { + # server { listen 443 quic; } + server { listen 80; location / { return 200 "listen 443 quic;"; } } +} +mail_like { server { listen 25; } } +EOF +) +V "nginx/1.31.8"; run "${F[@]}" -c "$P"; check "comments, strings, stream{} and other blocks do not turn http/3 or mail on" 0 \ + " http/3: off ($P) OK" " mail: no mail server ($P) OK" +mkdir -p "$WORK/incq/conf.d" +P=$(conf incq/nginx.conf <<'EOF' +events {} +http { include conf.d/*.conf; } +include mail.conf; +EOF +) +printf 'server { listen 8443 quic; listen 8443 ssl; }\n' > "$WORK/incq/conf.d/site.conf" +printf 'mail { auth_http 127.0.0.1:9000/auth; server { listen 25; protocol smtp; } }\n' > "$WORK/incq/mail.conf" +V "nginx/1.31.8"; run "${F[@]}" -c "$P"; check "quic listener and mail server in included files" 1 \ + " http/3: on, listen 8443 quic ($WORK/incq/conf.d/site.conf) [!]" " mail: on, mail server ($WORK/incq/mail.conf) [!]" \ + " => [!] impacted: CVE-2026-121810 CVE-2026-113425" + echo echo "## NGINX Plus" for spec in \ - "nginx/1.27.4 (nginx-plus-r34-p1)|1|$ALL3 [!]" \ - "nginx/1.29.3 (nginx-plus-r36-p8)|1|$ALL3 [!]" \ - "nginx/1.19.5 (nginx-plus-r23)|1|nginx/1.19.5 (nginx-plus-r23): CVE-2026-123007 CVE-2026-123634 [!]" \ - "nginx/1.29.8 (nginx-plus-r37.0.0)|1|$ALL3 [!]" \ - "nginx/1.29.8 (nginx-plus-r37.0.6)|1|$ALL3 [!]" \ - "nginx/1.29.8 (nginx-plus-r37.0.7)|1|(nginx-plus-r37.0.7): CVE-2026-123007 CVE-2026-123634 [!]" \ + "nginx/1.27.4 (nginx-plus-r34-p1)|1|$ALL5 [!]" \ + "nginx/1.29.3 (nginx-plus-r36-p8)|1|$ALL5 [!]" \ + "nginx/1.19.5 (nginx-plus-r23)|1|nginx/1.19.5 (nginx-plus-r23): CVE-2026-123007 CVE-2026-123634 CVE-2026-113425 [!]" \ + "nginx/1.29.8 (nginx-plus-r37.0.0)|1|$ALL5 [!]" \ + "nginx/1.29.8 (nginx-plus-r37.0.6)|1|$ALL5 [!]" \ + "nginx/1.29.8 (nginx-plus-r37.0.7)|1|(nginx-plus-r37.0.7): CVE-2026-123007 CVE-2026-123634 CVE-2026-121810 CVE-2026-113425 [!]" \ "nginx/1.29.8 (nginx-plus-r37.0.8)|0|(nginx-plus-r37.0.8) (fixed) OK" \ "nginx/1.29.8 (nginx-plus-r37.0.10)|0|(fixed) OK" \ - "nginx/1.31.4 (nginx-plus-r37.1.1)|1|$ALL3 [!]" \ - "nginx/1.31.6 (nginx-plus-r37.2.0)|1|(nginx-plus-r37.2.0): CVE-2026-123007 CVE-2026-123634 [!]" \ + "nginx/1.31.4 (nginx-plus-r37.1.1)|1|$ALL5 [!]" \ + "nginx/1.31.6 (nginx-plus-r37.2.0)|1|(nginx-plus-r37.2.0): CVE-2026-123007 CVE-2026-123634 CVE-2026-121810 CVE-2026-113425 [!]" \ "nginx/1.31.9 (nginx-plus-r37.3.0)|0|(fixed) OK" \ "nginx/1.33.1 (nginx-plus-r38.0.0)|0|(fixed) OK" \ "nginx/1.29.8 (nginx-plus-r37)|2|(NGINX Plus release not recognized) [?]" \ @@ -188,6 +275,10 @@ V "nginx/1.29.8 (nginx-plus-r37.0.6)"; run "${F[@]}" -c "$H2ON"; check "plus: n V "nginx/1.29.8 (nginx-plus-r37.0.6)"; run "${F[@]}" -c "$H2OFF"; check "plus, http2 off, no resolver -> ok" 0 "http/2: off" "resolver: not set" V "nginx/1.29.8 (nginx-plus-r37.0.7)"; run "${F[@]}" -c "$RES"; check "plus 37.0.7, resolver -> CVE-2026-123634" 1 "=> [!] impacted: CVE-2026-123634" V "nginx/1.29.8 (nginx-plus-r37)"; run "${F[@]}" -c "$H2OFF"; check "plus unrecognized, nothing exposed -> ok" 0 "http/2: off" "resolver: not set" +V "nginx/1.29.8 (nginx-plus-r37.0.7)"; run "${F[@]}" -c "$MAILON"; check "plus 37.0.7, mail server -> CVE-2026-113425" 1 "=> [!] impacted: CVE-2026-113425" +V "nginx/1.29.8 (nginx-plus-r37.0.8)"; run "${F[@]}" -c "$MAILON"; check "plus 37.0.8, mail server -> fixed" 0 "(fixed) OK" +V "nginx/1.31.6 (nginx-plus-r37.2.0)"; run "${F[@]}" -c "$H3ON"; check "plus 37.2.0, quic listener -> CVE-2026-121810" 1 "=> [!] impacted: CVE-2026-121810" +V "nginx/1.31.9 (nginx-plus-r37.3.0)"; run "${F[@]}" -c "$H3ON"; check "plus 37.3.0, quic listener -> fixed" 0 "(fixed) OK" echo echo "## Forks" @@ -203,6 +294,9 @@ echo echo "## Build and run" run env FAKE_NO_H2=1 "${F[@]}" -c "$H2ON"; check "no http_v2 module -> ok" 0 "http/2: not built (no --with-http_v2_module) OK" run env FAKE_NO_H2=1 "${F[@]}" -c "$RES"; check "no http_v2 module, resolver -> CVE-2026-123634" 1 "http/2: not built" "=> [!] impacted: CVE-2026-123634" +run env FAKE_NO_H3=1 FAKE_VLINE="nginx version: nginx/1.31.8" "${F[@]}" -c "$H3ON"; check "no http_v3 module -> ok" 0 "http/3: not built (no --with-http_v3_module) OK" +run env FAKE_NO_MAIL=1 "${F[@]}" -c "$MAILON"; check "no mail module (mail_ssl alone does not count) -> ok" 0 "mail: not built (no --with-mail) OK" +run env FAKE_MAIL_DYNAMIC=1 "${F[@]}" -c "$MAILON"; check "mail built as a dynamic module -> impacted" 1 "=> [!] impacted: CVE-2026-113425" run env FAKE_FAIL=1 "${F[@]}" -c "$H2ON"; check "binary fails to run -> unknown" 2 " run: fake-nginx: error while loading shared libraries: libssl.so.3 [?]" run bash "$S" --no-procs --no-disk -n "$WORK/nope"; check "missing -n binary -> unknown" 2 "$WORK/nope (-n)" "binary: not an executable file [?]" run bash "$S" --bogus; check "unknown argument -> usage" 3 "usage: detect-nginx-http2.sh" @@ -299,7 +393,7 @@ http { server { listen 80; location / { proxy_pass http://b; } } } EOF -); run "${F[@]}" -c "$P"; check "stream, mail and upstream servers ignored" 0 "http/2: off" +); run "${F[@]}" -c "$P"; check "stream, mail and upstream servers do not turn http/2 on; the mail server counts for mail" 1 "http/2: off" "mail: on, mail server ($P) [!]" "=> [!] impacted: CVE-2026-113425" P=$(conf r1/nginx.conf <<'EOF' stream { @@ -315,7 +409,7 @@ http { server { listen 80; return 200 "resolver 8.8.8.8;"; } } EOF -); run "${F[@]}" -c "$P"; check "stream, mail, commented and quoted resolvers ignored" 0 "resolver: not set ($P) OK" +); run "${F[@]}" -c "$P"; check "stream, mail, commented and quoted resolvers ignored; the mail server counts for mail" 1 "resolver: not set ($P) OK" "=> [!] impacted: CVE-2026-113425" P=$(conf r2/nginx.conf <<'EOF' http { @@ -467,12 +561,27 @@ in_c() { local c=$1; shift; docker exec -i "$c" bash -s -- "$@" < "$S"; } in_as() { local u=$1 c=$2; shift 2; docker exec -i -u "$u" "$c" bash -s -- "$@" < "$S"; } sh_in() { docker exec "$1" sh -c "$2"; } -# changelog_fixed CONTAINER: 0 if the distro nginx changelog lists all three CVEs +# cves_for CONTAINER: the CVEs that container's nginx version has. Releases +# before 1.25.0 have no HTTP/3 module, so no CVE-2026-121810. +cves_for() { + local v + v=$(sh_in "$1" 'nginx -v 2>&1' | sed 's/^.*nginx\///; s/[^0-9.].*$//') + if printf '%s\n' "$v" | awk -F. '{ exit !($1 > 1 || ($1 == 1 && $2 >= 25)) }'; then + echo "$ALL5" + else + echo "$ALL4" + fi +} + +# changelog_fixed CONTAINER: 0 if the distro nginx changelog lists every CVE +# that container's nginx version has changelog_fixed() { - local t + local t c t=$(sh_in "$1" 'if [ -d /var/lib/dpkg ]; then zcat /usr/share/doc/nginx/changelog.Debian.gz; else rpm -q --changelog nginx-core; fi' 2>/dev/null) - printf '%s' "$t" | grep -q CVE-2026-123007 && printf '%s' "$t" | grep -q CVE-2026-123633 && - printf '%s' "$t" | grep -q CVE-2026-123634 + for c in $(cves_for "$1"); do + printf '%s' "$t" | grep -q "$c" || return 1 + done + return 0 } if [ "$DOCKER" -eq 0 ]; then @@ -508,8 +617,21 @@ else "http/2: off (/etc/nginx/nginx.conf) OK" "resolver: on, resolver 127.0.0.11 valid=10s (/etc/nginx/conf.d/01-resolver.conf) [!]" \ "=> [!] impacted: CVE-2026-123634" sh_in "$C_ALP" 'printf "http2 on;\n" > /etc/nginx/conf.d/00-h2.conf && nginx -s reload' 2>/dev/null - run in_c "$C_ALP"; check "nginx.org alpine, http2 and resolver -> all three" 1 "http/2: on, http2 on (/etc/nginx/conf.d/00-h2.conf) [!]" \ + run in_c "$C_ALP"; check "nginx.org alpine, http2 and resolver -> those three" 1 "http/2: on, http2 on (/etc/nginx/conf.d/00-h2.conf) [!]" \ + "http/3: off (/etc/nginx/nginx.conf) OK" "mail: no mail server (/etc/nginx/nginx.conf) OK" \ "=> [!] impacted: CVE-2026-123007 CVE-2026-123633 CVE-2026-123634" + # A QUIC listener and a mail server, in a config the real nginx accepts. + sh_in "$C_ALP" 'apk add -q openssl && openssl req -x509 -newkey rsa:2048 -nodes -subj /CN=t -keyout /etc/nginx/t.key -out /etc/nginx/t.crt' >/dev/null 2>&1 + sh_in "$C_ALP" 'printf "server {\n listen 8444 quic;\n listen 8444 ssl;\n ssl_certificate /etc/nginx/t.crt;\n ssl_certificate_key /etc/nginx/t.key;\n}\n" > /etc/nginx/conf.d/02-h3.conf + printf "mail {\n auth_http 127.0.0.1:9/auth;\n server { listen 1143; protocol imap; }\n}\n" >> /etc/nginx/nginx.conf' + if sh_in "$C_ALP" 'nginx -t && nginx -s reload' >/dev/null 2>&1; then + PASS=$((PASS + 1)); echo "PASS real nginx accepts the quic listener and the mail server" + else + FAIL=$((FAIL + 1)); echo "FAIL real nginx rejected the quic or mail test config" + fi + run in_c "$C_ALP"; check "nginx.org alpine, quic listener and mail server too -> all five" 1 \ + "http/3: on, listen 8444 quic (/etc/nginx/conf.d/02-h3.conf) [!]" "mail: on, mail server (/etc/nginx/nginx.conf) [!]" \ + "=> [!] impacted: $ALL5" run in_c "$C_OR"; check "openresty, stock config -> ok" 0 "check OpenResty's advisory) [?]" "http/2: off" docker exec -i "$C_OR" sh -c 'cat > /etc/nginx/conf.d/lua.conf && openresty -s reload' 2>/dev/null <<'EOF' @@ -540,7 +662,7 @@ EOF done for c in "$C_DEB" "$C_UBU" "$C_ALMA"; do if changelog_fixed "$c"; then - run in_c "$c"; check "$c: distro fix in changelog -> ok" 0 "changelog lists CVE-2026-123007 CVE-2026-123633 CVE-2026-123634 OK" + run in_c "$c"; check "$c: distro fix in changelog -> ok" 0 "changelog lists $(cves_for "$c") OK" else run in_c "$c"; check "$c: no fix in changelog, listen http2 -> impacted" 1 "backport: " "changelog " "/usr/sbin/nginx (pid " "!(installed)" fi @@ -549,12 +671,14 @@ EOF run in_c "$C_ALMA"; check "alma: rpm package" "$CODE" "nginx-core " "(rpm)" # Vendor backports: prepend changelog entries naming some or all CVEs. - sh_in "$C_DEB" 'cd /usr/share/doc/nginx && { printf "nginx (9:1) trixie-security; urgency=high\n\n * Fix CVE-2026-123007, CVE-2026-123633, CVE-2026-123634\n\n"; zcat changelog.Debian.gz; } | gzip -9n > c.gz && mv c.gz changelog.Debian.gz' + sh_in "$C_DEB" 'cd /usr/share/doc/nginx && { printf "nginx (9:1) trixie-security; urgency=high\n\n * Fix CVE-2026-123007, CVE-2026-123633, CVE-2026-123634,\n CVE-2026-121810, CVE-2026-113425\n\n"; zcat changelog.Debian.gz; } | gzip -9n > c.gz && mv c.gz changelog.Debian.gz' sh_in "$C_UBU" 'cd /usr/share/doc/nginx && { printf "nginx (9:1) noble-security; urgency=medium\n\n * SECURITY UPDATE: CVE-2026-123007\n\n"; zcat changelog.Debian.gz; } | gzip -9n > c.gz && mv c.gz changelog.Debian.gz' - run in_c "$C_DEB"; check "debian: backport of all three -> ok" 0 "changelog lists CVE-2026-123007 CVE-2026-123633 CVE-2026-123634 OK" "http/2: - n/a" "resolver: - n/a" + run in_c "$C_DEB"; check "debian: backport of all -> ok" 0 "changelog lists $(cves_for "$C_DEB") OK" \ + "http/2: - n/a" "resolver: - n/a" "http/3: - n/a" "mail: - n/a" if ! changelog_fixed "$C_UBU"; then + u=$(cves_for "$C_UBU") run in_c "$C_UBU"; check "ubuntu: backport of one -> impacted by the rest" 1 \ - "changelog lists CVE-2026-123007 but not CVE-2026-123633 CVE-2026-123634 [!]" "=> [!] impacted: CVE-2026-123633" + "changelog lists CVE-2026-123007 but not ${u#CVE-2026-123007 } [!]" "=> [!] impacted: CVE-2026-123633" fi # Upgraded on disk, not restarted: the running binary is the old one. @@ -562,7 +686,7 @@ EOF run in_c "$C_DEB"; check "debian: binary replaced, not restarted -> impacted" 1 \ "binary replaced on disk since start" "this process still runs the binary it replaced: restart nginx [!]" sh_in "$C_DEB" 'nginx -s stop; sleep 1; nginx' >/dev/null 2>&1 - run in_c "$C_DEB"; check "debian: restarted -> ok" 0 "changelog lists CVE-2026-123007 CVE-2026-123633 CVE-2026-123634 OK" + run in_c "$C_DEB"; check "debian: restarted -> ok" 0 "changelog lists $(cves_for "$C_DEB") OK" # A master started with -c: that file is read, not the built-in default. # (nginx 1.20 predates the "http2" directive, so use the listen parameter.) @@ -587,6 +711,8 @@ EOF "http/2: on, http2 on (/etc/nginx/conf.d/lua.conf) [!]" \ "changelog lists CVE-2026-123007 but not CVE-2026-123633 CVE-2026-123634" \ "(/etc/nginx/conf.d/01-resolver.conf) [!]" \ + "http/3: on, listen 8444 quic (/etc/nginx/conf.d/02-h3.conf) [!]" \ + "mail: on, mail server (/etc/nginx/nginx.conf) [!]" \ "(/srv/alt.conf)" "(apk)" "(rpm)" ", container $C_ORG)" ", container $C_ALMA)" "!in a container, run as root" n=$(printf '%s\n' "$OUT" | grep -cE ', container [A-Za-z0-9._-]+\)$') if [ "$n" -ge 6 ]; then PASS=$((PASS + 1)); echo "PASS six or more containerized masters ($n)"; else FAIL=$((FAIL + 1)); echo "FAIL expected >= 6 containerized masters, got $n"; fi diff --git a/README.md b/README.md index f1584bc..7c35b1e 100644 --- a/README.md +++ b/README.md @@ -18,4 +18,4 @@ Where possible, detections are written to be fleet-policy compatible - known una | Directory | What it detects | |---|---| | `CVE-2026-114938/` | JVMs exposed to the HotSpot x86-64 AVX-512 Base64 decode heap overwrite (CVE-2026-114938, JDK-8392044) | -| `CVE-2026-123633.CVE-2026-123007/` | nginx exposed to the HTTP/2 flow-control overflow (CVE-2026-123007) or use-after-free (CVE-2026-123633) with HTTP/2 on, or to the resolver use-after-free (CVE-2026-123634) with a `resolver` configured | +| `CVE-2026-123633.CVE-2026-123007/` | nginx exposed to the HTTP/2 flow-control overflow (CVE-2026-123007) or use-after-free (CVE-2026-123633) with HTTP/2 on, to the resolver use-after-free (CVE-2026-123634) with a `resolver` configured, to the HTTP/3 use-after-free (CVE-2026-121810) with a QUIC listener, or to the mail proxy use-after-free (CVE-2026-113425) with a mail server | From 662ee6fd059cf33de91d188a0fbb121a18c96885 Mon Sep 17 00:00:00 2001 From: Diptendu Kar Date: Wed, 18 Nov 2026 13:44:48 -0500 Subject: [PATCH 2/2] nginx: add Ansible and kubectl exec fleet wrappers, and test the wrappers - ansible-nginx-http2.yml runs the detector on every host in an inventory and collects the verdicts, like the JDK playbook. A verdict counts only when the detector's last line agrees with the exit code, as in the SSH wrapper. - k8s-exec-nginx-http2.sh runs the detector inside every running container with kubectl exec, for clusters that forbid the privileged DaemonSet. - The test harness gains a section that drives the SSH and kubectl exec wrappers through stand-ins for ssh and kubectl. It needs no Docker and runs under bash 3.2. Co-Authored-By: Claude Mythos 5.2 --- .github/workflows/nginx-http2-linux.yml | 1 + CVE-2026-123633.CVE-2026-123007/README.md | 44 +++++++- .../linux/ansible-nginx-http2.yml | 94 ++++++++++++++++ .../linux/k8s-exec-nginx-http2.sh | 73 +++++++++++++ .../linux/tests/run-tests.sh | 100 +++++++++++++++++- 5 files changed, 308 insertions(+), 4 deletions(-) create mode 100644 CVE-2026-123633.CVE-2026-123007/linux/ansible-nginx-http2.yml create mode 100755 CVE-2026-123633.CVE-2026-123007/linux/k8s-exec-nginx-http2.sh diff --git a/.github/workflows/nginx-http2-linux.yml b/.github/workflows/nginx-http2-linux.yml index d120ad4..75fa8b7 100644 --- a/.github/workflows/nginx-http2-linux.yml +++ b/.github/workflows/nginx-http2-linux.yml @@ -37,6 +37,7 @@ jobs: run: >- shellcheck -S warning "$DIR/detect-nginx-http2.sh" "$DIR/ssh-nginx-http2.sh" + "$DIR/k8s-exec-nginx-http2.sh" "$DIR/tests/run-tests.sh" "$DIR/tests/fake-nginx" test-linux: diff --git a/CVE-2026-123633.CVE-2026-123007/README.md b/CVE-2026-123633.CVE-2026-123007/README.md index 628d047..c1c3978 100644 --- a/CVE-2026-123633.CVE-2026-123007/README.md +++ b/CVE-2026-123633.CVE-2026-123007/README.md @@ -48,9 +48,11 @@ above; see the nginx.org advisories page for the others. |---|---| | `linux/detect-nginx-http2.sh` | Host detector (bash 3.2+). The name predates the CVEs outside HTTP/2; it checks all five. | | `linux/ssh-nginx-http2.sh` | Fleet run over plain SSH | +| `linux/ansible-nginx-http2.yml` | Fleet run through Ansible | | `linux/k8s-nginx-http2.yaml` | Fleet run as a privileged Kubernetes DaemonSet | +| `linux/k8s-exec-nginx-http2.sh` | Fleet run with `kubectl exec` into each container | -The SSH wrapper finds the detector next to itself, so keep the files +The wrappers find the detector next to themselves, so keep the files together. `linux/tests/` holds the maintainers' test harness. It is not needed to run any script. @@ -258,8 +260,29 @@ the targets. - The wrapper exits `1` if any host is impacted, else `2` if any host is unknown or errored, else `0`. +### Ansible + +`ansible-nginx-http2.yml` runs `detect-nginx-http2.sh` on every Linux/macOS +host in the inventory and collects each host's verdict on the control node. +No agent is installed; `ansible.builtin.script` copies the detector to a temp +path, runs it, and removes it. + +```sh +ansible-playbook -i inventory linux/ansible-nginx-http2.yml +ansible-playbook -i inventory linux/ansible-nginx-http2.yml -e detect_args="--no-disk" +``` + +Each host's full detector output is saved to `./results/.txt`, and a +per-verdict host list (`impacted` / `unknown` / `not impacted` / `no result`) +prints at the end. Exit codes `1` (impacted) and `2` (unknown) are verdicts +and do not fail the play; `3` (usage error) does. As in the SSH wrapper, a +verdict counts only when the detector's last line agrees with the exit code. +Run with `become` (the default here) for full coverage. + ### Kubernetes +Two methods, both running this directory's own detector. + `k8s-nginx-http2.yaml` is a DaemonSet: one pod per node, with `hostPID` and `privileged`, so the detector checks every nginx on the node, including those in other pods (through its own `nsenter` path, as root). Nothing is copied @@ -279,6 +302,25 @@ when you have your results. The base image installs `util-linux` (for `nsenter`) at start; for air-gapped clusters, bake bash + util-linux + the script into your own image. +`k8s-exec-nginx-http2.sh` is for clusters that forbid privileged pods. It +`kubectl exec`s the detector (piped over stdin) into every running container. +It needs only list and exec rights. + +```sh +sh linux/k8s-exec-nginx-http2.sh > results.txt # all namespaces +sh linux/k8s-exec-nginx-http2.sh -n ingress > results.txt # one namespace +DETECT_ARGS="--no-disk" sh linux/k8s-exec-nginx-http2.sh # running masters only +``` + +It prints one line for each container that is not impacted and the detector's +full output for the rest, then a roll-up, and exits `1` / `2` / `0` like the +SSH wrapper. Two limits, both covered by the DaemonSet: +- Containers without bash (distroless, some Alpine images) are reported + unknown. +- The detector runs as the container's own user. Where that is not root and + the nginx master is, the master cannot be read and the container is + unknown. + ## Remediation 1. **Upgrade.** This is the only fix that covers all five CVEs. diff --git a/CVE-2026-123633.CVE-2026-123007/linux/ansible-nginx-http2.yml b/CVE-2026-123633.CVE-2026-123007/linux/ansible-nginx-http2.yml new file mode 100644 index 0000000..3ba38f4 --- /dev/null +++ b/CVE-2026-123633.CVE-2026-123007/linux/ansible-nginx-http2.yml @@ -0,0 +1,94 @@ +--- +# ansible-nginx-http2.yml +# +# Run the nginx (CVE-2026-123007, CVE-2026-123633, CVE-2026-123634, +# CVE-2026-121810, CVE-2026-113425) host detector on every Linux/macOS host in +# the inventory and collect each host's verdict on the control node. +# +# Self-contained: it drives this directory's own detect-nginx-http2.sh and +# nothing else. No agent is installed on the targets. ansible.builtin.script +# copies the detector to a temp path, runs it, and removes it. The detector is +# read-only: it runs "nginx -V" and reads config and package files. +# +# Usage: +# ansible-playbook -i inventory ansible-nginx-http2.yml +# ansible-playbook -i inventory ansible-nginx-http2.yml -e detect_args="--no-disk" +# +# Exit-code contract (from the detector; this is the fleet signal): +# 0 not impacted 1 impacted 2 unknown 3 usage error +# Codes 1 and 2 are verdicts, not failures, so they do not fail the play; 3 does. +# A verdict counts only when the detector's last line agrees with the exit +# code, so a failure that also exits 1 is not read as "impacted". +# +# Output: +# - each host's full detector output is saved to ./results/.txt +# - a per-verdict host summary prints at the end +# +# Run as root (become) for full coverage of master processes, containers and +# root-only config files, matching the detector's own guidance. + +- name: nginx CVE-2026-123007/123633/123634/121810/113425 host detection + hosts: all + gather_facts: false + become: true + vars: + detect_script: "{{ playbook_dir }}/detect-nginx-http2.sh" + detect_args: "" + results_dir: "{{ playbook_dir }}/results" + + tasks: + - name: Run the detector (copied, run, and removed by Ansible; nothing installed) + ansible.builtin.script: "{{ detect_script }} {{ detect_args }}" + args: + executable: bash + register: detect + changed_when: false + failed_when: detect.rc not in [0, 1, 2] + + - name: Derive this host's verdict from the exit code and the last output line + vars: + by_rc: "{{ 'impacted' if detect.rc == 1 else ('unknown' if detect.rc == 2 else 'not impacted') }}" + last_line: "{{ detect.stdout_lines | map('trim') | select | list | last | default('') }}" + ansible.builtin.set_fact: + nginx_cve_verdict: "{{ by_rc if last_line == by_rc else 'no result' }}" + + - name: Create the results folder on the control node + ansible.builtin.file: + path: "{{ results_dir }}" + state: directory + mode: "0755" + delegate_to: localhost + become: false + run_once: true + + - name: Save this host's detector output on the control node + ansible.builtin.copy: + content: "{{ detect.stdout }}" + dest: "{{ results_dir }}/{{ inventory_hostname }}.txt" + mode: "0644" + delegate_to: localhost + become: false + changed_when: false + + - name: Print the fleet summary + run_once: true + delegate_to: localhost + become: false + vars: + # [host, verdict] pairs. Hosts that failed or were unreachable have no + # fact set, so extract yields Undefined, mapped to "no result". + pairs: >- + {{ ansible_play_hosts_all + | zip(ansible_play_hosts_all + | map('extract', hostvars, 'nginx_cve_verdict') + | map('default', 'no result') + | list) + | list }} + ansible.builtin.debug: + msg: + - "nginx CVE-2026-123007/123633/123634/121810/113425 fleet detection" + - "impacted: {{ pairs | selectattr('1', 'equalto', 'impacted') | map(attribute='0') | list }}" + - "unknown: {{ pairs | selectattr('1', 'equalto', 'unknown') | map(attribute='0') | list }}" + - "not impacted: {{ pairs | selectattr('1', 'equalto', 'not impacted') | map(attribute='0') | list }}" + - "no result: {{ pairs | selectattr('1', 'equalto', 'no result') | map(attribute='0') | list }}" + - "per-host output saved under {{ results_dir }}/" diff --git a/CVE-2026-123633.CVE-2026-123007/linux/k8s-exec-nginx-http2.sh b/CVE-2026-123633.CVE-2026-123007/linux/k8s-exec-nginx-http2.sh new file mode 100755 index 0000000..f3c783a --- /dev/null +++ b/CVE-2026-123633.CVE-2026-123007/linux/k8s-exec-nginx-http2.sh @@ -0,0 +1,73 @@ +#!/bin/sh +# k8s-exec-nginx-http2.sh -- kubectl exec the nginx (CVE-2026-123007, CVE-2026-123633, +# CVE-2026-123634, CVE-2026-121810, CVE-2026-113425) detector into every running +# container. For clusters that forbid the privileged DaemonSet. +# +# Needs only the right to list pods and to exec into them. The detector is piped +# in over stdin and run in memory; nothing is copied into the container. It needs +# bash IN the container; containers without bash (distroless, some Alpine) are +# reported unknown -- use the DaemonSet (k8s-nginx-http2.yaml) for those. +# +# The detector runs as the container's own user. Where that is not root and the +# nginx master is, the master cannot be read and the container is unknown; the +# DaemonSet covers those too. +# +# Usage: +# sh k8s-exec-nginx-http2.sh > results.txt # all namespaces +# sh k8s-exec-nginx-http2.sh -n ingress > results.txt # one namespace (any kubectl get pods opts) +# DETECT_ARGS="--no-disk" sh k8s-exec-nginx-http2.sh # running masters only +# +# Prints one line per container that is not impacted, the detector's full output +# for every other container, and a roll-up. Exits 1 if any container is impacted, +# else 2 if any unknown, else 0. +set -u + +SCRIPT=${DETECT:-$(dirname "$0")/detect-nginx-http2.sh} +DETECT_ARGS=${DETECT_ARGS:-} +[ -f "$SCRIPT" ] || { echo "detector not found at $SCRIPT (set DETECT=/path/to/detect-nginx-http2.sh)" >&2; exit 3; } +[ $# -gt 0 ] || set -- -A + +NL=' +' +LIST=$(kubectl get pods "$@" --field-selector=status.phase=Running \ + -o go-template='{{range .items}}{{$ns := .metadata.namespace}}{{$pod := .metadata.name}}{{$node := .spec.nodeName}}{{range .spec.containers}}{{$ns}} {{$pod}} {{.name}} {{$node}}{{"\n"}}{{end}}{{end}}') || exit 3 + +imp=0; unk=0; ok=0 +IFS=$NL +for line in $LIST; do + IFS=' ' + # shellcheck disable=SC2086 + set -- $line + ns=$1; pod=$2; ctr=$3; node=$4 + if kubectl exec -n "$ns" "$pod" -c "$ctr" -- sh -c 'command -v bash >/dev/null 2>&1' >/dev/null 2>&1; then + # shellcheck disable=SC2086 + out=$(kubectl exec -i -n "$ns" "$pod" -c "$ctr" -- bash -s -- $DETECT_ARGS < "$SCRIPT" 2>/dev/null) + # Trust only the detector's own verdict line: kubectl exec has exit + # codes of its own. + case "$(printf '%s\n' "$out" | sed '/^[[:space:]]*$/d' | tail -n 1)" in + impacted) + imp=$((imp + 1)) + printf '=== %s/%s/%s (node %s) ===\n%s\n' "$ns" "$pod" "$ctr" "$node" "$out" ;; + "not impacted") + ok=$((ok + 1)) + printf '=== %s/%s/%s (node %s) === not impacted\n' "$ns" "$pod" "$ctr" "$node" ;; + unknown) + unk=$((unk + 1)) + printf '=== %s/%s/%s (node %s) ===\n%s\n' "$ns" "$pod" "$ctr" "$node" "$out" ;; + *) + unk=$((unk + 1)) + printf '=== %s/%s/%s (node %s) ===\nunknown: the detector gave no verdict in this container\n' "$ns" "$pod" "$ctr" "$node" ;; + esac + else + printf '=== %s/%s/%s (node %s) ===\nunknown: no bash in this container; use the DaemonSet (k8s-nginx-http2.yaml)\n' "$ns" "$pod" "$ctr" "$node" + unk=$((unk + 1)) + fi + IFS=$NL +done +IFS=' ' + +echo "---" +echo "nginx CVE-2026-123007/123633/123634/121810/113425 containers: $imp impacted, $unk unknown, $ok not impacted" +[ "$imp" -gt 0 ] && exit 1 +[ "$unk" -gt 0 ] && exit 2 +exit 0 diff --git a/CVE-2026-123633.CVE-2026-123007/linux/tests/run-tests.sh b/CVE-2026-123633.CVE-2026-123007/linux/tests/run-tests.sh index 1a0e037..120d6ba 100755 --- a/CVE-2026-123633.CVE-2026-123007/linux/tests/run-tests.sh +++ b/CVE-2026-123633.CVE-2026-123007/linux/tests/run-tests.sh @@ -5,13 +5,15 @@ # 1. Decision logic: tests/fake-nginx and generated configs drive every # version, Plus, fork, build and config-parsing branch. Runs anywhere # (Linux or macOS, bash 3.2+), no root, no Docker. -# 2. Real nginx in Docker containers: the nginx.org Debian and Alpine +# 2. Fleet wrappers: the SSH and kubectl-exec wrappers run against stand-ins +# for ssh and kubectl. Runs anywhere, no root, no Docker. +# 3. Real nginx in Docker containers: the nginx.org Debian and Alpine # images, OpenResty, and the Debian, Ubuntu and AlmaLinux packages. The # detector runs inside each container, as the SSH wrapper would run it. # Expected verdicts for distro packages come from an independent read of # each package changelog, so the tests keep passing after vendors ship # their fixes. -# 3. Container scan: the detector runs as root in a privileged --pid=host +# 4. Container scan: the detector runs as root in a privileged --pid=host # container and must check every container's nginx through nsenter, # which is what the Kubernetes DaemonSet does. # @@ -553,7 +555,99 @@ wrap "$H2ON" STUB_SUDO=deny; wcheck "wrapper: sudo needs a password -> error, no wrap "$H2ON" STUB_SUDO=deny SUDO=""; wcheck "wrapper: SUDO=\"\" skips sudo" 1 "impacted" wrap "$H2ON" DETECT="$WORK/no-verdict.sh"; wcheck "wrapper: exit 1 without a verdict line -> error" 2 "error (no verdict, rc=1)" -# --- 2. Real nginx in containers ---------------------------------------------------- +# --- 2. Fleet wrappers ----------------------------------------------------------- +# The SSH and kubectl-exec wrappers, driven through stand-ins for ssh and +# kubectl that run the detector here with a different fake nginx per host or +# container. Runs anywhere, like the decision logic. + +echo +echo "## Fleet wrappers (stand-in ssh and kubectl)" +unset FAKE_VLINE +FB="$WORK/fakebin" +mkdir -p "$FB" + +# wcheck NAME WANT_CODE [MUST_CONTAIN]... +wcheck() { + local name=$1 want=$2 ok=1 c + shift 2 + [ "$CODE" = "$want" ] || ok=0 + for c in "$@"; do + printf '%s\n' "$OUT" | grep -qF -- "$c" || ok=0 + done + if [ "$ok" -eq 1 ]; then + PASS=$((PASS + 1)) + echo "PASS $name" + else + FAIL=$((FAIL + 1)) + echo "FAIL $name (want exit $want containing [$*]; got exit $CODE)" + printf '%s\n' "$OUT" | sed 's/^/ | /' + fi +} + +cat > "$FB/ssh" <&2; exit 1 ;; + *) echo "ssh: connect to host \$1: Connection refused" >&2; exit 255 ;; +esac +EOF +chmod 755 "$FB/ssh" +printf '# fleet\nweb1\nmail1\n\nfixed1\nfork1\nnosudo1\ndown1\n' > "$WORK/hosts.txt" +run env PATH="$FB:$PATH" SUDO="" sh "$HERE/../ssh-nginx-http2.sh" "$WORK/hosts.txt" "$WORK/results" +wcheck "ssh wrapper: roll-up by verdict, errors kept apart, exit 1" 1 \ + "fleet detection (6 host(s))" "impacted: mail1 web1" "unknown: fork1" "not impacted: fixed1" \ + "nosudo1(error (sudo needs a password))" "down1(error (ssh/connection))" +if grep -qF "=> [!] impacted: CVE-2026-113425" "$WORK/results/mail1.txt" 2>/dev/null; then + PASS=$((PASS + 1)); echo "PASS ssh wrapper: per-host output saved" +else + FAIL=$((FAIL + 1)); echo "FAIL ssh wrapper: results/mail1.txt lacks the detector output" +fi +printf 'fixed1\n' > "$WORK/hosts-ok.txt" +run env PATH="$FB:$PATH" SUDO="" sh "$HERE/../ssh-nginx-http2.sh" "$WORK/hosts-ok.txt" "$WORK/results-ok" +wcheck "ssh wrapper: all clean -> exit 0" 0 "not impacted: fixed1" +printf 'fixed1\ndown1\n' > "$WORK/hosts-down.txt" +run env PATH="$FB:$PATH" SUDO="" sh "$HERE/../ssh-nginx-http2.sh" "$WORK/hosts-down.txt" "$WORK/results-down" +wcheck "ssh wrapper: an unreachable host -> exit 2" 2 "down1(error (ssh/connection))" + +cat > "$FB/kubectl" < [!] impacted: CVE-2026-123007 CVE-2026-123633" \ + "=== web/front/sidecar (node node-a) === not impacted" \ + "=== mail/imap/nginx (node node-b) ===" "=> [!] impacted: CVE-2026-113425" \ + "=== batch/job/distroless (node node-b) ===" "unknown: no bash in this container" \ + "containers: 2 impacted, 1 unknown, 1 not impacted" + +# --- 3. Real nginx in containers ---------------------------------------------------- # in CONTAINER [ARGS...]: runs the detector inside CONTAINER as root in_c() { local c=$1; shift; docker exec -i "$c" bash -s -- "$@" < "$S"; }