
CVE-2026-123007: an unsigned subtraction in Nginx, 11 years dormant, 11.8M hosts exposed
- luandnh
- Backend , System design
- November 21, 2026
Table of Contents
The VPS serving this page
I ran nginx -v on the exact box serving the page you are reading: nginx/1.24.0 (Ubuntu), package 1.24.0-2ubuntu7.20, built with --with-http_v2_module. CVE-2026-123007 covers 1.9.5 through 1.31.8. This box sits right in the middle of that range. The second condition is HTTP/2 being on, and the module is already compiled in.
So I ran the command every operator runs:
openssl s_client -alpn h2 -connect blog.luandnh.com:443 </dev/null 2>/dev/null | grep ALPN
ALPN protocol: h2. Unambiguous. It is speaking HTTP/2 to the server.
Stop there and the conclusion is: this blog is vulnerable, patch now. But I asked the origin a second question:
curl --http2-prior-knowledge http://127.0.0.1/
# Remote peer returned unexpected data while we expected SETTINGS frame
curl --http1.1 http://127.0.0.1/
# HTTP/1.1 200 OK
Two contradictory answers. Both correct, because they answer different questions. openssl was talking to Cloudflare, not to my nginx. TLS terminates at the edge. And my server block has exactly one directive that matters:
server {
listen 80;
server_name blog.luandnh.com;
}
No http2, no http2 on;. The origin only speaks HTTP/1.1 through the Cloudflare tunnel; hit port 80 directly with h2c and it rejects you at the very first SETTINGS frame.
This box dodged the CVE through a configuration accident, not by design. I come back to that at the end.
What actually shipped on Nov 18
F5 pushed a batch. Nginx OSS 1.30.7 (stable) and 1.31.9 (mainline). Plus 37.0.7.1 / 37.2.0.1 for the use-after-free, Plus 37.0.8.1 / 37.3.0.1 for the underflow. Ten CVEs in a single release.
The two that matter are both pre-auth RCE, both CVSS 4.0 = 9.2, both with no authentication and no third-party module.
- CVE-2026-123007: integer underflow in HTTP/2
send_window, leading to an out-of-bounds copy. Affects 1.9.5 through 1.31.8. The code dates to 2015, about 11 years. Exploitable in the default config with HTTP/2 enabled, even when the server only serves static files and has no backend app behind it. - CVE-2026-123633: use-after-free on an HTTP/2 connection. Affects 1.19.7 through 1.31.8, nearly 6 years. Requires a reverse proxy (
proxy_pass/fastcgi_pass/grpc_pass) and hitting a moment when connection slots run low.
The number that stopped me: Xint’s Shodan snapshot from Nov 10 2026 found 11.8 million of 11.94 million version-identifiable nginx hosts running an affected release. 88.6% of the Fortune 500 use nginx. Over 225 million websites.
And the detail that rattled the security crowd: it was found independently by five teams. Wiz Research, Ikotas Labs, Metnir, Rapid7, Xint (Theori). Five teams landing on one bug within weeks. That basically never happens.
HTTP/2 flow control, from first principles
HTTP/2 multiplexes many streams over one TCP connection. Flow control here is not about network congestion. It is about stopping one stream from eating the whole connection’s bandwidth. The receiver grants credit, the sender spends it. Out of credit, the sender stalls.
There are two independent window layers, and the sender has to satisfy both:
| Connection window | Stream window | |
|---|---|---|
| Scope | The whole TCP connection | One stream ID |
| nginx field | h2c->send_window | stream->send_window |
| Initial value | 65,535 bytes | 65,535 bytes |
| Raised by | WINDOW_UPDATE on stream 0 | WINDOW_UPDATE on a specific stream |
| Ceiling | NGX_HTTP_V2_MAX_WINDOW | NGX_HTTP_V2_MAX_WINDOW |
| Lowered by | Sending a DATA frame | Sending a DATA frame |
| Released on | Connection close | RST_STREAM or END_STREAM |
The client sends WINDOW_UPDATE to say “I can take this much more”. The server decrements the window every time it pushes DATA. A client cancels a stream with RST_STREAM.
One thing to hold onto: RST_STREAM does not wipe data already sitting in the send queue. It just marks the stream dead. That DATA is still there, and the credit already spent on it is still held. nginx has a cleanup function to refund that credit. That function is where the bug lives.
CVE-2026-123007: four steps from a plus sign to RCE
Step 1: refunding credit with no ceiling check
When response DATA gets queued, nginx subtracts its size from h2c->send_window. If the stream is cancelled while DATA is still queued, ngx_http_v2_filter_cleanup() drops the unsent data and refunds the credit:
/* ngx_http_v2_filter_cleanup(), trimmed */
h2c->send_window += window;
No check against NGX_HTTP_V2_MAX_WINDOW. None. Just an addition.
Now put yourself on the attacker side. Send a large response, park DATA in the queue. While it sits there, WINDOW_UPDATE the allowance upward. Then RST_STREAM. Cleanup refunds credit into a window that was already raised, and the total blows past the ceiling. nginx is now holding a state its own code assumes cannot exist.
Step 2: the unsigned subtraction wraps
Next is ngx_http_v2_state_window_update(). This is wrong in a way only C can be wrong:
if (window > NGX_HTTP_V2_MAX_WINDOW - h2c->send_window) {
/* reject, over the ceiling */
}
send_window is unsigned. Once it exceeds MAX_WINDOW, the expression MAX_WINDOW - send_window does not go negative. It wraps into an enormous positive number. So the “is this over the ceiling” check answers: plenty of room, keep going. The attacker can send WINDOW_UPDATE all day and every one gets approved.
That is the entire bug, wrapped in one if statement. Not a wrong business rule. Not a race. A type.
Step 3: cast to off_t, becomes negative
The absurd number flows into ngx_http_v2_send_chain(), gets cast to signed off_t to compute how many bytes are still sendable. Large enough and it goes negative. That negative length travels into the code describing a response buffer chunk, and the result is an end pointer sitting before the start pointer.
A buffer with end before start. In C that is not an error. It is a perfectly valid memory region by every arithmetic rule, just not one anybody wants to exist.
Step 4: ngx_ssl_send_chain() copies out of bounds
The TLS send path takes that length, runs it through a few more signed/unsigned conversions, and turns it into a copy past the edge of the allocation. The attacker gets memory disclosure plus heap corruption. From there it is unauthenticated RCE.
Wiz confirmed an ASLR bypass on official 1.31.7 and 1.31.8 builds. Exploitation was tested over HTTPS on 64-bit systems.
graph TD
A["1. Stream cancelled while DATA is queued"] --> B["2. filter_cleanup refunds credit, no ceiling check"]
B --> C["3. send_window exceeds MAX_WINDOW"]
C --> D["4. WINDOW_UPDATE: unsigned wrap, check passes"]
D --> E["5. send_chain casts to off_t, goes negative"]
E --> F["6. Buffer chunk with end before start"]
F --> G["7. ngx_ssl_send_chain copies out of bounds"]
CVE-2026-123633: a connection that dies mid-request
The second bug has a completely different shape. No arithmetic is wrong. Just a ledger that gets out of sync.
nginx keeps a list of reusable connections it can close when it needs room. An HTTP/2 connection joins the list when it has no active requests, and must leave the moment a request starts.
The attacker sends part of a HEADERS frame and stops. No active streams, so ngx_http_v2_handle_connection() calls:
ngx_reusable_connection(c, 1);
return;
It returns early because h2c->state.incomplete. The connection is now on the reusable list.
The attacker sends the rest. ngx_http_v2_create_stream() creates the stream and increments h2c->processing, but never removes the connection from the reusable list. There is now a request in flight on a connection nginx believes is safe to close at any moment.
That request gets forwarded upstream, which calls ngx_get_connection(). When free slots run low, ngx_drain_connections() picks reusable connections to close. It picks ours, mid-request.
Before closing, nginx tries to send GOAWAY. If it already hit its internal frame limit and has no frame to reuse, the error path closes the connection and frees its memory. Then processing resumes in the original request, still holding a pointer into freed memory. Use-after-free.
The conditions: a reverse proxy, plus a moment when connection slots run low. Not every nginx. Every nginx fronting something behind it.
graph LR
subgraph "Public internet"
A["Attacker: one TLS connection, a few HEADERS frames"]
end
subgraph "Edge CDN"
B["TLS terminates, downgraded to HTTP/1.1"]
end
subgraph "VPS"
C["nginx worker: user nginx"]
D["App backend :8080"]
end
subgraph "Host"
E["root: needs a separate kernel SCTP LPE"]
end
A -->|"HTTP/2 to the edge"| B
B -->|"HTTP/1.1 over the tunnel"| C
C -->|"proxy_pass, slots exhausted"| D
C -.->|"RCE + LPE"| E
Xint’s escalation chain is worth noting: RCE in nginx only gets code execution as the worker user. Reaching host root needs a separate local privilege escalation in the Linux kernel, specifically SCTP, CVE pending, patch “in coming weeks”. The nginx bug alone is enough to read data and live on the box. Root is a different story, and it is on hold.
Same bug shape, written in Go
I write Go all day, so my first question after the writeup was: same bug, in golang.org/x/net/http2, what comes out?
maxFlowWindow = (1 << 31) - 1 in flow.go.
func (f *connOutflow) add(n int32) bool {
sum := int64(f.n) + int64(n)
if sum > maxFlowWindow {
f.flowErr = true
return false
}
f.n += n
return true
}
And at the stream layer:
func (f *outflow) add(n int32) bool {
avail := int64(f.conn.initial) + int64(f.delta)
if avail+int64(n) > maxFlowWindow {
return false
}
f.delta += n
return true
}
func (f *outflow) available() (int32, bool) {
if f.conn.flowErr {
return 0, false // stop sending, do not guess
}
// ... rest trimmed
}
Two details decide everything.
First, it always widens to int64 before comparing. There is no unsigned subtraction to wrap. The MAX_WINDOW - send_window expression from C becomes avail + n > max with both sides int64. Nowhere to overflow.
Second, on breach it never stores the impossible value. outflow.add returns false and the window stays where it was. connOutflow.add latches flowErr, and available() reads that flag and returns 0, false, stopping all sending. No absurd number survives to reach the layer below.
inflow.add goes further and panics: flow control update exceeds maximum window size. Loud, but it does not corrupt memory.
Same bug shape, same location, same input. On the C side you get a CVE. On the Go side you get a connection error or a panic. The difference is not the programmer. It is that Go will not let you do arithmetic on pointers, and it bounds-checks every slice access.
The price, plainly
Go pays real costs. Every flow control comparison is an int64 widen. Every slice read is a compare against len. Every stream is a struct with counter fields, an allocation, GC to scan. On a server pushing hundreds of thousands of frames a second, none of that is free. The nginx authors picked C because they need that number, and they have 20 years of evidence that it was worth it.
But 11 years. One if statement. One unsigned subtraction. That is the other side of the bill, and it was paid in a 9.2 on 11.8 million hosts.
I will pick a side: for edge infrastructure, the thing facing the internet that nobody can fully review, I take the bounds check. I would rather pay a few percent of throughput than read a writeup about myself. If you need speed, optimize somewhere else. The first tier has to be a tier that cannot shoot itself in the foot with a plus sign.
Eleven years of nobody noticing, and what changed
The bug dates to 2015. It sat there for 11 years, through thousands of reviews, through every audit. Nobody saw it. Then in October and November 2026, five teams saw it within weeks.
What changed is not people. It is tooling.
Wiz used a harness called Wiz Atlas, the thing behind their AI Code scanning service, to find both bugs, then validated impact with Gemini 4 Carbon and ChatGPT 5.6 Sol. Xint pointed their harness at roughly 50,000 lines of nginx. 90 minutes later it reported high-severity issues with reproduction steps specific enough to become a working exploit in under 10 minutes.
The number I sat with longest: 4 of 5 nginx bugs Xint found came from the harness with no human guidance, after they folded the learnings into a general feature rather than an nginx-tuned one.
Read that again. They did not build a tool that understands nginx. They built a tool that understands classes of bugs, threw nginx at it, and it still worked.
Wiz: “Complexity can no longer be relied upon as a barrier to discovery or exploitation.” Xint: “Pre-auth RCE in nginx almost never happens. The best known one is from 2013.”
Add those up and it is bad news for anyone running infrastructure. A hand-written 200,000-line C codebase, 20 years old, used to be a wall. Not because it was safe, but because finding bugs in it cost people. Now search costs roughly nothing. The wall has not disappeared, but it is no longer a wall.
When search cost goes to zero, independent teams converge on the same place. Bug collision becomes normal. For defenders, the window between “the bug exists” and “the bug is exploited” is far shorter than 11 years. The real timeline is measured in weeks: Xint found it Oct 11, reported via HackerOne Oct 16. Wiz reported the UAF Oct 21, F5 had a patch for review Nov 10, Wiz reported the second bug Nov 16, coordinated release Nov 18.
A checklist for a small team
I do not run a fleet, just a few VPS boxes. The list works at both scales.
Five exposure conditions for CVE-2026-123007:
- nginx in the 1.9.5 to 1.31.8 range.
- HTTP/2 enabled at the origin, not just at the CDN.
- The origin accepts connections directly from the internet, or through a CDN that does not terminate h2. A CDN that terminates h2 cuts origin exposure, but how much depends on the implementation.
- No backend app required. Static files are enough.
- No third-party module required. Default config is enough.
For CVE-2026-123633 the conditions shift: you need a reverse proxy (proxy_pass / fastcgi_pass / grpc_pass) and a moment when connection slots run low.
The patch path. Move to 1.30.7 (stable) or 1.31.9 (mainline). Plus goes to 37.0.7.1 / 37.2.0.1 for the UAF, 37.0.8.1 / 37.3.0.1 for the underflow. If you cannot upgrade immediately, turn h2 off: on 1.25.1 or newer put http2 off; in the server block; on 1.9.5 through 1.25.0 remove the http2 parameter from listen. Then nginx -t && nginx -s reload, and verify from outside that h2 is no longer negotiated.
Warning
nginx -s reload does not load a new binary. It reloads config; the old process keeps the old code in memory until the old workers are fully gone. So you patch, you reload, nginx -v reports the new version, and the workers still serving requests may be running old code. Restart the service: systemctl restart nginx. Confirm with ps -o lstart= -p $(cat /run/nginx.pid) that the master really is new.
The backport trap. Version strings lie. Distros backport fixes and keep the old version number. On Ubuntu, do not compare nginx -v against the advisory. Compare the full package version. Mine is 1.24.0-2ubuntu7.20; that is the string you check.
| CVE | Class | Affected range | CVSS | Condition |
|---|---|---|---|---|
| CVE-2026-123007 | HTTP/2 send_window integer underflow, OOB copy, pre-auth RCE | 1.9.5 - 1.31.8 | 9.2 | HTTP/2 enabled, default config |
| CVE-2026-123633 | HTTP/2 connection use-after-free | 1.19.7 - 1.31.8 | 9.2 | reverse proxy, slots exhausted |
| CVE-2026-121810 | HTTP/3 use-after-free | 1.25.0 - 1.31.8 | 9.2 | reverse proxy |
| CVE-2026-123634 | DNS resolver use-after-free | - | 9.2 | resolver + proxy_pass + mirror, mirror_request_body off |
| CVE-2026-113425 | Mail proxy use-after-free | - | 9.2 | proxy on + auth_http |
| CVE-2026-118899 | Infinite loop reading request body, DoS | - | 8.7 | TLS 1.3 |
| CVE-2026-120993 | NULL deref with proxy_protocol v2 | - | 6.9 | proxy protocol v2 |
| CVE-2026-125283 | Buffer overflow with alias + try_files | - | 6.9 | alias + try_files |
| CVE-2026-123640 | Missing validation in stream ssl_preread | - | 6.9 | stream ssl_preread |
| CVE-2026-120967 | Client cert bypass under a specific SNI config | - | 6.3 | specific SNI config |
The detection limit. This part goes against most people’s reflexes.
Ordinary access logs do not record WINDOW_UPDATE and RST_STREAM frames. Those are HTTP/2 layer frames, not requests. So “my access.log looks clean” proves nothing. An attacker can push the counter with thousands of frames while the log shows one GET /.
What to look at: error logs, worker crashes, unexpected child processes under the nginx account, and long-lived HTTP/2 connections pushing large amounts of data.
A WAF will not save you. WAFs inspect URLs, headers, bodies. This bug lives in HTTP/2 frame processing, before any request is assembled. Nothing to match.
One entry point, one blast radius. If one nginx fronts 20 domains, 20 apps, 5 teams, then one pre-auth bug there is one pre-auth bug in all 20. The convenience of a shared entry point is a shared blast radius. You do not have to split everything up, but you do have to know what you are lumping together.
Back to that listen 80;
This box is not vulnerable to CVE-2026-123007. The reason is one line written when I set the blog up, with zero security intent: listen 80;. No http2. So the origin does not speak h2, so the bug in send_window has no way in.
I did not write that line as defense. I wrote it because Cloudflare already handles TLS and adding h2 at the origin was redundant. It came out right because I was lazy, not because I understood.
That is the uncomfortable part. If I had turned on http2 on; for “speed”, or copied a config snippet that ships listen 443 ssl http2;, this box would have been one of those 11.8 million exposed hosts, and I would never have known, because access logs were clean and workers never crashed.
The VPS still runs 1.24.0. Still in the affected range. I checked again while writing these lines, and it still says listen 80;. But next time I am not counting on luck. apt list --upgradable | grep nginx, then restart, not reload. The full writeup is at nginx2root.com.


