#!/bin/sh # Copyright 2026 Tailwind Resource Group # SPDX-License-Identifier: Apache-2.0 # Provided as is, with no warranty. License: https://everythingsfine.io/license/ # # nginx_nov2026_check.sh # # Purpose: compare one NGINX installation with the ten NGINX issues in F5 # article K000164058, Out-of-band Security Notification (November 18, 2026). # # The script runs "nginx -V" and "nginx -T" and reads their output. It # changes nothing, writes no files and prints no line of the configuration. # Run it as the user that can run "nginx -t", usually root. # # sh nginx_nov2026_check.sh use nginx from PATH # sh nginx_nov2026_check.sh -b /usr/sbin/nginx use this binary # sh nginx_nov2026_check.sh -c /etc/nginx/nginx.conf # sh nginx_nov2026_check.sh -V v.txt -T t.txt read saved output # # Result: one line for each CVE. # VERSION AFFECTED the version number is in the vulnerable range # FIXED the version number has the fix # NOT AFFECTED the version number is older than the range # CHECK NGINX Plus or an unknown version: see the article # CONFIG PRESENT the configuration has the condition from the article # ABSENT the script did not find the condition # Exit status: 1 if a line is AFFECTED and PRESENT, 0 if not, 2 on error. # # This script is not from F5. ABSENT is not a statement that the system is # safe. A distribution package can have the fix with an older version # number. Tested on NGINX Open Source only. NGINX_BIN=nginx CONF= VFILE= TFILE= usage() { echo "usage: $0 [-b nginx-binary] [-c nginx.conf] [-V nginx-V.txt] [-T nginx-T.txt]" >&2 } while getopts b:c:V:T:h opt; do case $opt in b) NGINX_BIN=$OPTARG ;; c) CONF=$OPTARG ;; V) VFILE=$OPTARG ;; T) TFILE=$OPTARG ;; *) usage; exit 2 ;; esac done if [ -n "$VFILE" ]; then NGX_V=$(cat -- "$VFILE") || exit 2 else NGX_V=$("$NGINX_BIN" -V 2>&1) || { echo "error: could not run $NGINX_BIN -V" >&2; exit 2; } fi if [ -n "$TFILE" ]; then NGX_T=$(cat -- "$TFILE") || exit 2 elif [ -n "$CONF" ]; then NGX_T=$("$NGINX_BIN" -T -q -c "$CONF" 2>/dev/null) || { echo "error: nginx -T failed. Run nginx -t to see why." >&2; exit 2; } else NGX_T=$("$NGINX_BIN" -T -q 2>/dev/null) || { echo "error: nginx -T failed. Run nginx -t to see why." >&2; exit 2; } fi export NGX_V printf '%s\n' "$NGX_T" | awk ' function vnum(v, a, n) { n = split(v, a, ".") return (a[1] + 0) * 1000000 + (a[2] + 0) * 1000 + (a[3] + 0) } function verdict(start) { if (plus || ver == "") return "CHECK" if (V < vnum(start)) return "NOT AFFECTED" if (V >= vnum("1.32.0")) return "FIXED" if (V >= vnum("1.31.9")) return "FIXED" if (V >= vnum("1.30.7") && V < vnum("1.31.0")) return "FIXED" return "AFFECTED" } function glob2re(g, i, c, r) { r = "^" for (i = 1; i <= length(g); i++) { c = substr(g, i, 1) if (c == "*") r = r "[^/]*" else if (c == "?") r = r "[^/]" else if (c == "[" || c == "]") r = r c else if (c == "^") r = r "\\^" else if (c == "\\") r = r "\\\\" else if (index(".+$()|{}", c)) r = r "[" c "]" else r = r c } return r "$" } function has_unnamed(rx, i, c, n, cls) { n = length(rx); cls = 0 for (i = 1; i <= n; i++) { c = substr(rx, i, 1) if (c == "\\") { i++; continue } if (cls) { if (c == "]") cls = 0; continue } if (c == "[") { cls = 1; continue } if (c == "(" && substr(rx, i + 1, 1) != "?") return 1 } return 0 } function emit() { w[++nw] = tok; tok = ""; intok = 0 } function parse_file(f, s, n, i, c, q, j, rest) { if (++seen[f] > 20) return s = content[f]; n = length(s); q = ""; tok = ""; intok = 0; invar = 0 for (i = 1; i <= n; i++) { c = substr(s, i, 1) if (q != "") { if (c == "\\") { tok = tok c substr(s, i + 1, 1); i++; continue } if (c == q) { q = ""; emit(); continue } tok = tok c; continue } if (c == "#" && !intok) { rest = substr(s, i); j = index(rest, "\n") if (j == 0) break i = i + j - 1; continue } if (c == " " || c == "\t" || c == "\n" || c == "\r") { if (intok) emit() continue } if (c == "{" && intok && substr(tok, length(tok), 1) == "$") { tok = tok c; invar = 1; continue } if (c == "}" && invar) { tok = tok c; invar = 0; continue } if (c == ";") { if (intok) emit(); stmt(); continue } if (c == "{") { if (intok) emit(); block_open(); continue } if (c == "}") { if (intok) emit(); block_close(); continue } if ((c == "\"" || c == "\047") && !intok) { q = c; intok = 1; continue } if (c == "\\") { tok = tok substr(s, i + 1, 1); i++; intok = 1; continue } tok = tok c; intok = 1 } if (intok) emit() } function do_include(pat, re, k, list, nl, x) { if (substr(pat, 1, 1) != "/") pat = prefix "/" pat re = glob2re(pat); nl = 0 for (k = 1; k <= nf; k++) if (order[k] ~ re) list[++nl] = order[k] nw = 0 for (x = 1; x <= nl; x++) parse_file(list[x]) } function scan_args( k) { for (k = 1; k <= nw; k++) if (index(w[k], "$ssl_preread_")) prereadvar = 1 } function eff(arr, s, def) { if ((s, "set") in arr) return arr[s] if ((0, "set") in arr) return arr[0] return def } function setv(arr, s, v) { arr[s] = v; arr[s, "set"] = 1 } function stmt( mod, typ, s, l, k, a, key, rx) { if (nw == 0) return if (w[1] == "include") { do_include(w[2]); nw = 0; return } mod = M[depth]; typ = T[depth]; s = S[depth]; l = L[depth] scan_args() if (typ == "map") { key = w[1] if (key ~ /^~/) { rx = key; sub(/^~\*?/, "", rx) if (has_unnamed(rx)) mapcap[curmap] = 1 } nw = 0; return } if (typ == "types" || typ == "geo" || typ == "split_clients" || typ == "upstream" || typ == "match") { nw = 0; return } if (w[1] == "worker_connections") wc = w[2] if (mod == "http") { if (w[1] == "resolver") h_resolver = 1 if (w[1] == "proxy_pass") { h_pass = 1; if (index(w[2], "$")) h_proxyvar = 1 } if (w[1] ~ /^(grpc|fastcgi|uwsgi|scgi|memcached)_pass$/) h_pass = 1 if (w[1] == "ssi" && w[2] == "on") h_ssi = 1 if (w[1] == "mirror" && w[2] != "off") h_mirror = 1 if (w[1] == "http2" && w[2] == "on") h_h2 = 1 if (w[1] == "listen" && s) { for (k = 2; k <= nw; k++) { if (w[k] == "http2") h_h2 = 1 if (w[k] == "quic") h_h3 = 1 if (w[k] == "ssl") hssl[s] = 1 } } if (w[1] == "ssl_protocols") { a = "" for (k = 2; k <= nw; k++) a = a " " w[k] if (s) hproto[s] = a; else { h_proto = a; h_proto_set = 1 } } if (l && w[1] == "alias") { lalias[l] = 1; largs[l] = largs[l] " " w[2] } if (l && w[1] == "try_files") { ltry[l] = 1 for (k = 2; k <= nw; k++) largs[l] = largs[l] " " w[k] } } if (mod == "stream") { if (w[1] == "listen" && s) { a = w[2] if (a ~ /^[0-9]+$/) a = "*:" a sub(/^0\.0\.0\.0:/, "*:", a) for (k = 3; k <= nw; k++) if (w[k] == "udp") a = a "/udp" for (k = 3; k <= nw; k++) if (w[k] == "default_server") sdef[a] = s if (!((a, s) in lsrv)) { lsrv[a, s] = 1; lcount[a]++; lnth[a, lcount[a]] = s if (!(a in lseen)) { lseen[a] = 1; laddr[++nla] = a } } } if (w[1] == "ssl_verify_client") setv(svc, s, w[2]) if (w[1] == "ssl_certificate") setv(scv, s, index(w[2], "$") ? 1 : 0) if (w[1] == "proxy_protocol") setv(spp, s, w[2]) if (w[1] == "ssl_session_tickets") setv(stk, s, w[2]) if (w[1] == "ssl_session_cache") setv(sch, s, w[2]) if (w[1] == "ssl_preread" && w[2] == "on") preread = 1 } if (mod == "mail" && s && w[1] == "listen") { mailsrv = 1 a = w[2] if (a ~ /^[0-9]+$/ || a ~ /^\*:/ || a ~ /^0\.0\.0\.0:/ || a ~ /^\[::\]:/) mailwild = 1 } nw = 0 } function block_open( name, mod) { name = w[1]; scan_args() depth++ T[depth] = name; M[depth] = M[depth - 1]; S[depth] = S[depth - 1]; L[depth] = L[depth - 1] if (name == "http" || name == "stream" || name == "mail") { M[depth] = name; S[depth] = 0; L[depth] = 0 } if (name == "server") { S[depth] = ++nsrv; smod[nsrv] = M[depth]; L[depth] = 0 } if (name == "location") L[depth] = ++nloc if (name == "map") { curmap = w[3] if (M[depth] == "http") hmap[curmap] = 1 } nw = 0 } function block_close() { if (depth > 0) depth--; nw = 0 } function line(cve, start, cond, text) { vd = verdict(start) printf "%-16s %-13s %-8s %s\n", cve, vd, cond ? "PRESENT" : "ABSENT", text if (vd == "AFFECTED" && cond) hit = 1 } BEGIN { vtext = ENVIRON["NGX_V"] if (match(vtext, /nginx\/[0-9]+\.[0-9]+\.[0-9]+/)) ver = substr(vtext, RSTART + 6, RLENGTH - 6) plus = (vtext ~ /nginx-plus/) V = vnum(ver) lib = "unknown" if (vtext ~ /built with OpenSSL/) lib = "OpenSSL" if (vtext ~ /BoringSSL/) lib = "BoringSSL" if (vtext ~ /AWS-LC/) lib = "AWS-LC" if (vtext ~ /LibreSSL/) lib = "LibreSSL" nf = 0 } /^# configuration file .*:$/ { cur = substr($0, 22, length($0) - 22) if (!(cur in content)) { order[++nf] = cur; content[cur] = "" } else cur = "" next } { if (cur != "") content[cur] = content[cur] $0 "\n" } END { if (nf == 0) { print "error: no configuration in the nginx -T output" > "/dev/stderr"; exit 2 } prefix = order[1]; sub(/\/[^\/]*$/, "", prefix) depth = 0; T[0] = "main"; M[0] = ""; S[0] = 0; L[0] = 0 parse_file(order[1]) if (wc == "") wc = "512 (default)" c1 = h_resolver && h_proxyvar && (h_ssi || h_mirror) defproto = (V >= vnum("1.23.4")) ? " TLSv1.2 TLSv1.3" : " TLSv1 TLSv1.1 TLSv1.2" c6 = 0 for (s = 1; s <= nsrv; s++) { if (smod[s] != "http" || !hssl[s]) continue p = (s in hproto) ? hproto[s] : (h_proto_set ? h_proto : defproto) if (p ~ /TLSv1\.3/) c6 = 1 } c7 = 0 if (lib != "BoringSSL" && lib != "AWS-LC") for (s = 1; s <= nsrv; s++) { if (smod[s] != "stream") continue if (eff(scv, s, 0) && eff(spp, s, "off") == "v2" && !(eff(stk, s, "on") == "off" && eff(sch, s, "none") == "off")) c7 = 1 } c8 = 0 for (l = 1; l <= nloc; l++) { if (!lalias[l] || !ltry[l]) continue for (m in mapcap) if ((m in hmap) && index(largs[l], m)) c8 = 1 } c9 = 0 for (i = 1; i <= nla; i++) { a = laddr[i] if (lcount[a] < 2) continue d = (a in sdef) ? sdef[a] : lnth[a, 1] if (eff(svc, d, "off") == "on") continue for (k = 1; k <= lcount[a]; k++) { s = lnth[a, k] if (s != d && eff(svc, s, "off") == "on") c9 = 1 } } c10 = preread && prereadvar printf "nginx %s, %s, %s\n", (ver == "" ? "unknown version" : ver), (plus ? "NGINX Plus" : "Open Source"), "SSL library " lib printf "%-16s %-13s %-8s %s\n", "CVE", "VERSION", "CONFIG", "CONDITION THE SCRIPT LOOKS FOR" line("CVE-2026-123634", "0.6.18", c1, "resolver, proxy_pass with a variable, and ssi on or mirror") line("CVE-2026-123007", "1.9.5", h_h2, "HTTP/2 (http2 on, or listen ... http2)") line("CVE-2026-121810", "1.25.0", h_h3, "HTTP/3 (listen ... quic); worker_connections " wc) line("CVE-2026-123633", "1.19.7", h_h2 && h_pass, "HTTP/2 and a proxy to a backend; worker_connections " wc) line("CVE-2026-113425", "0.5.33", mailsrv, "mail proxy server" (mailsrv ? (mailwild ? "; a listener on all addresses" : "; listeners on specific addresses") : "")) line("CVE-2026-118899", "1.13.0", c6, "http listen ... ssl with TLSv1.3 in ssl_protocols") line("CVE-2026-120993", "1.30.6", c7, "stream: ssl_certificate with a variable, proxy_protocol v2, session reuse on" ((lib == "BoringSSL" || lib == "AWS-LC") ? "; " lib " is not affected" : "")) line("CVE-2026-125283", "0.9.6", c8, "location with alias and try_files that uses a map variable with unnamed regex captures") line("CVE-2026-120967", "1.25.5", c9, "stream: ssl_verify_client on in a server that is not the default on a shared listen socket") line("CVE-2026-123640", "1.15.2", c10, "stream: ssl_preread on and a $ssl_preread_ variable") if (!plus && (V == vnum("1.30.6") || (V >= vnum("1.31.0") && V < vnum("1.31.4")))) print "Note: for CVE-2026-120993, F5 lists 1.30.6 and 1.31.0 to 1.31.8; nginx.org lists only 1.31.4 to 1.31.8." print "Note: VERSION compares the upstream version number only. A distribution package can have the fix with an older number." if (plus) print "Note: for NGINX Plus, compare your release with each F5 article. This script was not tested on NGINX Plus." exit hit }'