跳到正文

ikow

php2shell-poc

CVE-2026-109618/109619 — 5 RCE chains + detection rules (Suricata, Sigma, ModSecurity). PHP session.upload_progress pre-auth exploit research.

README 已保存到本站,可直接阅读

Documentation snapshot

README 快照

这篇是英文原文

下面正文是项目自己的英文 README。想读全文就用浏览器自带的整页翻译: Chrome / Edge 点地址栏右侧的翻译图标,或用右键菜单里的「翻译成中文」; 手机浏览器一般在菜单里。

本页保存的是公开项目资料快照,阅读过程不需要连接 GitHub。

php2shell

CVE-2026-109618 & CVE-2026-109619 — PHP Pre-Auth RCE Exploit & Detection Toolkit

Exploits · Detection · Lab · Writeup


Five independent RCE chains exploiting PHP’s session.upload_progress and the Zend engine’s OOM bailout. 14 years of vulnerable code — PHP 5.4.0 (2012) through 8.5.11. Pre-auth. No application vulnerability required for some chains.

Impacts 78% of all websites — including WordPress (43%), Joomla, Drupal, Laravel, Magento, and every default PHP installation.

Author: Qi Deng  |  Writeup: Substack  |  Date: 2026-10-21

CVE Details

CVEGHSACVSSDescription
CVE-2026-109618GHSA-w8hw-w9fx-j79w9.2OOM → longjmp() leaves Zend engine state invalid → RCE
CVE-2026-109619GHSA-6wmf-4rv5-p3rp9.2Stale global state across FPM worker requests → UAF → RCE

Patch: Commit 3584a98 — 300 files changed across the Zend engine.

Attack Chains

ChainVectorPre-authConditionsSAPI
ASession injection + LFIYesApp has any LFI sinkAll
Bvar_destroy UAF → handler overwriteNoApp calls unserialize()All
CHandler mismatch → __destructYesTwo dirs with different serialize_handlerFPM
DOOM corruption → stale EG()YesNone — any endpointmod_php
EFPM session OOM → stale BG()YesProducer: any session_start() endpoint; Consumer: any endpointFPM

Chain D is the most critical: zero-dependency pre-auth RCE against any Apache mod_php installation.

Chain E is nearly as broad on FPM: the producer needs any endpoint that calls session_start() (near-universal — WordPress, Laravel, Joomla, Drupal all do), and the consumer can be any PHP endpoint — the rfc1867 upload_progress handler runs during SAPI startup before application code. Verified: nosession.php (no session_start() in code) triggers 502 crash when consuming stale BG(unserialize) state.

Exploits

Three RCE exploits (Chains A, B, C) are included in exploit/:

FileChainWhat It Does
chain_a_session_lfi.pyAInjects PHP code via upload filename → LFI includes session file → RCE
chain_b_uaf_rce.phpBvar_destroy UAF → discovers zif_system via EG() → overwrites var_dump handler via /proc/self/mem → RCE
chain_c_mismatch_rce.pyCPollutes FPM worker PS(serializer) → injects serialized object via filename → __destruct fires on decode failure → RCE

Chains D and E exploits are available to paid subscribers.

# Chain A: Session injection + LFI → RCE
python3 exploit/chain_a_session_lfi.py --host TARGET --port 80 --command 'id'

# Chain B: var_destroy UAF → RCE (run on target or via uploaded webshell)
php exploit/chain_b_uaf_rce.php

# Chain C: Handler mismatch → __destruct → RCE
python3 exploit/chain_c_mismatch_rce.py --host TARGET --port 80 --command 'id'

Detection Rules

Pre-built IDS / WAF / SIEM rules in detection/:

FileFormatSignatures
php2shell.rulesSuricata / Snort13 rules — request, response, and recon
php2shell.yamlSigma5 rules — web logs, process creation, file events
modsecurity.confModSecurity v2/v37 rules — drop-in for Apache/Nginx
php2shell.luaOpenResty LuaLightweight reverse proxy module

Fastest mitigation: block PHP_SESSION_UPLOAD_PROGRESS in multipart POST bodies. Near-zero legitimate use, covers the primary attack vector for both CVEs.

Quick Start

