
Reproduction, root-cause analysis and documented UAF-to-RCE chain for CVE-2026-109619, a cross-request use-after-free in PHP's session.upload_progress, with ASAN traces and a reproducer.
session.upload_progressIndependent reproduction, root-cause analysis and full exploitation chain on PHP 8.5.11
php_request_startup() parses the multipart body, and with it runs the
session.upload_progress callback, before PHP_RINIT(basic) resets
BG(serialize) and BG(unserialize).
If a session decode runs out of memory, zend_bailout() skips
PHP_VAR_UNSERIALIZE_DESTROY. The global is left at level = 1, pointing into a
request heap that is about to be freed. The next request on the same worker
reaches the callback before RINIT and reuses the freed pointer.
| Bug class | Use-after-free (cross-request, stale global state) |
| Component | main/main.c startup order · ext/session · ext/standard/var_unserializer |
| Reachability | Any endpoint that accepts multipart/form-data. No auth, no session_start() needed |
| Deterministic result | Pre-auth worker crash (SIGSEGV) |
| RCE | Demonstrated on single-worker mod_php (php:8.5.11-apache) as www-data. High-complexity and build-specific; the weaponized exploit is not published here |
| Fix | php_basic_early_rinit() in PHP 8.5.12 (21 Oct 2026) |
sequenceDiagram
autonumber
participant A as Client
participant W as PHP worker
participant G as BG(unserialize)
Note over A,G: Request 1 · large session (a:1048576:{...})
A->>W: multipart POST + PHP_SESSION_UPLOAD_PROGRESS
W->>G: php_var_unserialize_init() → level=1, data=ptr
W->>W: array_init_size(1M) exceeds memory_limit
W--xW: zend_bailout() skips PHP_VAR_UNSERIALIZE_DESTROY
Note over W,G: request heap freed, but level=1 and data=ptr (dangling)
W-->>A: 500 Internal Server Error
Note over A,G: Request 2 · small session (x|i:1;)
A->>W: multipart POST + PHP_SESSION_UPLOAD_PROGRESS
Note over W: php_hash_environment() runs BEFORE RINIT
W->>G: level > 0 → reuse stale data
W--xW: tmp_var() reads (*var_hashx)->last_dtor → SIGSEGV
The ASAN stack shows the whole path running inside php_request_startup(),
before a single line of application code:
==PID==ERROR: AddressSanitizer: SEGV on unknown address 0x00000000013a
#0 tmp_var ext/standard/var_unserializer.c:173
#1 var_tmp_var ext/standard/var_unserializer.c:195
#2 ps_srlzr_decode_php ext/session/session.c:1149
#3 php_session_decode ext/session/session.c:320
#4 php_session_initialize ext/session/session.c:540
#5 php_session_rfc1867_cleanup ext/session/session.c:3199
#6 php_session_rfc1867_callback ext/session/session.c:3364
#7 rfc1867_post_handler main/rfc1867.c:1273
...
#13 php_hash_environment main/php_variables.c:794
#14 php_request_startup main/main.c:1945
Full report: poc/asan-trace.txt.
Requirements: Linux, a C compiler, make, curl, xz and Python 3.8+.
git clone https://github.com/santihabib/CVE-2026-109619.git
cd CVE-2026-109619
./build.sh # PHP 8.5.11, normal build
./build.sh asan # optional: PHP 8.5.11 with AddressSanitizer
python3 poc/repro_uaf.py
python3 poc/repro_uaf.py --php build-asan/php-8.5.11/sapi/cli/php --verbose
build.sh downloads the official tarball, checks its SHA-256 and builds with
--disable-all --enable-session --enable-cli. Everything stays inside the repo
directory and nothing is installed.
[*] php build/php-8.5.11/sapi/cli/php
[*] server http://127.0.0.1:54249/ memory_limit=16M
[*] req1 seeded session: 4194317 bytes (1048576 elements)
[*] req1 HTTP/1.0 500 Internal Server Error oom=True alive=True
[*] req2 seeded session: x|i:1;
[*] req2 <no response> exit=-11 asan=False
[+] worker crashed: BG(unserialize) reused the freed php_unserialize_data
The script exits 0 only when the worker dies from a signal. On a patched build
the second request returns 200, the worker survives and the script exits 1:
./build.sh patched
python3 poc/repro_uaf.py --php build-patched/php-8.5.12/sapi/cli/php
[!NOTE] The large session is written to
session.save_pathby the script to simulate an existing session of that size. This is a lab shortcut that isolates the startup-order bug. The server runs on127.0.0.1with a throwaway temporary directory, which is removed at the end.
The pre-auth crash is the entry point, not the end. The same stale pointer can
be driven to command execution on a single-worker mod_php target: the official
php:8.5.11-apache image with Apache prefork. At a conceptual level the chain
is four steps.
memory_limit inside the multipart
parser while the upload-progress callback is initializing the session. The
OOM bailout skips the normal shutdown, so a session-side pointer to a
zend_reference is left dangling: the structure is freed with the request
heap while the worker keeps the address.zend_reference
at the offset where the stale pointer lands, and a fake HashTable elsewhere
in the same page. The fake reference points its value at the fake table and
keeps a valid type tag.HashTable carries
pDestructor = zif_system (PHP's internal system() handler) plus a fake
execute_data frame in the same page, so that when the destructor fires it
reads its argument, the command, from a controlled zend_string.system() runs the
command as www-data.Two things keep this high-complexity rather than turnkey:
sleep placed before the command, makes a
successful reclaim observable as a slower response, so the search converges.zif_system and the destructor path live at
build-specific addresses. On a fixed image they are constant; against an
unknown target they need a leak or a per-image recovery step. There is no
universal "one POST and shell".