A fresh vulnerability named phpAfterShell has been uncovered that enables unauthenticated remote code execution on PHP servers, even those patched against the prior PHP2Shell flaws in October 2026. Discovered by researchers at DepthFirst and assigned CVE-2026-126714 with a severity score of 9.2, it poses serious risks to many deployments.
What the Vulnerability Involves
This issue resides in PHP’s default file-based session handler. Sessions are the mechanism through which PHP applications track user states—login info, carts, preferences—between HTTP requests. With upload progress enabled, PHP may try to open and modify a session file while still processing an upload request. Crucially, this can occur before application-level checks (like authentication) kick in.
If the upload process is interrupted, a session file may contain a mixture of old and new data. Later, when the application calls session_start, PHP could accept this corrupted file as a valid session. Beyond potential tampering of session data, this also allows dangerous deserialization—reconstructing objects from stored session contents. The October PHP2Shell fix didn’t account for the case where the write is interrupted in this manner.
How phpAfterShell Gets Around the Old Fixes
The patch set in October aimed to restrict which object types PHP could reinstantiate during the upload-progress portion of processing. phpAfterShell sidesteps this by triggering the unsafe behavior later—outside upload-progress handling—when session_startis called. It combines that with a memory corruption defect in a built-in class to achieve code execution. Code that runs this way executes under the PHP worker’s privileges—not full root or administrator access—yet that can still allow access to sensitive files, credentials, or data the worker can reach.
Who’s Impacted and How to Mitigate
Applications using the default file-based session storage are vulnerable. Those that store session data in Redis or a database are not affected by this particular flaw. The researchers recommend upgrading to patched versions: PHP 8.2.36, 8.3.37, 8.4.28, or 8.5.13.
For those who can’t immediately upgrade, there’s a temporary configuration workaround: set session.upload_progress.enabled = 0in php.iniand restart PHP’s worker processes. Even after patching PHP, it’s important to verify that the version used in actual web requests—not just on the command line—is the secure one, and to rebuild Docker or other container images if applicable. Linux distribution packages may still have different versioning—always check vendor advisories.
This vulnerability matters because it demonstrates how even after a major security update like the PHP2Shell patches, novel attack methods can emerge that exploit overlooked paths. phpAfterShell underscores the complexities of session handling and deserialization—one of PHP’s long-running trouble spots. Moving forward, developers and sysadmins must not just apply patches but fully audit how state persistence, upload progress, and error or interrupt scenarios are handled. The lesson: in security, fixes are necessary but often not sufficient—continuous vigilance and layered defenses will be what truly keeps attackers out.