A recently discovered vulnerability, termed phpAfterShell, poses a significant risk of remote code execution on servers running certain PHP versions. This threat persists even on systems updated with the October patches addressing the PHP2Shell exploit.
Discovery and Technical Details
Depthfirst researchers revealed the phpAfterShell flaw on November 19, demonstrating its potential to exploit a separate PHP bug for remote code execution. Identified as CVE-2026-126714, this vulnerability has a high CVSS v4.0 score of 9.2, indicating its critical nature.
The issue lies in PHP’s default file-based session handler, which is responsible for maintaining user session data such as login status and shopping cart contents. With upload progress enabled, PHP can manipulate session files even while processing upload requests, risking the creation of corrupted session files.
Mechanism of Exploitation
When a session update is interrupted, PHP may leave a session file with both outdated and new data. This flawed file might be accepted as valid when the application calls session_start(), leading to potential deserialization issues. The October security updates did not address this particular scenario.
Depthfirst’s analysis shows that the phpAfterShell exploit circumvents the previous PHP2Shell restrictions by targeting session files outside the upload-progress phase, combined with a memory corruption flaw in PHP classes to achieve code execution.
Mitigation and Future Outlook
The phpAfterShell exploit executes code with the permissions of the PHP worker, potentially exposing sensitive server data. However, applications using Redis or databases for session storage are not affected by this flaw.
The recommended mitigation involves upgrading to PHP versions 8.2.36, 8.3.37, 8.4.28, or 8.5.13, as the October updates do not cover this vulnerability. For immediate protection, Depthfirst suggests disabling session.upload_progress in the php.ini configuration.
Organizations are encouraged to regularly monitor PHP advisory updates and apply necessary patches promptly to safeguard against emerging threats. As PHP 8.0 and 8.1 become unsupported, migrating to newer, supported versions is crucial for maintaining security.
