Cloudflare WAF blocks phpAfterShell and adds rules for other PHP flaws fixed in November 2026 releases
On November 19, 2026, security research company depthfirst disclosed phpAfterShell (CVE-2026-126714), a critical vulnerability in PHP's default file-based session handler that can lead to remote code execution. Under CVSS 4.0, the flaw scores 9.2 out of 10. The PHP project fixed it the same day in versions 8.2.36, 8.3.37, 8.4.28, 8.5.13, and 8.6.0, alongside 16 other security vulnerabilities, six of them also rated critical. Cloudflare's web application firewall blocks known phpAfterShell attack patterns for all customers, including those on the Free plan, using a rule first deployed in October 2026 for php2shell vulnerabilities and updated on November 19 to cover the new flaw.
In the same WAF release, three new rules were added to the Cloudflare Managed Ruleset for paid plans: one for a request smuggling flaw in PHP-FPM (CVE-2026-129289) and two for flaws in PHP's SOAP extension (CVE-2026-15353 and CVE-2026-129506). These rules are enabled by default with the Log action because the request patterns they detect can also appear in legitimate traffic; blocking by default could disrupt normal operation. Customers can review matching requests in Security Events and change the action to Block once they confirm the rules do not affect legitimate traffic. The WAF thus provides an additional defensive layer while administrators evaluate and apply patches.
The vulnerable PHP versions are 8.2 before 8.2.36, 8.3 before 8.3.37, 8.4 before 8.4.28, 8.5 before 8.5.13, and the 8.6.0 release candidates. PHP 8.1 and earlier are end-of-life, though depthfirst notes the official 7.4, 8.0 and 8.1 mitigation branches are not affected by phpAfterShell. Linux distributions often backport fixes without changing the PHP version number, so administrators should check the full package version against their distribution's advisory. Whether a deployment is exposed depends on the specific configuration conditions of each flaw, as several critical vulnerabilities require particular server setups to be exploitable.
phpAfterShell is triggered when a session file write is interrupted, allowing an attacker's controlled data to be mixed with new session data. On the next request, PHP deserializes this mixed content, potentially executing attacker-controlled objects. The flaw requires an interruption at a useful point in the write and a suitable deserialization gadget chain in the application, though depthfirst reports reaching code execution without an application gadget by chaining a second, undisclosed memory-corruption bug in a PHP-native class. The other six critical flaws fixed in the same releases each have specific configuration conditions for exploitation, including CVE-2026-129289 (PHP-FPM request smuggling), CVE-2026-115560 (session serializer mismatch), and CVE-2026-129496 (use-after-free in timezone cache).
Cloudflare WAF reduces exposure while teams patch PHP runtimes, which can take time because PHP runs inside content management systems, plugins, and container images that teams do not update directly. The PHP Remote Code Execution Attack #6 rule, covering CVE-2026-109618, CVE-2026-109619, CVE-2026-115560 and CVE-2026-126714, is active by default on both the Free Managed Ruleset and the Managed Ruleset for paid plans, with a Block default action. On paid plans, customers should ensure the Cloudflare Managed Ruleset is deployed and the rule is set to Block. Three new rules for PHP-FPM and SOAP flaws are in Log mode by default; administrators should review matches in Security Events and switch them to Block if they do not affect legitimate traffic.
The WAF cannot block every path to these vulnerabilities; it can block requests that plant payloads but not the deserialization step that occurs inside PHP, nor session data from other sources such as databases or upstream APIs. Flaws triggered by server state (CVE-2026-129496, CVE-2026-129481, CVE-2026-129474 and CVE-2026-129182) depend on error logs, diagnostics and worker lifecycle and have no dedicated WAF rules. Traffic bypassing Cloudflare, including internal service traffic and directly exposed PHP-FPM listeners, also remains outside WAF protection. The complete fix remains upgrading PHP to a patched version and restarting every worker, with interim mitigations including disabling session.upload_progress.enabled, limiting untrusted session data, turning off FastCGI connection reuse and, on PHP 8.5, setting fatal_error_backtraces=0.
Source credits
By Daniele Molteni from Cloudflare Blog. Edited by SetuGeo.