maborak.com~/blog/nginx2root-five-pathssoftware & infrastructure engineering
Back to all articles

NGINX2Root: five nginx bugs and what our lab reproduced

Overview

Five nginx memory-corruption CVEs: the exact source lines, what our crash-only lab reproduced per CVE, and the root chain we did not test.

We built nginx 1.31.8 and 1.31.9 from the release tarballs with AddressSanitizer and UndefinedBehaviorSanitizer, then ran one declared case for each of the four we could run. Only 123007 moved: 1.31.8’s connection window reached 2,147,516,415, 32,768 above the protocol maximum; 1.31.9 refused the increment and sent GOAWAY. The other three runnable cases produced no sanitizer abort, and the HTTP/3 case did not run. We did not reproduce worker RCE or root.

Checked 19 November 2026.

Background

NGINX’s security index (opens in a new tab) lists five memory-corruption fixes in 1.30.7 and 1.31.9, released 18 November 2026. Four are use-after-free paths in the resolver, HTTP/2 connection handling, HTTP/3 and the mail proxy; the fifth is an HTTP/2 flow-control overflow.

Xint calls the group nginx2root: five nginx CVEs plus a separate Linux SCTP kernel vulnerability. Tenable’s FAQ (opens in a new tab) and LWN (opens in a new tab) describe the same scope. F5 and nginx.org list the nginx CVEs individually and do not use the name.

Xint demonstrated code execution as the nginx worker and chained the SCTP bug for host root. Xint describes the kernel bug as a use-after-free or double free in the SCTP send path; CIRCL (opens in a new tab) dates it to Linux 4.15 and records no CVE at disclosure, and LWN (opens in a new tab) records no kernel patch. Xint withheld the exploit details until a fix ships.

Mechanics

The snippets below are from nginx 1.31.8. The added lines are from the 1.31.9 fixes.

CVE-2026-123007: the refund has no bound

/* src/http/v2/ngx_http_v2.c:2564, 1.31.8 */
if (window > NGX_HTTP_V2_MAX_WINDOW - h2c->send_window) {
    return ngx_http_v2_connection_error(h2c, NGX_HTTP_V2_FLOW_CTRL_ERROR);
}

/* src/http/v2/ngx_http_v2_filter_module.c:1767, 1.31.8 */
h2c->send_window += window;

The check subtracts the current window from MAX but ignores DATA that nginx has queued and not sent. Cleanup then refunds that queued credit:

