THE CRUNCH
PHP has patched a critical session-handling vulnerability that researchers at Depthfirst call phpAfterShell, tracked as CVE-2026-126714 with a CVSS score of 9.2. The fix landed on 19 November alongside six other critical issues, in PHP versions 8.6.0, 8.5.13, 8.4.28, 8.3.37 and 8.2.36. Depthfirst says an attacker able to control what is written to a session file, and to cut the write short, could trigger object deserialization and remote code execution.
The bug exists because PHP starts overwriting a session file without first clearing it. If the write is interrupted before the later truncation removes old trailing data, the file ends up holding fresh session data followed by leftovers from the previous session. Depthfirst says it found dependable ways to break into the file operation while session upload-progress updates were running, joining the start of one valid session to the tail of another. A later session operation then accepts the mixed content as legitimate server-side state, handing an attacker control of session values and a route to deserialization.
Depthfirst links phpAfterShell to the earlier PHP2Shell flaws. PHP2Shell arose because an upload-progress callback could open and decode a file-backed session while an unauthenticated multipart request was being parsed. PHP restricted which objects could be created in memory during that callback, but Depthfirst says the file update behaviour itself was untouched: the callback still loads the existing session, appends upload-progress state, serialises the result and writes it back to the same file.
Exploitation is not a single step. Depthfirst lists the requirements as default session storage being active, an exploitation route (upload progress tracking is the simplest), the PHP process stopping mid-write, a request that calls session_start() on the corrupted file, and a path from deserialization to code execution. PHP's advisory says the same underlying problem can occur when an application keeps large user-controlled strings in a session, and that in threaded PHP builds a hard memory-limit failure in another thread can end the process while a session write is under way. There appear to be no reports of phpAfterShell being exploited in the wild.


