Critical PHP Vulnerability Allows Remote Code Execution via Session Files

A newly disclosed flaw in PHP, named phpAfterShell and tracked as CVE-2026-126714, enables remote code execution through a deserialization vulnerability in the default file-based session handler. The issue arises when session files are partially overwritten, allowing attackers to exploit the system. The vulnerability carries a CVSS v4.0 score of 9.2 and affects all PHP applications using the default session storage method.
A critical vulnerability in PHP, designated CVE-2026-126714 and dubbed phpAfterShell, was disclosed in November 2026, affecting all PHP versions prior to 8.2.36, 8.3.37, 8.4.28, and 8.5.13 when using the default file-based session handler. The flaw enables remote code execution through a deserialization vulnerability triggered when session files are partially overwritten during an interrupted write operation. This hybrid file state—part new data, part legacy content—can be interpreted by PHP as valid session data, allowing attackers to inject malicious serialized objects. The vulnerability carries a CVSS v4.0 score of 9.2, classifying it as Critical. It specifically impacts applications relying on file-backed sessions, including widely used platforms like WordPress and Laravel, but not those using Redis or database storage. The risk is heightened by PHP’s session upload-progress feature, which allows unauthenticated manipulation of session state during multipart request parsing, creating a pre-authentication attack vector. The PHP development team released patched versions, including PHP 8.6.0, which includes the fix. Organizations using older, end-of-life PHP versions (e.g., 8.1 and earlier) are advised to migrate to supported branches. The exploit requires precise timing and attacker control over session data, but researchers have demonstrated chaining it with a memory-corruption technique to achieve full code execution within the PHP worker process.
The impact of CVE-2026-126714 could be widespread, affecting millions of web applications globally that rely on PHP’s default session handling. Given PHP’s dominance in web infrastructure—especially in content management systems and legacy enterprise applications—this flaw may expose a vast attack surface, particularly among organizations with delayed patching cycles. The vulnerability’s ability to enable remote code execution without authentication could lead to widespread data breaches, server compromise, or lateral movement within networks. Second-order effects may include increased demand for SIEM and EDR solutions capable of detecting anomalous session behavior, driving growth in cybersecurity platforms like SOC Prime, which offers detection intelligence for such threats. The incident may also accelerate migration from outdated PHP versions, influencing software development lifecycles and cloud migration strategies. A comparable case is the 2017 Equifax breach, which stemmed from an unpatched Apache Struts vulnerability, highlighting how a single, widely used component can become a systemic risk. What may follow includes a surge in exploit kits targeting this flaw, increased scrutiny of session management practices, and greater emphasis on atomic file operations in language runtime design. Monitoring for unusual PHP-FPM crashes, multipart upload anomalies, and session file corruption will likely become standard in threat detection.