Exploit databaseDownload repository ZIP
GH-d1ee921774cce6efeb23697803be60ae
timthebeastnl/nginx2root
Sources for CVE-2026-123007
23 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files6
timthebeastnl/nginx2rootRevision 04c245fb0433
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
nginx2root-check.sh
Suggested starting fileShell · 5,066 bytes#!/usr/bin/env bash
# nginx2root-check.sh — LOCAL, read-only host check for NGINX2Root.
#
# Run this ON the nginx host itself. It reads the installed binary version and
# the active configuration to tell you which of the five NGINX2Root CVEs your
# build and config are actually exposed to. It changes nothing.
#
# CVE-2026-123007 HTTP/2 flow-control memory corruption (RCE, "major")
# CVE-2026-123633 HTTP/2 use-after-free to upstream
# CVE-2026-121810 HTTP/3 (QUIC) use-after-free, proxied
# CVE-2026-123634 resolver use-after-free (resolver + proxy_pass var + mirror)
# CVE-2026-113425 mail-proxy use-after-free (auth_http, "major")
#
# Fixed in: nginx 1.30.7 (stable) and 1.31.9 (mainline), released 18 Nov 2026.
#
# Usage: ./nginx2root-check.sh [/path/to/nginx]
# sudo ./nginx2root-check.sh # sudo lets it read the full config
set -u
RED=$'\e[31m'; GRN=$'\e[32m'; YLW=$'\e[33m'; BLU=$'\e[34m'; RST=$'\e[0m'
if [ ! -t 1 ]; then RED=''; GRN=''; YLW=''; BLU=''; RST=''; fi
verlt() {
[ "$1" = "$2" ] && return 1
[ "$(printf '%s\n%s' "$1" "$2" | sort -V | head -n1)" = "$1" ]
}
is_patched() {
local v="$1"
if ! verlt "$v" "1.31.9"; then return 0; fi
if ! verlt "$v" "1.30.7" && verlt "$v" "1.31.0"; then return 0; fi
return 1
}
main() {
local NGINX cfg vline ver
NGINX="${1:-nginx}"
command -v "$NGINX" >/dev/null 2>&1 || { echo "nginx binary not found: $NGINX"; exit 2; }
printf '%s== NGINX2Root host check ==%s\n' "$BLU" "$RST"
# --- version ---------------------------------------------------------------
vline="$("$NGINX" -v 2>&1)"
ver="$(printf '%s' "$vline" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -n1)"
printf ' %s\n' "$vline"
if [ -z "$ver" ]; then
printf '%s[?]%s Could not parse version.\n' "$YLW" "$RST"
elif is_patched "$ver"; then
printf '%s[ OK ]%s nginx %s is patched (>= 1.31.9 mainline, or 1.30.7+ stable).\n' "$GRN" "$RST" "$ver"
printf ' A distro backport may fix it at the same version string — check your package changelog too.\n'
else
printf '%s[VULNERABLE]%s nginx %s predates the fix. Upgrade to 1.30.7 (stable) / 1.31.9 (mainline), then restart (not reload).\n' "$RED" "$RST" "$ver"
fi
# --- dump the effective config --------------------------------------------
cfg="$("$NGINX" -T 2>/dev/null)"
if [ -z "$cfg" ]; then
printf '%s[?]%s Could not read config via `nginx -T` (try sudo). Skipping config checks.\n' "$YLW" "$RST"
return 0
fi
grep_cfg() { printf '%s' "$cfg" | grep -vE '^\s*#' | grep -Eiq "$1"; }
printf '\n%s-- configuration exposure --%s\n' "$BLU" "$RST"
# HTTP/2: modern `http2 on;` directive or legacy `listen ... http2`
if grep_cfg '(^|[[:space:]])http2[[:space:]]+on[[:space:]]*;' || grep_cfg 'listen[^;]*[[:space:]]http2([[:space:];]|$)'; then
printf '%s[EXPOSED]%s HTTP/2 enabled -> CVE-2026-123007, and CVE-2026-123633 if you proxy_pass upstream.\n' "$RED" "$RST"
printf ' Stopgap: disable HTTP/2 (remove `http2 on;` / the `http2` listen flag).\n'
else
printf '%s[ OK ]%s HTTP/2 not enabled.\n' "$GRN" "$RST"
fi
# HTTP/3 / QUIC
if grep_cfg 'listen[^;]*[[:space:]]quic([[:space:];]|$)' || grep_cfg '(^|[[:space:]])http3[[:space:]]+on[[:space:]]*;'; then
printf '%s[EXPOSED]%s HTTP/3 (QUIC) enabled -> CVE-2026-121810 if those requests are proxied upstream.\n' "$RED" "$RST"
printf ' Stopgap: `http3 off;` / remove the `quic` listeners. (Not fixed by disabling HTTP/2.)\n'
else
printf '%s[ OK ]%s HTTP/3 (QUIC) not enabled.\n' "$GRN" "$RST"
fi
# Mail proxy
if grep_cfg '(^|[[:space:]])mail[[:space:]]*\{' || grep_cfg '(^|[[:space:]])auth_http([[:space:]]|$)'; then
printf '%s[EXPOSED]%s Mail proxy with auth_http configured -> CVE-2026-113425 (major).\n' "$RED" "$RST"
printf ' Stopgap: bind mail listeners to loopback/trusted networks only.\n'
else
printf '%s[ OK ]%s No mail proxy / auth_http configured.\n' "$GRN" "$RST"
fi
# Resolver UAF: needs resolver + a proxy_pass that uses a variable + mirror
local res=0 mir=0 pxv=0
grep_cfg '(^|[[:space:]])resolver[[:space:]]' && res=1
grep_cfg '(^|[[:space:]])mirror[[:space:]]' && mir=1
grep_cfg 'proxy_pass[^;]*\$' && pxv=1
if [ "$res" = 1 ] && [ "$mir" = 1 ] && [ "$pxv" = 1 ]; then
printf '%s[EXPOSED]%s resolver + mirror + variable proxy_pass present -> CVE-2026-123634.\n' "$RED" "$RST"
elif [ "$res" = 1 ] && [ "$pxv" = 1 ]; then
printf '%s[WARN]%s resolver + variable proxy_pass present; add `mirror` and you match CVE-2026-123634. Review.\n' "$YLW" "$RST"
else
printf '%s[ OK ]%s resolver/mirror/variable-proxy_pass combination for CVE-2026-123634 not all present.\n' "$GRN" "$RST"
fi
printf '\n%sReminder:%s config checks reduce noise but the only real fix is upgrading the binary and restarting nginx.\n' "$BLU" "$RST"
}
# Run only when executed directly; sourcing exposes the functions for testing.
if [ "${BASH_SOURCE[0]}" = "${0}" ]; then main "$@"; fi