git clone https://github.com/ikow/php2shell-poc.git && cd php2shell-poc

# Start the lab (PHP-FPM + nginx + Apache mod_php)
cd lab && docker compose up -d

# Verify each chain
python3 ../poc/verify_session_injection.py --target http://127.0.0.1:18080
python3 ../poc/verify_handler_mismatch.py --target http://127.0.0.1:18080
python3 ../poc/verify_oom_trigger.py --host 127.0.0.1 --port 18081
python3 ../poc/verify_fpm_stale_state.py --target http://127.0.0.1:18080

# Run an exploit
python3 ../exploit/chain_a_session_lfi.py --host 127.0.0.1 --port 18080 --command 'id'

Repository Structure

php2shell-poc/
├── exploit/
│   ├── chain_a_session_lfi.py        # RCE: session injection + LFI
│   ├── chain_b_uaf_rce.php           # RCE: var_destroy UAF → handler overwrite
│   └── chain_c_mismatch_rce.py       # RCE: handler mismatch → __destruct
├── detection/
│   ├── php2shell.rules               # Suricata / Snort IDS rules
│   ├── php2shell.yaml                # Sigma SIEM detection rules
│   ├── modsecurity.conf              # ModSecurity WAF rules
│   └── php2shell.lua                 # OpenResty / Nginx Lua WAF module
├── poc/
│   ├── verify_session_injection.py   # Verify Chain A
│   ├── verify_uaf_asan.php           # Verify Chain B (ASAN)
│   ├── verify_handler_mismatch.py    # Verify Chain C
│   ├── verify_oom_trigger.py         # Verify Chain D
│   └── verify_fpm_stale_state.py     # Verify Chain E
├── lab/
│   ├── docker-compose.yml            # PHP-FPM + nginx + Apache mod_php
│   ├── setup.sh                      # One-click lab setup
│   └── php.ini / php-apache.ini      # Vulnerable PHP configs
└── docs/
    ├── ANALYSIS.md                   # Full technical analysis
    └── substack_article.md           # Writeup source

Mitigation

; Immediate — reduces attack surface
session.upload_progress.enabled = Off
session.use_only_cookies = On

The only complete fix is patching PHP to 8.2.35 / 8.3.36 / 8.4.27 / 8.5.12+. The OOM corruption (Chain D) is in the Zend engine core — no INI setting fixes it.

Downstream Impact

Wiz has demonstrated pre-auth RCE on stock container images:

PlatformVulnerableNotes
WordPressYesCore doesn’t use PHP sessions, but WooCommerce and many plugins do
JoomlaYesUses native PHP sessions by default
DrupalYesUses native PHP sessions by default
MagentoYesVulnerable even in maintenance mode
LaravelYesPendingBroadcast is a known __destruct gadget

References

Disclaimer

This repository is for authorized security testing and educational purposes only. Exploit code for Chains D and E (zero-dependency RCE) is available to paid subscribers of the writeup.

License

MIT


Keywords: php2shell, CVE-2026-109618, CVE-2026-109619, PHP RCE, PHP exploit, session.upload_progress,
pre-auth RCE, PHP vulnerability, PHP session injection, PHP deserialization, PHP OOM, PHP memory corruption,
use-after-free, GHSA-w8hw-w9fx-j79w, GHSA-6wmf-4rv5-p3rp, WordPress RCE, Joomla RCE, Drupal RCE,
PHP security, WAF rules, Suricata rules, ModSecurity rules, IDS signatures, PHP 8.2.35, PHP 8.4.27,
session upload progress, PHP session fixation, rfc1867, longjmp, zend_bailout,
Snort rules, Sigma rules, detection rules, PHP patch, PHP critical vulnerability

Official distribution

获取与安装

暂未发现可确认的官方软件包地址

当前 README 快照没有出现 npm、PyPI、Crates.io、pub.dev 等官方包页链接。本站不会根据仓库名称猜测下载地址。

本站不托管项目文件;需要安装时,请以项目维护者发布的官方文档为准。

使用前核验

本站保存公开资料用于阅读,不代表安全审计或功能背书。安装前请核对许可证、依赖来源和发布签名,不要直接运行来源不明的二进制文件或高权限脚本。