# CVE-2026-119618 — Apache httpd `mod_http2` heap corruption in `assign_headers()` | | | |---|---| | **CVE** | CVE-2026-119618 | | **Component** | Apache HTTP Server, module `mod_http2` (standalone `mod_h2`) | | **Affected** | httpd 2.4.55 – 2.4.70 · mod_h2 2.0.8 – 2.0.42 | | **Fixed in** | httpd 2.4.71 · mod_h2 2.0.43 | | **CWE** | CWE-362 — Concurrent Execution using Shared Resource with Improper Synchronization | | **Impact** | Heap corruption in an httpd child process; potential remote code execution | | **Vector** | Network, unauthenticated, HTTP/2 (cleartext `h2c` or TLS `h2`) | | **Trigger** | A body-less HTTP/2 request carrying `Content-Type` and no `Content-Length`, with the request header table filled to capacity | | **Fix commit** | `824beab9b9424d6cfb29595248fdbf6c3dddeab1` (cherry-pick of trunk `5ed39287660daacd1233cb9bbc984b25fa9a4fe3`) | | **Upstream PR** | apache/httpd#975 → apache/httpd#977, merged 2026-11-09 | | **Credit** | Anthropic's OSS Scanner (ANT-2026-MAPKT6MZ); Anthony Weems and Simon Scannell, Google Cloud Vulnerability Research | | **Advisory** | https://httpd.apache.org/security/vulnerabilities_24.html | | **Workaround** | remove `h2` and `h2c` from the `Protocols` directive | | **Repository** | https://github.com/googlesky/CVE-2026-119618 | `mod_http2` gives every HTTP/2 stream a pool of its own, and that pool inherits the allocator of the connection that owns the session. The allocator has no mutex: `apr_allocator_create()` does not create one, so `allocator_lock()` is a no-op for the whole connection. Request processing is deliberately moved to worker threads with a **private** allocator (`c2_transit_create()`) precisely so that a worker never touches the connection's allocator. `assign_headers()` breaks that invariant: for a body-less request that carries `Content-Type` and no `Content-Length`, the worker writes the synthesised `Content-Length: 0` into the **shared** stream table instead of the request-private `r->headers_in`. When the table is full, that write allocates a new 8 KB node from the connection's lock-free allocator while the connection thread is allocating from or freeing to the same free list. Two threads can pop the same node, and the resulting double ownership corrupts the heap of the httpd child process. This repository contains a containerised differential laboratory that reproduces the corruption on httpd 2.4.70, proves the race with ThreadSanitizer, shows httpd 2.4.71 clean under the same traffic, exercises every sibling request shape, verifies the published workaround, and records a 0-day sweep on the fixed line. --- ## 1. Root cause ### 1.1 The affected code `modules/http2/h2_request.c`, Apache httpd 2.4.70, `assign_headers()`. Line numbers are from the 2.4.70 release tarball. ```c 320: static void assign_headers(request_rec *r, const h2_request *req, 321: int no_body, int is_connect) 322: { 323: const char *cl; 324: 325: r->headers_in = apr_table_clone(r->pool, req->headers); ... 341: /* Unless we open a byte stream via CONNECT, apply content-length guards. */ 342: if (!is_connect) { 343: cl = apr_table_get(req->headers, "Content-Length"); 344: if (no_body) { 345: if (!cl && apr_table_get(req->headers, "Content-Type")) { 346: /* If we have a content-type, but already seen eos, no more 347: * data will come. Signal a zero content length explicitly. 348: */ 349: apr_table_setn(req->headers, "Content-Length", "0"); 350: } 351: } ``` The fix in 2.4.71 changes one line: ```diff - apr_table_setn(req->headers, "Content-Length", "0"); + apr_table_setn(r->headers_in, "Content-Length", "0"); ``` `r->headers_in` is the clone created on line 325 in `r->pool`, the request pool owned by the worker thread. `req->headers` is the stream's table, allocated from the stream pool and reachable by the connection thread. ### 1.2 The stream pool shares the connection's lock-free allocator `h2_session_open_stream()` (`h2_session.c:117`) creates the per-stream pool as a child of the session pool and tags it: ```c apr_pool_create(&stream_pool, session->pool); apr_pool_tag(stream_pool, "h2_stream"); stream = h2_stream_create(stream_id, stream_pool, session, ...); ``` The session pool is a descendant of the connection pool that the MPM creates in `child_main()` (`server/mpm/prefork/prefork.c:423`). That pool's allocator comes from `apr_allocator_create()`, and **no mutex is ever set on it**: ```c /* memory/unix/apr_pools.c:164 */ static APR_INLINE void allocator_lock(apr_allocator_t *allocator) { #if APR_HAS_THREADS if (allocator->mutex) /* NULL for the MPM allocator */ apr_thread_mutex_lock(allocator->mutex); #endif } ``` Request processing, on the other hand, is explicitly designed to avoid that allocator. `c2_transit_create()` (`h2_mplx.c:210`) gives every worker a private allocator: ```c /* We create a pool with its own allocator to be used for * processing a request. This is the only way to have the processing * independent of its parent pool in the sense that it can work in * another thread. */ rv = apr_allocator_create(&allocator); ``` The worker's `request_rec` is created on `c2->pool`, a descendant of the transit pool, so every allocation the worker normally makes is private. The vulnerable write is the exception: it allocates from the stream pool, whose allocator is the connection's. ### 1.3 The write only allocates when the header table is full `apr_table_setn()` on an absent key falls through to `apr_table_add()`, which calls `table_push()` → `apr_array_push_noclear()` (`tables/apr_tables.c:126`): ```c if (arr->nelts == arr->nalloc) { int new_size = arr->nalloc <= 0 ? 1 : 2 * arr->nalloc; apr_table_entry_t *new_elts = apr_palloc(arr->pool, elt_size * new_size); ... } ``` The table is created by `h2_request_create()` as `apr_table_make(pool, 10)`, so `nalloc` starts at 10 and doubles: 10, 20, 40, 80, 160. Pseudo-headers are not stored in the table — they become `req->method`, `req->scheme`, `req->authority` and `req->path`. `h2_request_end_headers()` (`h2_request.c:212`) adds exactly one `Host` entry. A request with **79 regular headers** therefore holds 79 entries, `Host` makes 80, and `nelts == nalloc == 80` when `assign_headers()` runs. The vulnerable `apr_table_setn()` grows the array to 160 entries: ``` 160 * sizeof(apr_table_entry_t) = 160 * 24 = 3840 bytes ``` `allocator_align()` (`apr_pools.c:268`) rounds that to `MIN_ALLOC` (8192), so the write requests a fresh 8 KB node from the stream pool's allocator whenever the pool's active node has less than 3840 bytes left. That is the allocation that races. ### 1.4 The race `allocator_alloc()` (`apr_pools.c:289`) walks the free-node list (`allocator->free[index]`, `allocator->max_index`) and pops a node; `allocator_free()` (`apr_pools.c:426`) pushes one back and rewrites `max_index`. With no mutex, these are unsynchronised read-modify-write sequences over the same `apr_allocator_t` — a 200-byte heap object allocated by `apr_allocator_create()` in `child_main()`. Two threads can pop the same node, after which two different pools hand out overlapping memory. ThreadSanitizer captures exactly this on 2.4.70 (`evidence/tsan-vulnerable.txt`): ``` WARNING: ThreadSanitizer: data race Read of size 8 at 0x7b34000001a0 by thread T1: #0 allocator_alloc memory/unix/apr_pools.c:315 #1 apr_palloc memory/unix/apr_pools.c:843 #2 apr_array_push_noclear tables/apr_tables.c:132 #3 apr_table_setn tables/apr_tables.c:638 #4 assign_headers /build/httpd-2.4.70/modules/http2/h2_request.c:353 #5 h2_create_request_rec /build/httpd-2.4.70/modules/http2/h2_request.c:387 #6 c2_process /build/httpd-2.4.70/modules/http2/h2_c2.c:748 ... Previous write of size 8 at 0x7b34000001a0 by main thread: #0 allocator_free memory/unix/apr_pools.c:480 #1 apr_allocator_free memory/unix/apr_pools.c:506 #2 apr_bucket_free buckets/apr_buckets_alloc.c:241 #3 socket_bucket_read buckets/apr_buckets_socket.c:43 ... Location is heap block of size 200 at 0x7b34000001a0 allocated by main thread: #1 apr_allocator_create memory/unix/apr_pools.c:187 #2 child_main /build/httpd-2.4.70/server/mpm/prefork/prefork.c:423 ``` The worker (thread T1, `c2_process` → `assign_headers`) reads the free list while the connection thread (main thread, `h2_session_process` → `h2_c1_read`) writes it. The racing object is the allocator itself. The corruption is observable as process crashes inside the allocator and the stream code on the connection thread — `allocator_lock`, `allocator_free`, `apr_palloc`, `run_cleanups`, `h2_stream_send_frame`, `output_data_buffered` (`evidence/asan.*`). ### 1.5 When the vulnerable branch is reached `h2_c2.c:748` passes the `no_body` flag: ```c r = h2_create_request_rec(req, c, conn_ctx->beam_in == NULL); ``` `conn_ctx->beam_in` is set from `stream->input`, which exists only when the stream still expects a body. For a request that ends on the HEADERS frame, `close_input()` has run and `beam_in` is `NULL`, so `no_body == 1`. The branch therefore needs all four of: 1. a request **without a body** (END_STREAM on the HEADERS frame), 2. a **`Content-Type`** header, 3. **no `Content-Length`** header, 4. a full header table: **79 regular headers**, plus the `Host` entry synthesised from `:authority`. `CONNECT` requests short-circuit the branch (`if (!is_connect)`). ### 1.6 Why the fix is complete for this call site The fixed build performs the same 3840-byte allocation, but from `r->headers_in`, which lives in `r->pool`. `r->pool` is `conn_ctx->req_pool`, created from `c2->pool` (`h2_conn_ctx.c:100`), a descendant of the transit pool — and therefore backed by the worker's private allocator. The allocation pattern is unchanged; only the allocator changes. That is what makes the differential clean. --- ## 2. Reproduction environment Everything runs in Podman containers on a dedicated network (`cve119618lab`). The host is only a staging area. | component | detail | |---|---| | Base image | `docker.io/library/debian:bookworm` | | APR | 1.7.4, built from the upstream tarball | | APR-util | 1.6.3, built from the upstream tarball | | httpd | **2.4.70** (affected) and **2.4.71** (fixed), built from the upstream tarballs | | mod_http2 | `--enable-http2=shared`, system nghttp2 | | Instrumentation | AddressSanitizer (`-fsanitize=address`) in `:vuln`, ThreadSanitizer (`-fsanitize=thread`) in `:tsan` | | MPM | prefork, `Protocols h2c http/1.1` (cleartext HTTP/2, no TLS material) | | Limits | every container runs with `--cpus 2 --memory 4g` | Both httpd versions live in the same image; `HTTPD_VERSION` selects one: | `HTTPD_VERSION` | server root | role | |---|---|---| | `vuln` | `/opt/httpd-2.4.70` | affected build | | `fixed` | `/opt/httpd-2.4.71` | fixed build | The lab and the proof of concept share a Podman volume mounted at `/lab-logs`. The proof of concept reads the server's error log and the sanitizer reports from there, so it states what the target actually did. ### Containers | container | image | configuration | |---|---|---| | `cve119618-vuln` | `cve-2026-119618:vuln` | 2.4.70, ASan, `Protocols h2c http/1.1` | | `cve119618-fixed` | `cve-2026-119618:vuln` | 2.4.71, ASan, `Protocols h2c http/1.1` | | `cve119618-mitigated` | `cve-2026-119618:vuln` | 2.4.70, ASan, `Protocols http/1.1` (published workaround) | The diagnostic image `cve-2026-119618:diag` adds the APR pool-concurrency check and `assign_headers()` / stream-pool tracing; the ThreadSanitizer image `cve-2026-119618:tsan` carries both httpd versions and is selected with `HTTPD_VERSION` as well. --- ## 3. Running the environment ```bash ./run-lab.sh build # build the lab image and the PoC runner image ./run-lab.sh up # start the vulnerable, fixed and mitigated servers ./run-lab.sh check # classify both servers, no side effects ./run-lab.sh exploit # run the differential proof of concept ./run-lab.sh probe # exercise the sibling request shapes ./run-lab.sh sweep # 0-day sweep on the fixed line ./run-lab.sh mitigation # verify the published workaround ./run-lab.sh down # stop the servers ``` `make build`, `make up`, `make exploit` are equivalent shortcuts. The ThreadSanitizer image is built separately: ```bash podman build --cpu-period=100000 --cpu-quota=200000 -m 4g \ -t cve-2026-119618:tsan \ --build-arg SANITIZER=thread \ --build-arg HTTPD_VERS="2.4.70 2.4.71" \ -f lab/Dockerfile lab ``` --- ## 4. The PoC `poc/poc.py` is a standard-library-only Python program. `poc/h2.py` is a minimal HTTP/2 client — connection preface, SETTINGS, HEADERS, CONTINUATION, DATA, RST_STREAM, an HPACK literal-without-indexing encoder and a frame reader. No third-party package, no `pip install`. ```bash podman run --rm --cpus 2 --memory 4g --network cve119618lab \ -v cve119618lab-logs-vuln:/lab-logs \ -e TARGET=cve119618-vuln:8080 \ cve-2026-119618-poc:local exploit --connections 16 --streams 32 --duration 30 ``` ### Modes | mode | purpose | vulnerable build | fixed build | |---|---|---|---| | `check` | classify the target without triggering the race | exit `1` | exit `0` | | `exploit` | drive the race and confirm the corruption | exit `1` | exit `0` | | `probe` | exercise the sibling request shapes | exit `1` if a sibling shape corrupts | exit `0` | | `mitigation` | verify the published workaround | exit `1` if HTTP/2 is still offered | exit `4` when HTTP/2 is refused | ### Exit codes | code | meaning | |---|---| | `0` | safe — no corruption observed, or the target is not affected | | `1` | vulnerable — the affected build was identified, the corruption was confirmed, or the mitigation is not in effect | | `2` | unreachable — the target did not answer at all | | `3` | invalid test — the target answered but no traffic was delivered | | `4` | mitigated — HTTP/2 is not offered, the CVE is unreachable | ### Request shapes | shape | description | reaches the vulnerable allocation | |---|---|---| | `bodyless_ct_full` | HEADERS with END_STREAM, 78 filler headers + `Content-Type` (79 regular + `Host` = 80 entries), no `Content-Length` | **yes** — the table is full and the write allocates | | `bodyless_ct` | HEADERS with END_STREAM, `Content-Type`, no `Content-Length`, table not full | branch taken, no allocation, no race | | `body_ct` | HEADERS + DATA with END_STREAM, `Content-Type`, no `Content-Length` | no (`no_body == 0`) | | `bodyless_ct_cont` | the same headers split across HEADERS + CONTINUATION | yes | | `bodyless_ct_rst` | the request followed by RST_STREAM | branch taken | | `body_ct_rst` | body request followed by RST_STREAM | no | | `bodyless_ct_trailers` | body-less request followed by a trailing HEADERS frame | protocol error | | `connect_ct` | CONNECT with a `Content-Type` header | no (`is_connect`) | `--fill` and `--pad` control the table-filling shape: `--fill N` sends N filler headers (default 78), `--pad N` appends N bytes to the last filler value to steer the stream pool's active-node consumption. ### Self-verification The PoC does not report "payload sent". It classifies the sanitizer reports that appeared in the shared log during the run: * a ThreadSanitizer report counts only when its stack names `assign_headers()` — the well-known `request_time_cache` race in `mod_log_config` is reported on every build, patched or not, and is explicitly excluded; * an AddressSanitizer report counts when the instrumented target raised a memory error while the PoC was driving traffic; * `check` additionally uses a race-free functional probe: the lab logs `%{Content-Length}i` for every request, so the handler-visible header distinguishes the two builds without any race at all. --- ## 5. Expected results Captured with `./run-lab.sh check|exploit|probe|sweep|mitigation`; the raw output is in `evidence/`. | build | version | `check` | `exploit` | observation | |---|---|---|---|---| | vulnerable | httpd 2.4.70 | exit `1` — handler sees no `Content-Length` | exit `1` — **corruption confirmed** | 6080 requests, 5 ASan reports: `SEGV` in `allocator_lock`, `apr_palloc`, `run_cleanups` and `apr_bucket_free`, plus an `ap_log_assert` abort in `s_c2_done()`; 31 ThreadSanitizer allocator races naming `assign_headers()` | | fixed | httpd 2.4.71 | exit `0` — handler sees `Content-Length: 0` | exit `0` — **no corruption** | 7168 requests, no ASan report, 0 ThreadSanitizer allocator races | | mitigated | 2.4.70, `Protocols http/1.1` | — | — | HTTP/2 preface refused, exit `4`; the control container with `h2c` still enabled exits `1` | The same run with the table-filling shape also produced a `heap-use-after-free` report whose allocation stack is `assign_headers()` itself (`evidence/asan-vulnerable-use-after-free.txt`), and a crash on the connection thread in `output_data_buffered()` / `h2_stream_send_frame()` when the stream state had already been corrupted. The functional probe is visible in the access log: ``` # 2.4.70: the worker wrote into the shared stream table 10.89.11.52 - - [...] "POST /h2probe-1787249 HTTP/2.0" 404 236 h2clen="-" # 2.4.71: the worker wrote into r->headers_in 10.89.11.53 - - [...] "POST /h2probe-1792180 HTTP/2.0" 404 236 h2clen="0" ``` --- ## 6. Environment preconditions * Podman, rootless or rootful, with network access to `archive.apache.org` for the first build (APR, APR-util and httpd tarballs). * No host Python is required; the proof of concept runs in its own container. * The lab servers listen on `8080` inside the container network only; no port is published to the host. * Cleartext HTTP/2 (`h2c`) is used. TLS is not required to reach the vulnerable code path. * `check` needs the shared log volume to read `/lab-logs/build.txt` and `/lab-logs/access.log`. --- ## 7. Additional findings (0-day sweep on the fixed line) Three independent sweeps were run against httpd 2.4.71. **1. Allocator race detector.** The fixed build was instrumented with ThreadSanitizer and driven with the same full-table shape that produces 31 allocator races on 2.4.70. Result: 8 reports, all of them the benign `request_time_cache` race in `mod_log_config`, and **0 allocator races** (`evidence/tsan-fixed.txt`). The worker never enters the connection's allocator on the fixed line. **2. Shape and boundary sweep.** `./run-lab.sh sweep` runs the exploit against 2.4.71 for every sibling shape (`bodyless_ct`, `body_ct`, `bodyless_ct_trailers`, `connect_ct`, `bodyless_ct_cont`, `bodyless_ct_rst`, `body_ct_rst`) and for every header-table doubling boundary (`fill` = 8, 9, 10, 11, 18, 19, 20, 21, 38, 39, 40, 41, 78, 79, 80, 81). All 23 runs completed with exit `0` and no mod_http2 sanitizer report (`evidence/0day-sweep-fixed.txt`). **3. Fix completeness.** The remaining writes to `req->headers` in 2.4.71 were checked for the same invariant violation: | site | thread | pool | verdict | |---|---|---|---| | `h2_request.c:213` `h2_request_end_headers()` | connection (c1) | stream pool | safe — the pool owner performs the write | | `h2_push.c:350` `h2_push_collect()` via `h2_stream_submit_pushes()` | connection (c1), from `h2_stream_on_output_change()` | stream pool | safe — push collection runs on the connection thread | | `h2_proxy_util.c:643/645` `h2_proxy_req_make()` | worker (c2) | `r->pool` (transit) | safe — the pool is backed by the worker's private allocator | | `h2_proxy_session.c:901-916` `X-Forwarded-*` merging | worker (c2) | `r->pool` (transit) | safe | No additional vulnerability was found on the fixed line. --- ## 8. Repository layout The published repository is https://github.com/googlesky/CVE-2026-119618 (public, branch `main`). Every artefact referenced above is committed there. ``` README.md this write-up LICENSE MIT CITATION.cff citation metadata SECURITY.md security policy Makefile convenience targets run-lab.sh containerised environment driver lab/ target image: build script, httpd configuration, diagnostics poc/ proof of concept and its runner image evidence/ captured run artefacts exp/ analysis helpers for the diagnostic and TSan runs ``` --- ## 9. References * CVE-2026-119618 — Apache HTTP Server security advisory: https://httpd.apache.org/security/vulnerabilities_24.html * Red Hat vulnerability record: https://access.redhat.com/security/cve/cve-2026-119618 * Upstream fix in the 2.4.x branch: `824beab9b9424d6cfb29595248fdbf6c3dddeab1` (Apache httpd 2.4.71) * Upstream fix in trunk: `5ed39287660daacd1233cb9bbc984b25fa9a4fe3` * Pull requests: https://github.com/apache/httpd/pull/975 and https://github.com/apache/httpd/pull/977 * APR 1.7.4 `apr_palloc()`, `allocator_alloc()`, `allocator_free()`: `memory/unix/apr_pools.c` * APR 1.7.4 `apr_array_push_noclear()`: `tables/apr_tables.c` * Standalone module: https://github.com/icing/mod_h2