
Containerised differential lab and stdlib HTTP/2 PoC for CVE-2026-119618, a mod_http2 allocator race causing heap corruption in Apache httpd 2.4.55-2.4.70, with ASan/TSan evidence.
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.
modules/http2/h2_request.c, Apache httpd 2.4.70, assign_headers().
Line numbers are from the 2.4.70 release tarball.
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:
- 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.
h2_session_open_stream() (h2_session.c:117) creates the per-stream pool
as a child of the session pool and tags it:
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:
/* 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:
/* 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.
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):
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.
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):