Skip to content
ANALYSIS.md

ANALYSIS.md

github.com • October 21, 2026

Two critical vulnerabilities in PHP's session.upload_progress handler enable pre-authentication remote code execution on PHP 5.4.0 through 8.5.x.

Chain A: Session Injection + LFI → RCE

Verified: exploit_session_inject.py → uid=33(www-data) on PHP 8.2.34.

Chain B: var_destroy UAF → RCE

Verified: ASAN heap-use-after-free at var_unserializer.c:851 . RCE via var_dump handler overwrite on x86-64.

Chain C: Handler Mismatch → __destruct → RCE

Key insight: __destruct fires on BOTH success and failure paths of var_destroy . The decode FAILURE does NOT prevent exploitation.

Verified: Evil::__destruct(cmd="id") → uid=33(www-data) via pure rfc1867 handler.

3. Root Cause Analysis

3.1 Session Fixation (ext/session/session.c)

Fix: PR #22113 adds !PS(use_only_cookies) && check.

3.2 Unvalidated Filename

Filename can contain arbitrary bytes including PHP code and pipe | characters.

3.3 var_destroy Reentry UAF (ext/standard/var_unserializer.re)

3.4 Serializer Leak (ext/session/session.c)

3.5 __destruct on Decode Failure

Even though the decoder returns FAILURE and session_start() calls php_session_cancel_decode() to destroy $_SESSION , the object's __destruct has ALREADY fired during var_hash cleanup.

Vulnerable code identical across ALL versions from PHP 5.4.0 (2012) to present.

Warning: Disabling upload_progress does NOT fix the var_destroy UAF or the serializer leak. Apply the official PHP patch.

PHP Security Advisory (pending)

PR #22113 — Session fixation fix

Calif.IO — Serializable UAF

dinosn — var_destroy UAF

PHP Bug #71101 — Handler mismatch

cnpanda — Handler mismatch exploitation

Extracted Entities