Researchers at DepthFirst have uncovered a critical vulnerability in PHP, assigned CVE-2026-126714 with a CVSS score of 9.2, that enables remote code execution by exploiting how PHP handles file-backed sessions during interrupted multipart requests. The flaw occurs before the target script even begins execution, allowing attackers to corrupt session data on disk and trigger object deserialization in subsequent requests.
The Lifecycle Loophole
The vulnerability stems from PHP's RFC1867 upload-progress callback, which opens and decodes file-backed sessions while parsing unauthenticated multipart requests. Although a previous patch restricted class resolution during this callback to prevent immediate deserialization exploits, it left the underlying file update behavior untouched. When a PHP worker dies mid-update, the non-atomic nature of the pwrite() and ftruncate() system calls allows the session file to end up in a hybrid state: containing the prefix of a new session and the suffix of the old one.
Splicing Sessions for RCE
By carefully crafting the length fields in the new session prefix, an attacker can force PHPโs session decoder to interpret leftover bytes from the old session as valid serialized objects. This technique creates a valid session file that contains malicious objects injected by the attacker. The exploit does not require the application to have an upload controller or call session_start() on the multipart endpoint, as PHP itself acts as the session writer during request startup.
Kernel-Level Interruptions
The research details two primary methods for interrupting the write operation. Variant A involves terminating the worker during the buffered pwrite() copy, often achievable via OOM kills or specific timeout configurations, while Variant B involves terminating the worker between the pwrite() and ftruncate() syscalls. The researchers developed a calibration method using HTTP requests to measure these moving boundaries, using a consumer request to classify the resulting session state and confirm successful exploitation.
Key Takeaways
- CVE-2026-126714 is a critical (9.2) vulnerability affecting PHP's file-backed session handler.
- The exploit leverages non-atomic file operations (pwrite/ftruncate) during RFC1867 upload progress updates.
- Attackers can splice session data to inject serialized objects, bypassing previous deserialization patches.
- Remote Code Execution (RCE) is achieved by chaining this session corruption with memory-corruption primitives.
The Bottom Line
PhpAfterShell proves that patching deserialization logic is insufficient if the underlying file I/O remains non-atomic. Developers must treat session files as critical state that requires atomic updates or robust integrity checks to prevent subtle, pre-execution exploits.