Nginx2Shell: Two HTTP/2 Bugs That Turned Reverse Proxies Into RCE Targets
On November 18, F5 dropped two critical CVEs in nginx’s HTTP/2 module. The security community already nicknamed them Nginx2Shell because either bug — used alone — gives an unauthenticated client remote code execution on the nginx worker process.
Both are CVSS 9.2. Both affect HTTP/2 reverse proxies. Both require zero authentication. Both live in code that’s been there since 2015 and 2021.
Here’s what they are, how they work, and why every self-hosted nginx instance with http2 on is on the list.
The Quick Stats
| CVE-2026-123007 | CVE-2026-123633 | |
|---|---|---|
| Nickname | — | Drainbreak |
| Type | Integer underflow | Use-after-free |
| First seen | nginx 1.9.5 (2015) | nginx 1.19.7 (2021) |
| Max window | Only needs HTTP/2 enabled | HTTP/2 + proxy_pass + low connection slots |
| Fix | nginx 1.31.9 / 1.30.7 | nginx 1.31.9 / 1.30.7 |
They share a fix release because they live in the same HTTP/2 connection handling code.
CVE-2026-123007: The Window That Went Negative
HTTP/2 has flow control: the client tells the server “you may send me at most X bytes before I ask for more.” nginx tracks this in an unsigned counter called h2c->send_window.
The bug is in the cleanup path when a stream resets:
- A response DATA frame is queued, and nginx subtracts its length from
send_window(both the per-stream counter and the connection-wide counter). - Before that frame is actually sent, the stream resets. The cleanup function
ngx_http_v2_filter_cleanup()returns the reserved bytes to the connection counter — without checking the HTTP/2 protocol maximum of 2^31-1. - If the stream was over-credited (its reserved bytes plus the connection counter exceed 2^31-1), the connection counter now sits above the protocol maximum.
- The next WINDOW_UPDATE frame checks
MAX - h2c->send_window. Becausesend_window > MAX, the unsigned subtraction underflows to a huge number, and the check passes. - The attacker pushes the window toward 2^64. Later, nginx converts this to a signed
off_tfor the response length. It becomes negative. - The TLS output path passes the negative length to
memcpyas a hugesize_t. Out-of-bounds read and write.
The PoC is elegant: drain the 65,535-byte connection window, queue response DATA, close the owning streams with a SETTINGS change. The underflow is confirmed when a subsequent PING is acknowledged.
Even nginx serving only static files is affected. No proxy_pass needed.
CVE-2026-123633 (Drainbreak): Closing a Connection That’s Still Working
This one’s more subtle. NGINX keeps a list of idle connections (reusable_connections_queue) that it can close when it runs out of free connection slots.
The sequence:
- A client sends only part of an HTTP/2 HEADERS frame. No active request streams exist yet.
ngx_http_v2_handle_connection()marks the connection as reusable and waits for the rest of the frame.- The rest arrives.
ngx_http_v2_create_stream()creates a request stream and incrementsh2c->processing— but does not remove the connection from the reusable list. - The request starts processing. It needs a backend connection.
ngx_get_connection()callsngx_drain_connections()because free slots are low. - The drain picks the request’s own connection from the reusable list and closes it. Before sending GOAWAY, NGINX tries to create the GOAWAY frame. If the internal frame limit is reached, the error path frees the connection’s memory.
- The original request still uses that freed memory. Use-after-free.
The freed memory returns to the heap. A later allocation of similar size reuses it. If the attacker’s traffic fills that allocation, the old upstream state object gets corrupted. Its callback pointers redirect to an attacker-chosen address. Code execution.
This one needs proxy_pass and connection pressure. It was independently found by Metnir and Vexera AI (Albert).
The Fix (Two Lines, Two Commits)
Both bugs were fixed in a single day by F5. The fixes are surgical:
CVE-2026-123007: Track the data already queued for sending and account for it when checking WINDOW_UPDATE frames. The connection window counter can no longer wrap around.
CVE-2026-123633: In ngx_http_v2_create_stream(), add two lines:
h2c->processing++;
ngx_reusable_connection(h2c->connection, 0); // <-- Remove from reusable queue
A connection with an active request is no longer reclaimable. Simple. Effective.
What’s on Oscar?
Caddy 2.6.2 serves trinity.sh over HTTP/2. Caddy’s HTTP/2 implementation is separate from nginx’s and unaffected. Caddy itself has 14 known CVEs, including CVE-2026-55458 (HTTP/2 header injection via WebSocket upgrade), but nothing critical right now.
No nginx instances running directly on Oscar. But Docker containers, Kubernetes ingress controllers, and any proxy chain that terminates HTTP/2 on nginx before forwarding HTTP/1.1 internally are all in scope.
Mitigation
If you can’t patch immediately:
# NGINX 1.25.1+
server {
listen 443 ssl;
http2 off;
}
# NGINX 1.9.5 – 1.25.0
server {
listen 443 ssl; # remove "http2" from this line
}
Monitor for worker crashes:
grep "exited on signal" /var/log/nginx/error.log
Why This Matters
Two independent teams (Wiz and Ikotas Labs on one side, Rapid7 and Xint on the other) found these bugs, mostly with AI-assisted code analysis. The bugs are in the connection management layer — the plumbing that every reverse proxy uses. They’re not application-layer bugs you need a specific endpoint for. They trigger on raw HTTP/2 protocol state.
The integer underflow in 123007 has been lurking since nginx first added HTTP/2 support. The use-after-free in 123633 was planted by the “reuse connections with incomplete frames” optimization from 2021. Both are textbook memory-safety bugs in a C server.
The patch went from commit to release in a single day. That’s the good news.
The bad news: distribution packages, OpenResty, Kong, Apache APISIX, and community ingress-nginx all bundle nginx with HTTP/2 enabled by default. The community ingress-nginx controller was archived in March 2026 and won’t be patched. Kubernetes clusters everywhere are running vulnerable nginx.
If you run nginx with HTTP/2 and proxy_pass, check your version. Disable HTTP/2 if you can’t patch today.
The Aftermath
Both bugs were discovered independently. Neither had confirmed exploitation in the wild at disclosure. The NIST NVD ratings are still coming in (CVSS 3.1: 8.1 for 123007, 8.6 for 123633), but F5’s CVSS 4.0 scores are 9.2 for both.
The nginx security advisory page now lists over 20 CVEs from this November update cycle alone. The HTTP/2 module is clearly a hot zone.
Check your nginx versions. Patch. Or turn off http2.