---
title: "How Cloudflare WAF helps protect against phpAfterShell and other critical PHP flaws"
description: "phpAfterShell (CVE-2026-126714, CVSS 9.2) lets an interrupted write in PHP's default file-based session handler leave a mixed session file."
url: "https://swe.quest/articles/how-cloudflare-waf-helps-protect-against-phpaftershell-and-other-critical-php-3843ce810931b50e"
canonical: "https://blog.cloudflare.com/phpaftershell-waf-protection/"
source: "Cloudflare"
published: "2026-11-20"
difficulty: "medium"
kind: "Announcement"
reading_minutes: 9
tags: ["php","appsec","vulnerability-research","security"]
---

# How Cloudflare WAF helps protect against phpAfterShell and other critical PHP flaws

A post on [Cloudflare](https://swe.quest/sources/cloudflare.md), published 2026-11-20, 9 min read, Announcement. Original: [https://blog.cloudflare.com/phpaftershell-waf-protection/](https://blog.cloudflare.com/phpaftershell-waf-protection/)

## Summary

phpAfterShell (CVE-2026-126714, CVSS 9.2) lets an interrupted write in PHP's default file-based session handler leave a mixed session file. If an attacker controlled the old data, for example through session upload progress, PHP can deserialize objects the attacker chooses and possibly execute code. PHP fixed it in 8.2.36, 8.3.37, 8.4.28, 8.5.13 and 8.6.0 alongside six other critical flaws, including FastCGI request smuggling in PHP-FPM via connection reuse and several use-after-free bugs. Cloudflare's existing PHP RCE managed rule (Block, including Free plan) now covers phpAfterShell, and three new Log-mode rules target the PHP-FPM and SOAP CVEs. The WAF cannot see the deserialization step, session data from other sources, server-state bugs or traffic that bypasses it, so the real fix is to upgrade and restart all workers. Until then, disable session.upload\_progress, turn off FastCGI keep-alive and set fatal\_error\_backtraces=0.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [PHP](https://swe.quest/tags/php.md) (Languages)
- [Application security](https://swe.quest/tags/appsec.md) (Security)
- [Vulnerability research](https://swe.quest/tags/vulnerability-research.md) (Security)
- [Security](https://swe.quest/tags/security.md) (Security)

## Prerequisites

- PHP sessions ([easy posts on PHP](https://swe.quest/tags/php.md?difficulty=easy))
- PHP object deserialization ([easy posts on PHP](https://swe.quest/tags/php.md?difficulty=easy))
- web application firewalls
- FastCGI and PHP-FPM ([easy posts on PHP](https://swe.quest/tags/php.md?difficulty=easy))

## Keywords

phpAfterShell, CVE-2026-126714, Cloudflare WAF, PHP-FPM, CVE-2026-129289, php2shell, WAF attack score

## Related posts

- [php2shell: patching PHP is easy, finding it is the hard part](https://swe.quest/articles/php2shell-patching-php-is-easy-finding-it-is-the-hard-part-9a45e6f935b2d2f4.md): Sourcegraph · 2026-10-21 · Medium · 5 min read · PHP, Vulnerability research, Supply chain security, Incidents & postmortems, Memory safety
  PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35 fix two unauthenticated RCE memory-safety bugs (CVE-2026-109618/109619, dubbed php2shell) in the request lifecycle, reachable on mod\_php via a crafted multipart POST before application code runs.
- [The WordPress Chain Massacre](https://swe.quest/articles/the-wordpress-chain-massacre-f4c4d6206cb6b273.md): Calif · 2026-08-05 · Hard · 8 min read · Vulnerability research, Memory safety, PHP, Linux
  wp2root extends AssetNote's wp2shell pre-auth WordPress RCE from constrained PHP execution to native code execution and Linux root.
- [How Cloudflare WAF helps protect against Java4Shell (CVE-2026-114938)](https://swe.quest/articles/how-cloudflare-waf-helps-protect-against-java4shell-cve-2026-114938-001767259b988fdd.md): Cloudflare · 2026-11-18 · Medium · 9 min read · Vulnerability research, Memory safety, Java & JVM, Application security
  Java4Shell (CVE-2026-114938, CVSS 9.2) is a memory-corruption bug in OpenJDK's AVX-512 Base64 decoder intrinsic.
- [How Cloudflare WAF protects against ruby2shell (CVE-2026-132825)](https://swe.quest/articles/how-cloudflare-waf-protects-against-ruby2shell-cve-2026-132825-7727483822350470.md): Cloudflare · 2026-11-20 · Medium · 6 min read · Vulnerability research, Ruby, Application security, Memory safety
  ruby2shell (CVE-2026-132825) is a heap buffer overflow in Ruby's string case conversion: in 14 legacy single-byte encodings, uppercasing the German ß writes two bytes (SS) but reserves room for one, so 21 sharp s characters overflow by a byte, with proofs of concept reaching remote code execution.
- [Well, That Wasn't Fun: October 16 '26](https://swe.quest/articles/well-that-wasn-t-fun-october-16-26-83d1120fe160ef39.md): Fly.io · 2026-11-06 · Medium · 7 min read · Incidents & postmortems, Vulnerability research, Linux, Virtualization, Networking
  A Linux kernel bug in IPv4 checksum offload validation let a guest VM direct the host to write its computed checksum into an already-trusted IPv4 header field.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
