phpAfterShell Vulnerability: Update PHP Now, Even With a WAF
A critical flaw in PHP's default session handling can lead to remote code execution. PHP has released fixes, and a firewall helps but does not replace the update.
On November 19, 2026, the security research company depthfirst disclosed the phpAfterShell vulnerability (CVE-2026-126714), a flaw in PHP's default file-based session handler that can lead to remote code execution. It scores 9.2 out of 10 (Critical) under CVSS 4.0. The PHP project fixed it the same day, and according to The Cloudflare Blog, those releases also fix 16 other security vulnerabilities, six of them rated critical.
How the phpAfterShell attack works
By default, PHP keeps session data in files. When an application calls session_start(), PHP reads the session file and turns its contents into the $_SESSION array. When the request ends, PHP writes the updated session back to the same file.
The problem appears when that write is interrupted. The file can end up holding the start of the new session data followed by the end of the old data. On the next request, PHP processes that mixed content. If an attacker controlled the old data, PHP can end up creating objects of the attacker's choosing.
An attacker would likely first need a way to put controlled data into the session. PHP's advisory names two: the session upload progress feature, which a remote client can use to shape stored data, and applications that keep large user-controlled strings in the session. According to PHP, code execution also needs 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. Cloudflare notes that the sources it reviewed do not establish whether that second bug is fixed in the November 19 releases.
Which PHP versions are affected
The fixed versions are 8.2.36, 8.3.37, 8.4.28, 8.5.13, and 8.6.0. 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 given site is actually 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. PHP, however, 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. Old does not mean safe.
One more detail matters for anyone on Linux hosting. Distributions often backport fixes without changing the PHP version number, so a version that looks old may already be patched. Cloudflare advises checking the full package version against your distribution's advisory.
On exploitation, Cloudflare says there appears to be no indication so far that these flaws have been used in attacks. As of November 19, none of the 17 was in CISA's Known Exploited Vulnerabilities catalog, and Cloudflare found no source reporting exploitation in the wild.
The other critical PHP flaws in the same release
Cloudflare lists six additional critical flaws, and each one needs a specific setup to be exploitable. Here is the short version:
- PHP-FPM request smuggling (CVE-2026-129289): An unauthenticated attacker can smuggle a second request into PHP-FPM and run PHP code. It requires a front end that reuses backend FastCGI connections (nginx with fastcgi_keep_conn on, Apache mod_proxy_fcgi with enablereuse=on, or HAProxy), plus other application conditions.
- Session serializer mismatch (CVE-2026-115560): Object injection when applications, pools, or command-line jobs use different serializers and share a session store, with session upload progress enabled.
- Use-after-free bugs (CVE-2026-129496, CVE-2026-129481, CVE-2026-129474, CVE-2026-129182): These touch the timezone cache, session shutdown, and fatal error backtraces. Most apply only to certain builds or newer PHP versions. For CVE-2026-129474 on PHP 8.5 and later, Cloudflare says setting zend.exception_ignore_args=1, the php.ini-production default, blocks the demonstrated attack.
If your hosting is a standard shared or managed setup, you may not know which of these conditions apply. That is a good reason to simply update rather than try to rule each flaw out.
What Cloudflare's firewall covers, and what it cannot
Cloudflare says its 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 first deployed in October 2026 for the earlier php2shell flaws. Cloudflare updated its detection logic on November 19. The rule is enabled by default and its default action is Block.
For paid plans, Cloudflare also added three new rules: one for the PHP-FPM flaw and two for flaws in PHP's SOAP extension (CVE-2026-15353 and CVE-2026-129506). These start in Log mode, not Block, because the request patterns they look for can also appear in legitimate traffic. Cloudflare says customers can review matches in Security Events and switch to Block once they confirm no real traffic is affected.
This is Cloudflare describing its own product, so read it with that in mind. Even so, the company is clear about the limits. The WAF is an extra layer, 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. Cloudflare says the only complete fix is to upgrade PHP and restart every worker.
Practical steps to take this week
- Find your PHP version. Ask your host or developer which version each of your sites runs, including staging and old sites that still answer requests.
- Upgrade to a fixed release. Target 8.2.36, 8.3.37, 8.4.28, 8.5.13, or newer, then restart every PHP worker so the new code is actually running.
- Check backported packages. If your server uses a Linux distribution's PHP package, compare the full package version to the distribution's advisory instead of relying on the version number alone.
- Plan a move off PHP 8.1 and earlier. These are end-of-life, and PHP says some of this week's flaws may reach older releases.
- Ask about plugins and containers. Cloudflare points out that PHP often runs inside content management systems, plugins, and container images that teams do not update directly. Confirm your vendors have shipped updated runtimes.
- Use the WAF as a backstop. If you are on a paid Cloudflare plan, review the new Log-mode rules and move them to Block when you are comfortable. Free plan customers do not need to take action for the phpAfterShell rule, according to Cloudflare.
If you run WordPress or Formidable Forms and would like help checking your PHP version and planning the update, you can get help from a Formidable Masterminds developer.
Sources
- How Cloudflare WAF helps protect against phpAfterShell and other critical PHP flaws The Cloudflare Blog
This post was drafted with AI from the reporting linked above and published by The Jones Foundry. For full details, read the original sources.