/* 1.31.9 */
if (window > NGX_HTTP_V2_MAX_WINDOW - h2c->send_window - h2c->send_queued) {
...
h2c->send_queued -= window;

The patch adds a send_queued counter to the connection and subtracts it in the check and in cleanup. Without it, a client can grant credit, cancel the stream, and let the refund push the connection window past 2^31-1. That is the invalid state our run reached. The remaining-capacity check then underflows, so further WINDOW_UPDATE frames are accepted; raising the window above 2^63 makes the signed off_t conversion negative, and the output path passes that length to the TLS copy. Reaching 2^63 is the large-transfer stage in Rapid7’s PoC, not the 32 KiB excess we observed.

CVE-2026-123633: the connection stays reusable

/* src/http/v2/ngx_http_v2.c:3193, 1.31.8 */
h2c->processing++;
/* 1.31.9 adds: */
ngx_reusable_connection(h2c->connection, 0);

Creating a stream raises the processing count but leaves the connection on the reusable list. When the worker runs low on connection slots, upstream allocation can drain that list. If the GOAWAY frame cannot be built, nginx closes the connection while its request is still running.

CVE-2026-123634: the resolver frees a detached context

/* src/core/ngx_resolver.c:574,595, ngx_resolve_name_done(), 1.31.8 */
ngx_log_error(NGX_LOG_ALERT, r->log, 0,
              "could not cancel %V resolving", &ctx->name);
...
ngx_resolver_free_locked(r, ctx);
/* 1.31.9 defers this free to ngx_resolver_free_handler */

The resolver completion loop detaches the waiting list and walks it. A handler can terminate the request and cancel a context that is still in that detached list. ngx_resolve_name_done() cannot find the context on the node, frees it anyway, and the loop later calls into freed memory.

CVE-2026-121810: the stream is inserted too late

/* src/event/quic/ngx_event_quic_streams.c:737,814, ngx_quic_create_stream(), 1.31.8 */
sc = ngx_get_connection(c->fd, log);
...
ngx_rbtree_insert(&qc->streams.tree, &qs->node);
/* 1.31.9 moves this insert above ngx_get_connection() */

Connection allocation can reenter cleanup and drain an idle stream on the same QUIC connection. The new stream is not in the tree yet, so cleanup cannot see it and may mark the parent reusable. A later upstream connect can then free the parent while the request is still on the stack.

CVE-2026-113425: the pending reply is not cleared

/* src/mail/ngx_mail_auth_http_module.c:184,216, ngx_mail_auth_http_init(), 1.31.8/1.31.9 */
/* the request is created while s->out still holds the queued reply */
ctx->request = ngx_mail_auth_http_create_request(s, pool, ahcf);
...
/* 1.31.9 adds, after ngx_event_connect_peer: */
s->out.len = 0;
/* and blocks client writes until the auth connection closes */

A queued client reply remains in s->out when the auth_http exchange starts. If the client resets, the session can be destroyed while the authentication connection still points at it.

Impact

The prerequisites below follow F5’s CNA descriptions. Interim controls follow Xint’s configuration guidance (opens in a new tab). Fixed versions refer to upstream OSS releases; distribution backports need their vendor’s full package revision and CVE status.

CVE Prerequisites on an unpatched build Fixed OSS Temporary mitigation coverage
CVE-2026-123007 (opens in a new tab) Client-facing HTTP/2. Xint (opens in a new tab) reports that static responses suffice; no backend is required. 1.30.7 / 1.31.9 Disable HTTP/2 on every reachable affected listener.
CVE-2026-123633 (opens in a new tab) Client HTTP/2, backend proxying and low available worker connection slots. 1.30.7 / 1.31.9 Same HTTP/2 control. Raising worker_connections leaves the lifetime defect (opens in a new tab) unfixed.
CVE-2026-123634 (opens in a new tab) Variable-derived backend name resolved by both the request and an SSI or mirror subrequest. 1.30.7 / 1.31.9 Remove affected request-time lookup from both paths using reviewed fixed upstreams or addresses. Disabling mirror alone misses SSI.
CVE-2026-121810 (opens in a new tab) F5 identifies HTTP/3 configurations. Xint (opens in a new tab) demonstrates upstream forwarding; release notes identify connection-slot pressure. 1.30.7 / 1.31.9 Remove affected listen ... quic listeners, disable HTTP/3 and withdraw its advertisements. Removing Alt-Svc alone leaves QUIC reachable.
CVE-2026-113425 (opens in a new tab) F5 identifies mail proxying. Xint (opens in a new tab) demonstrates proxy on with auth_http, without valid credentials. 1.30.7 / 1.31.9 Close affected mail listeners or temporarily restrict them to trusted sources.

NGINX’s TLS selection code (opens in a new tab) accepts either setting, so a standalone http2 off cannot override a surviving legacy listener flag. Check shared sockets, inherited settings and IPv6 listeners.

The chain needs an nginx entry point and a reachable kernel path, or another local escalation, as CIRCL (opens in a new tab) notes. Worker access alone stops short of host root unless the worker already runs as root.

Probe

We built both versions from the nginx.org tarballs with -fsanitize=address,undefined -fno-sanitize=nonnull-attribute -fno-sanitize-recover=all -fno-omit-frame-pointer -g -O1 in a digest-pinned Debian 13 builder. Each binary ran in a fresh unprivileged container with --cap-drop ALL, --security-opt no-new-privileges, no mounts, no published ports and an internal Docker network.

Build identity: source and binary SHA-256, configure line, builder
nginx-1.31.8.tar.gz  0652b760b3b772d2ec17b47c2fc15d9a95e6fe35cd5b877eadc1a62d9bc75af1
nginx-1.31.9.tar.gz  a11c5eeee2e257f4478f0e649f84b0040787d277d2d3e5233952aa6b6dcb80ad
nginx 1.31.8 binary  27e045e8db2d957f3a889eadfe63b59857663964c08b4d848d95e1339f51a086
nginx 1.31.9 binary  cc40357c4d6b4fe492586b994f6b4e16d4990116d7366f3ef5f5ad19adce238b
builder              debian@sha256:a72b4433de1cf7d6bae0c4cee74d0547f58601a643b3375f070c51600d63b6b2
toolchain            gcc 14.2.0, libc6 2.41-12+deb13u4, OpenSSL 3.5.7

configure (both; prefix /opt/nginx-<version>)
--with-debug --with-http_ssl_module --with-http_v2_module --with-http_v3_module
--with-mail --with-mail_ssl_module
--with-cc-opt='-fsanitize=address,undefined -fno-sanitize=nonnull-attribute -fno-sanitize-recover=all -fno-omit-frame-pointer -g -O1'
--with-ld-opt='-fsanitize=address,undefined'

Each runnable case ran a benign control, then one declared trigger, with one worker and a fresh container. The client was a purpose-built Python 3.15 script using the standard ssl module and raw HTTP/2 frames. The oracle was a sanitizer abort; after each trigger we checked the container state and the master log for a worker-exit line. Here is what each CVE test did:

CVE What we ran 1.31.8 1.31.9 Reproduced?
123007 WINDOW_UPDATE and queued-refund sequence Window 2,147,516,415; no abort Refused increment, GOAWAY; no abort Defect yes; RCE no
123633 Partial HEADERS, 12 fillers, RST No abort No abort No
123634 Resolver plus mirror, NXDOMAIN 502, one query; no abort Same No
121810 Not run: no QUIC client Inconclusive Inconclusive No
113425 Mail auth_http, client RST Auth request sent; no abort Same No

The 1.31.8 debug log recorded a connection window above NGX_HTTP_V2_MAX_WINDOW; 1.31.9 logged the increment as not allowed and sent GOAWAY. The window is a secondary measurement; the declared crash oracle did not fire.

One resolver query leaves the two contexts unproven, the drain case never ran out of slots, and the mail case never held a pending reply. We report those three as no crash on either build. All cases used error_log ... debug, which changes event-loop timing and weakens a negative reading of those three.

Censys (opens in a new tab) reproduced the 123007 accounting difference over cleartext HTTP/2 on 1.31.8 and 1.31.9 and reported use-after-free conditions or worker crashes for 123633, 123634 and 113425; it also did not reproduce 121810. Rapid7 (opens in a new tab) published a worker-level 123007 proof of concept that needs about 128 GB of HTTP/2 traffic and a specific x86-64 glibc copy path; it stops at the worker. Wiz (opens in a new tab) independently found both HTTP/2 bugs and demonstrated 123007 remote code execution against 1.31.7 and 1.31.8. No public POC includes the kernel stage.

Our arm64 lab could not run the Rapid7 PoC: the emulated amd64 container reports the host’s ARM64 CPU features and no AVX-512 flags, and the exploit depends on an AVX-512 glibc copy path. The vulnerable code is in nginx’s C source on every architecture.

The workers ran as uid 101 with all capabilities dropped, and the lab stopped at crash and invariant observation. To show the boundary, we ran the same uid in the same image with no network.

Privilege-boundary output: uid 101, zero capabilities, failed setuid(0)
uid=101(nginxlab) gid=101 groups=101
CapPrm: 0000000000000000
CapEff: 0000000000000000
CapBnd: 0000000000000000
NoNewPrivs: 1
setuid(0): PermissionError: [Errno 1] Operation not permitted
setgid(0): PermissionError: [Errno 1] Operation not permitted

Every container name, label, request User-Agent, probe header and fixture carried maborak-nginx2root. Anyone can set the same marker, so it cannot prove who sent a request.

The crash sequences stay in the lab harness; we do not publish them here because they are crash inputs for unpatched servers. The runnable check below tests the five source markers:

for v in 1.31.8 1.31.9; do
  curl -sSLO "https://nginx.org/download/nginx-$v.tar.gz"
  tar xzf "nginx-$v.tar.gz"
  s="nginx-$v/src"
  printf '%s flow-control=%s' "$v" "$(grep -c 'send_queued' "$s/http/v2/ngx_http_v2.h")"
  printf ' http2-stream=%s' "$(grep -c 'ngx_reusable_connection(h2c->connection, 0)' "$s/http/v2/ngx_http_v2.c")"
  printf ' resolver=%s' "$(grep -c 'ngx_resolver_free_handler' "$s/core/ngx_resolver.c")"
  printf ' mail=%s' "$(grep -c 's->out.len = 0;' "$s/mail/ngx_mail_auth_http_module.c")"
  printf ' quic='
  awk '/ngx_rbtree_insert\(&qc->streams.tree/{i=NR}
       /sc = ngx_get_connection\(c->fd, log\)/{g=NR}
       END{print (i && g && i<g) ? "before" : "after"}' \
      "$s/event/quic/ngx_event_quic_streams.c"
done

It printed:

1.31.8 flow-control=0 http2-stream=0 resolver=0 mail=0 quic=after
1.31.9 flow-control=1 http2-stream=1 resolver=7 mail=1 quic=before

Mitigation

Patch to 1.30.7, 1.31.9 or the vendor’s complete fixed package. NGINX Plus fixes are separate: 37.0.8.1 and 37.3.0.1 (opens in a new tab) carry four of the five, while 37.0.7.1 and 37.2.0.1 carry CVE-2026-123633, the HTTP/2 connection fix. Do not cherry-pick one upstream commit and treat the branch as covered.

If a patch cannot land immediately, choose controls per path:

  • Remove http2 on and every legacy listen ... http2 on reachable listeners (123007, 123633). Confirm the change on shared addresses, IPv6 and cleartext endpoints. Expect native gRPC to fail.
  • Replace request-time variable resolution with a reviewed fixed upstream group or IP literal in both the main location and every subrequest location that resolves the same name (123634). Check Host, SNI, URI and failover behavior afterwards.
  • Remove the actual QUIC listeners, set http3 off where the build supports it, and withdraw Alt-Svc (121810). Blocking the matching UDP port is an additional boundary.
  • Close the mail listeners, bind them to loopback if the remote mail service can be stopped, or restrict them to a trusted source list (113425).

The kernel step is separate. Where SCTP is not required, block the module with install sctp /bin/false in /etc/modprobe.d/; this does not unload a loaded module or cover a kernel with SCTP built in. Container profiles can deny socket(AF_INET, SOCK_STREAM, IPPROTO_SCTP) with seccomp. Patch the kernel when a fix ships; patching nginx closes the entry point but leaves the local escalation in place.

Verification

An installed package, a passing nginx -t and a reload leave the serving executable unverified. On Linux, compare the running image with the trusted artifact:

# Take the PID from the service manager or process tree, not the first match.
PID=1234
INSTALLED=/usr/sbin/nginx
sudo readlink "/proc/$PID/exe"
sudo sha256sum "/proc/$PID/exe" "$INSTALLED"
sudo "/proc/$PID/exe" -V 2>&1 | head -n 1

If the hash differs or the path ends in (deleted), find out why. Equal hashes establish artifact identity; pair them with the vendor package revision or the pinned source commit. Repeat the check for every master and serving worker; a live upgrade can leave two generations.

A reload starts new workers from the existing master image. Replacing the binary needs a service restart or NGINX’s documented live upgrade, followed by retirement of the old master and workers. In a container, replace every serving replica and remove the old ones. Then confirm the intended configuration is loaded, ordinary HTTPS works and HTTP/2 is unavailable where you disabled it. ALPN tells you which protocol an endpoint offers; a patched build still offers h2, so it cannot tell you whether the patch is present.

Sources

Back to all articles

Technologies we work with

  • Argo CD
  • Kubernetes
  • Docker
  • Podman
  • Ansible
  • Jenkins
  • Chef
  • Proxmox VE
  • Google Cloud
  • Linux
  • Red Hat
  • CentOS
  • NGINX
  • Apache
  • Traefik
  • Prometheus
  • Grafana
  • PostgreSQL
  • MySQL
  • MariaDB
  • Redis
  • etcd
  • Qdrant
  • Elasticsearch
  • Logstash
  • Kibana
  • PagerDuty
  • Go
  • Python
  • FastAPI
  • PHP
  • TypeScript
  • React