VYPR
patchPublished Nov 19, 2026· Updated Nov 20, 2026· 2 sources

New phpAfterShell Attack Bypasses PHP2Shell Fix to Enable Remote Code Execution

A new PHP attack, phpAfterShell (CVE-2026-126714), enables unauthenticated remote code execution by exploiting a flaw in PHP's default file-based session handler, even after prior PHP2Shell patches.

A novel attack, dubbed phpAfterShell, has emerged, capable of achieving unauthenticated remote code execution on vulnerable PHP servers. This new threat is particularly concerning as it bypasses existing patches designed to address the PHP2Shell vulnerabilities discovered earlier. Researchers at Depthfirst disclosed the flaw on November 19, demonstrating how it can be combined with a separate bug within PHP to enable remote code execution.

The vulnerability, identified as CVE-2026-126714 and carrying a CVSS v4.0 score of 9.2, resides within PHP's default file-based session handler. Session handlers are crucial for web applications to maintain user states, such as login status or shopping cart contents, across multiple requests. When the session upload progress feature is enabled, PHP can interact with and update session files even while a file upload is in progress. This interaction can occur before the main application logic executes, meaning that standard application-level security checks, like login validations, may not prevent the vulnerable code path from being reached.

If a session update process is interrupted, PHP might leave behind a corrupted session file containing a mixture of old and new data. The application could later interpret this damaged file as valid when it initiates a session, for instance, by calling session_start(). The implications extend beyond merely incorrect session data; PHP's deserialization process can reconstruct objects from this stored data. The October security patches for PHP2Shell did not fully address the scenario where an interrupted write operation results in such a malformed session file.

While CISA recently added two PHP2Shell vulnerabilities to its Known Exploited Vulnerabilities catalog, those listings pertain to the earlier October flaws, not the newly discovered phpAfterShell. Depthfirst's disclosure primarily details a research demonstration of the attack, and there is currently no public evidence suggesting that attackers have actively exploited this specific vulnerability in the wild.

The October PHP2Shell patches aimed to restrict the types of objects PHP could deserialize during upload-progress processing. However, Depthfirst's analysis reveals that phpAfterShell operates through a different mechanism. The vulnerability is triggered when the application later accepts the damaged session file outside the upload-progress context, a scenario not covered by the previous fix. The researchers successfully combined this behavior with a memory corruption flaw in a built-in PHP class to achieve remote code execution.

Successful exploitation would grant attackers code execution with the privileges of the PHP worker process. While this typically does not equate to full server control, it can provide significant access to sensitive information, including credentials, application files, and customer data that the worker process has permissions to read or modify. Applications utilizing non-file-based session handlers, such as those storing sessions in Redis or a database, are not affected by this particular vulnerability, according to Depthfirst's advisory.

The affected versions of PHP are 8.2.36, 8.3.37, 8.4.28, and 8.5.13. It is important to note that the October PHP2Shell updates do not include the fix for phpAfterShell. Organizations still running older, unsupported versions of PHP, such as 8.0 or 8.1, are strongly advised to migrate to a supported release immediately. As a temporary mitigation if an upgrade is not immediately feasible, Depthfirst recommends disabling the session upload progress feature by setting session.upload_progress.enabled = 0 in the php.ini file and restarting the PHP workers. This measure blocks the specific attack vector described but does not rectify the underlying session handler flaw.

Following the application of patches or the implementation of mitigations, it is crucial to verify that the updated PHP version is indeed serving web requests, as command-line binary versions may differ. For containerized environments, this involves rebuilding and redeploying the application image with the patched version. If PHP is managed by a Linux distribution, users should consult the distribution's security advisories for the correct patched package version, which might not align with the upstream PHP release number.

Cloudflare's Web Application Firewall (WAF) now provides protection against phpAfterShell (CVE-2026-126714) and other critical PHP vulnerabilities, including new rules for PHP-FPM request smuggling (CVE-2026-129289) and SOAP extension flaws (CVE-2026-15353, CVE-2026-129506). While these WAF rules offer an additional layer of defense, Cloudflare emphasizes that upgrading PHP remains the definitive solution for complete security.

Synthesized by Vypr AI