How Cloudflare WAF helps protect against phpAfterShell and other critical PHP flaws
On November 19, 2026, the security research company depthfirst disclosed phpAfterShell (CVE-2026-126714), a vulnerability in PHP's default file-based session handler that can lead to remote code execution. Under the Common Vulnerability Scoring System (CVSS) 4.0, it scores 9.2 out of 10 (Critical). 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. These releases fix 16 other security vulnerabilities, six of them also rated critical.
Cloudflare’s web application firewall (WAF) blocks known phpAfterShell attack patterns, including for customers on the Free plan. The protection comes from a PHP remote code execution rule we first deployed in October 2026 for the php2shell vulnerabilities. That rule already detected part of the phpAfterShell attack pattern before the vulnerability was disclosed, and on November 19 we updated its detection logic to cover phpAfterShell. The rule is part of both the Cloudflare Free Managed Ruleset and the Cloudflare Managed Ruleset, is enabled by default, and its default action is Block.
In the same WAF release, we added three new rules 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) that PHP fixed in the same releases. These rules are enabled by default with the Log action, because the request patterns they look for can also appear in legitimate traffic, and blocking by default could disrupt it. Customers can review matching requests in Security Events now and change the action to Block once they confirm the rules do not affect legitimate traffic.
The WAF is an additional layer of defense, not a replacement for the patch. Several of the critical flaws depend on server configuration or can be reached through paths a WAF does not see, and the only complete fix is to upgrade PHP and restart every worker. Our analysts continue to monitor attack activity and will update the rules as new techniques and variations appear. You can track rule changes in the WAF changelog and follow how the vulnerabilities develop in the dedicated Cloudflare Zero Wire briefing.
There appears to be no indication so far that these vulnerabilities have been exploited. As of November 19, 2026, none of the 17 vulnerabilities was listed in CISA's Known Exploited Vulnerabilities catalog, and no source we reviewed reports exploitation in the wild.
What we know about phpAfterShell
PHP stores session data in files by default. When an application calls session_start(), PHP reads the session file and deserializes its content into the $_SESSION array. When the request ends, PHP writes the updated session back to the same file.
phpAfterShell is triggered when that write is interrupted. The session file can then hold the beginning of the new session data followed by the end of the old one. On the next request, session_start() deserializes this mixed content. If an attacker controlled the old data, PHP can end up deserializing objects of the attacker's choice.
An attacker trying to exploit the flaw is likely to first search for a way to place controlled data in the session. PHP's advisory names two:
- Session upload progress, a PHP feature that writes information about a running file upload into the session. A remote client can use it to shape the stored data.
- Applications that store large user-controlled strings in the session.
According to PHP, code execution also requires an interruption at a useful point in the write and a suitable deserialization gadget chain in the application. depthfirst reports that it reached code execution without an application gadget by chaining a second, undisclosed memory-corruption bug in a PHP-native class. The sources we reviewed do not establish whether that second bug is fixed in the November 19 releases.
depthfirst says it discovered and reported phpAfterShell. The CVE record credits Leo Lin and Asahi as reporters.
The other critical flaws
The same releases fix six more critical vulnerabilities. Each one needs a specific configuration to be exploitable:
CVE | Component | Impact | Conditions |
CVE-2026-129289 | PHP-FPM | An unauthenticated attacker can smuggle a second FastCGI request into PHP-FPM and run PHP code as the worker. | A front end that reuses backend FastCGI connections (nginx with fastcgi_keep_conn on, Apache mod_proxy_fcgi with enablereuse=on, or HAProxy), an application path that opens php://input without reading it to the end, and the path of an existing PHP script. |
CVE-2026-115560 | Session serializer | Object injection through a mismatch between session serializers. First covered in our php2shell briefing, now fixed. | Session upload progress enabled. PHP widened the scope: applications, pools or command-line jobs that use different serializers and share a session store are affected. |
CVE-2026-129496 | Timezone cache | Use-after-free that can crash a fresh worker and possibly run code. PHP demonstrated code execution locally with known memory addresses. | Non-thread-safe builds where a startup diagnostic has been written to a PHP error log file. |
CVE-2026-129481 | Session shutdown | Use-after-free, described by PHP as an incomplete fix for CVE-2026-109619. No code execution demonstrated. | PHP 8.3 and later. |
CVE-2026-129474 | Fatal error backtraces | Use-after-free in magic method backtraces. | PHP 8.5 and later, where fatal error backtraces are enabled by default. Setting zend.exception_ignore_args=1, the php.ini-production default, blocks the demonstrated attack. |
CVE-2026-129182 | Fatal error backtraces | Use-after-free. No code execution demonstrated. | PHP 8.5, specific path-level settings, and an Apache per-directory configuration or front end that produces an early diagnostic. |
Who is affected
The vulnerable versions are PHP 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. Whether a deployment is exposed depends on the conditions of each flaw.
PHP 8.1 and earlier are end-of-life. depthfirst says the official 7.4, 8.0 and 8.1 end-of-life mitigation branches are not affected by phpAfterShell, but PHP says CVE-2026-129289 was introduced in PHP 5.6.0 and that releases older than 8.2 may also be affected by CVE-2026-115560.
Linux distributions often backport fixes without changing the PHP version number. Check the full package version against your distribution's advisory.
How Cloudflare WAF protects you
PHP runs a large share of the web, often inside content management systems, plugins, and container images that teams do not update directly. Patching every PHP runtime takes time. Cloudflare WAF reduces your exposure while you patch.
phpAfterShell: protection on every plan
We released the original PHP remote code execution rules in an emergency release on October 21, 2026, after the php2shell vulnerabilities (CVE-2026-109618 and CVE-2026-109619) were disclosed. We extended them to CVE-2026-115560 on October 23 and refined them several times in the following weeks, based in part on reports from security researchers who took part in a PHP Capture the Flag (CTF) challenge.
phpAfterShell shares an attack technique with php2shell: an attacker plants serialized PHP data in session storage and waits for PHP to deserialize it. Because of that overlap, the existing rule already matched part of the phpAfterShell attack pattern before disclosure. On November 19, we updated the rule's detection logic to cover phpAfterShell and added CVE-2026-126714 to its description.
Rule description | Rule ID | Ruleset | Default action |
PHP Remote Code Execution Attack (CVE-2026-109618, CVE-2026-109619, CVE-2026-115560, CVE-2026-126714) #6 | 19373a83abb840e18ab3ce5a7975ce1b | Cloudflare Free Managed Ruleset (Free plan) | Block |
PHP Remote Code Execution Attack (CVE-2026-109618, CVE-2026-109619, CVE-2026-115560, CVE-2026-126714) #6 | 4148ae686fdb4d01be673fab9d9c073d | Cloudflare Managed Ruleset (Pro, Business and Enterprise plans) | Block |
Free plan customers do not need to take any action. On paid plans, the rule is active wherever the Cloudflare Managed Ruleset is deployed. You can use the links in the Zero Wire briefing to go straight to the rules in your dashboard.
New rules for PHP-FPM and SOAP flaws
The three new rules are part of the Cloudflare Managed Ruleset (Ruleset ID efb7b8c949ac4650a09736fc376e9aee) and are available on Pro, Business and Enterprise plans.
Rule description | Rule ID | Default action |
PHP-FPM - CVE:CVE-2026-129289 | 8ef1c34a424b4ccfa6f6fe186c6f42b2 | Log |
PHP SOAP - CVE:CVE-2026-15353 | 5c5a9d6397e44837a3214b5ba54028d4 | Log |
PHP SOAP - CVE:CVE-2026-129506 | 00a23de67a684876ba67c5d44521b819 | Log |
To review their matches, go to Security > Analytics > Events and filter by rule ID. If the matches are not legitimate traffic, change the rule action to Block: go to Security > Settings, edit the Cloudflare Managed Ruleset, search for the CVE identifier and set the rule action to Block, or you can refer to the links in the Zero Wire briefing to go straight to the rules configuration.
What the WAF cannot see
A WAF can block an exploit when the malicious data arrives in an HTTP request that passes through Cloudflare. It cannot block every path to these vulnerabilities, including:
- The deserialization step. phpAfterShell's final step happens inside PHP, when it reads a corrupted session file. The WAF can block the requests that plant the payload, not the read itself.
- Session data from other sources. If an application copies user-controlled data into the session from a database, a queue or an upstream API, that data may never cross the WAF in a recognizable form.
- 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. They do not have dedicated WAF rules, and the patch and the configuration changes below are the way to address them.
- Traffic that bypasses Cloudflare. This includes internal traffic between services and PHP-FPM listeners exposed directly to a network.
Adding defense in depth with WAF attack score
WAF attack score adds a machine learning layer that scores each request for attack payloads. It is available on Business plans (cf.waf.score.class) and, with a dedicated remote code execution sub-score (cf.waf.score.rce) along with an overall score (cf.waf.score), on Enterprise plans.
Attack score complements the managed rules. It will not recognize every serialized object or smuggled FastCGI record on its own, but a working exploit chain usually needs more than one request, and the later stages carry payloads the model is trained to score:
- Second-stage payloads. Once an attacker can run code, they still need to send commands: shell execution primitives (/bin/sh -c, system(), passthru()), PHP code evaluation (eval(), assert()) or reverse-shell strings in headers, query parameters or request bodies.
- Webshell traffic. Attackers often drop a small PHP webshell after the initial compromise. Requests that pass operating system commands to that webshell remain visible to attack score.
Deploy protections and patch
You can find more information on how to deploy managed rules and attack score in our WAF guide. In short:
- Check that phpAfterShell protection is active. On the Free plan, no action is needed. On paid plans, make sure the Cloudflare Managed Ruleset is deployed and that the PHP Remote Code Execution Attack #6 rule is set to Block.
- Review the new rules and switch them to Block. The CVE-2026-129289, CVE-2026-15353 and CVE-2026-129506 rules are in Log mode by default. Review their matches in Security Events, then change their action to Block.
- Layer attack score. Create a custom rule that blocks or challenges requests with a low remote code execution score, for example cf.waf.score.rce le 20 on Enterprise plans, or cf.waf.score.class eq "attack" on Business plans.
- Upgrade PHP. Move to 8.2.36, 8.3.37, 8.4.28, 8.5.13 or 8.6.0. Rebuild container images and restart the PHP-FPM master or Apache so every worker loads the new binary, then verify the version that serves web requests. After upgrading, check that no php.ini, FPM pool or virtual host still sets session.upload_progress.enabled=1, because an explicit setting overrides the new default.
- Apply interim mitigations if you cannot upgrade right away. Set session.upload_progress.enabled=0 and limit the untrusted data you store in sessions. Turn off FastCGI connection reuse. On PHP 8.5, set fatal_error_backtraces=0. Fix configuration errors that produce PHP startup warnings, or send PHP errors to syslog instead of a file. Keep PHP-FPM listeners off untrusted networks. These steps reduce exposure; they do not fix the flaws.
For a prompt you can give an AI agent to inventory your PHP deployments and check each one against all seven critical CVEs, see the phpAfterShell page on Cloudflare Zero Wire.
Update every PHP runtime now
phpAfterShell turns an interrupted file write in PHP's default session handler into a path to code execution, and it arrived in the same release as six other critical flaws. With technical details now public, we expect exploit attempts to follow. Cloudflare WAF blocks known phpAfterShell attack patterns for every customer, including the Free plan, and paid plans have new rules for the PHP-FPM and SOAP flaws. The fix is still to upgrade PHP and restart the services that use it.
