A critical security vulnerability has been addressed in PHP's session handling mechanism, which could allow attackers to manipulate session data stored on vulnerable servers and execute malicious code. As identified by CVE-2026-126714 and rated 9.2 on a CVSS severity scale, the vulnerability has been renamed phpAfterShell by cybersecurity researchers at Depthfirst, the researchers who discovered and reported the problem.
In November 2026, the vulnerability was patched along with six other critical PHP security vulnerabilities. Its discovery has raised fresh concerns as it is related to the vulnerabilities addressed in October for PHP2Shell. Researchers discovered that the earlier security updates failed to address the underlying vulnerabilities in PHP's handling of session files, leaving an additional route for attackers to take advantage of the vulnerability.
A session file is used by PHP to preserve information between requests, including authentication details, user permissions, and other application information. As a result of the phpAfterShell vulnerability, php's default file-based session storage mechanism may become inconsistent due to a weakness in the way PHP writes session data.
As Depthfirst informs us, PHP overwrites session files at the start of the process without clearing their previous contents immediately.
A file may contain a combination of newly written session information and remnants of old information if the writing process is interrupted prior to removing the remaining old data. This incomplete write operation can create an opportunity for attackers to manipulate session data and disrupt the writing process at a carefully timed moment when they are able to influence session data.
A corrupted session file may be read by PHP as legitimate session information and be processed by the attacker as serialized objects. PHP's upload-progress function has been identified as one way to interfere with session-file operations by researchers.
This behavior could be exploited by an attacker to combine portions of two sessions and manipulate values processed in a later session operation by using portions of two different session states.
In combination with a suitable application gadget chain or another vulnerability, this object deserialization may lead to remote code execution. PHPAfterShell should be considered a major concern for applications that use PHP's default session handling system.
The issue enables attackers to manipulate server-side session values through carefully constructed file corruption, according to Depthfirst.
In addition, the discovery shows that restricting object creation alone does not eliminate weaknesses resulting from the underlying session-writing process. The phpAfterShell vulnerability is connected to the PHP2Shell vulnerability because it occurs due to PHP's handling of session updates.
In conjunction with the October security patch, PHP included restrictions on creating objects within the upload-progress callback in order to prevent the previously identified method of exploitation. Nevertheless, PHP did not make any changes to the underlying process of writing updated session data to existing files.
According to Depthfirst, PHP continues to read existing sessions, add upload progress information, serialize the updated data, and write it back to the same file after a serialization of the updated data. PHP's advisory indicates that, even after the earlier restrictions were applied, an interrupted write could still leave behind corrupted session data. PHP's advisory indicates that session upload-progress tracking can influence stored session data by uploading multiple parts of files.
While a file is being transferred, the feature records upload activity in the user's session. Since this operation may occur before the application's main PHP script begins to execute, this allows the application to influence the contents of the session during request processing. The underlying issue may also affect applications that store large amounts of user-controlled data in sessions. To successfully exploit this issue, several factors must be present.
PHP must be used as a file-based session handler in the application, an attacker must be able to manipulate session data, and PHP must be stopped during a session write in order to prevent the application from being compromised. During a subsequent request, the corrupted file must be loaded by using session_start(), allowing PHP to deserialize the content manipulated.
A suitable application gadget chain is generally required to execute remote code after object deserialization.
A separate memory corruption vulnerability in a PHP built-in class also allowed Depthfirst to execute code. On November 19, PHP released security updates to address this vulnerability for versions 8.2.36, 8.3.37, 8.4.28 and 8.5.13. PHP 8.6.0 also incorporates the security patch.
There have not been any confirmed instances of phpAfterShell exploits in the wild.
Although phpAfterShell has not been linked to any confirmed attacks in the wild as of November 19, 2026, those systems that received only the October PHP2Shell updates remain vulnerable until the latest patches are installed. Nevertheless, the vulnerability's technical similarities to PHP2Shell make it a potential security concern for organizations operating exposed PHP environments.
As a proof-of-concept, the public demo shows how an object can be injected into a corrupt session file to perform harmless operation, while the entire method of remote code execution remains unknown. However, the earlier PHP2Shell vulnerabilities demonstrated the rapid attraction of attackers to PHP's session handling mechanism, making delayed patching a significant risk.
In accordance with their existing branch, PHP administrators are advised to upgrade to versions 8.2.36, 8.3.37, 8.4.28 or 8.5.13, or migrate to PHP 8.6.0. The updated version should also be verified for serving web requests, PHP-FPM or Apache workers should be restarted, and container images must be rebuilt, as applicable.
In situations in which immediate patching cannot be achieved, disabling session.upload_progress.enabled will reduce exposure to vulnerabilities through uploads.
This mitigation, however, does not provide a permanent solution as there may still be other ways to influence session data.
Administrators should also evaluate applications that store large amounts of user-controlled information in session files and consider alternative mechanisms for storing session data, whenever necessary.
As PHP2Shell and phpAfterShell expose weaknesses in the same session-handling process, the updated versions are important, regardless of whether a system has received the October security patches.
To prevent attackers from executing code on the server by exploiting application-level weaknesses, timely remediation and proper session management remain essential.