---
title: "How Cloudflare WAF helps protect against phpAfterShell and other critical PHP flaws"
description: "On November 19, 2026, depthfirst disclosed phpAfterShell (CVE-2026-126714), a critical vulnerability in PHP’s default file-based session handler that can lead to remote code execution. PHP fixed it the same day in versions 8.2.36, 8.3.37, 8.4.28, 8.5.13, and 8.6.0, which also address 16 other security flaws, six of them critical. Cloudflare’s WAF blocks known phpAfterShell attack patterns for all customers, including Free plan users, using a rule first deployed in October 2026 for the php2shell vulnerabilities. For paid plans, Cloudflare added three new WAF rules for a PHP-FPM request smuggling flaw and two SOAP extension flaws, enabled by default with a Log action. The WAF is an additional defense layer, but the only complete fix is to upgrade PHP and restart every worker."
---

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

[Cloudflare](https://yomu.fyi/company/cloudflare) · Christian Larsen · Nov 20, 2026

**Type:** Announcement

## Summary

On November 19, 2026, depthfirst disclosed phpAfterShell (CVE-2026-126714), a critical vulnerability in PHP’s default file-based session handler that can lead to remote code execution. PHP fixed it the same day in versions 8.2.36, 8.3.37, 8.4.28, 8.5.13, and 8.6.0, which also address 16 other security flaws, six of them critical. Cloudflare’s WAF blocks known phpAfterShell attack patterns for all customers, including Free plan users, using a rule first deployed in October 2026 for the php2shell vulnerabilities. For paid plans, Cloudflare added three new WAF rules for a PHP-FPM request smuggling flaw and two SOAP extension flaws, enabled by default with a Log action. The WAF is an additional defense layer, but the only complete fix is to upgrade PHP and restart every worker.

## Context

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. PHP fixed it the same day in versions 8.2.36, 8.3.37, 8.4.28, 8.5.13, and 8.6.0, which also fix 16 other security vulnerabilities, six of them rated critical. Cloudflare’s WAF provides an additional layer of defense while customers patch.

## Approach / What changed

Cloudflare updated an existing PHP remote code execution WAF rule (first deployed in October 2026 for php2shell) to cover phpAfterShell attack patterns, and added three new rules to the Cloudflare Managed Ruleset for paid plans: one for a PHP-FPM request smuggling flaw (CVE-2026-129289) and two for SOAP extension flaws (CVE-2026-15353 and CVE-2026-129506). The phpAfterShell rule is enabled by default with a Block action on all plans, including Free; the new rules are enabled by default with a Log action to avoid disrupting legitimate traffic.

## Takeaways

- phpAfterShell exploits an interrupted file write in PHP’s default session handler, allowing an attacker to deserialize controlled data and achieve remote code execution.
- Cloudflare’s WAF rule for phpAfterShell is enabled by default with a Block action on all plans, including Free, and was updated from an existing php2shell rule.
- The only complete fix for all critical flaws is to upgrade PHP to versions 8.2.36, 8.3.37, 8.4.28, 8.5.13, or 8.6.0 and restart every worker.

## FAQ

### How does phpAfterShell work?

phpAfterShell is triggered when PHP's write of session data to a file is interrupted, leaving mixed old and new content. On the next request, session\_start() deserializes this mixed content, and if an attacker controlled the old data, PHP can deserialize objects of the attacker's choice, leading to code execution.

### What is the default WAF action for these rules?

The WAF rule for phpAfterShell is enabled by default with a Block action for all Cloudflare plans, including Free. The new rules for the PHP-FPM and SOAP flaws are enabled by default with a Log action, because their request patterns can also appear in legitimate traffic. Customers can review matching requests and change the action to Block after confirming no disruption.

### Does the WAF replace the need to patch PHP?

No. The WAF is an additional layer of defense, not a replacement for the patch. Several critical flaws depend on server configuration or can be reached through paths a WAF does not see. The only complete fix is to upgrade PHP to the patched versions and restart every worker.

**Tags:** [Cloudflare](https://yomu.fyi/topic/cloudflare), [PHP](https://yomu.fyi/topic/php), [Security](https://yomu.fyi/topic/security), [Vulnerabilities](https://yomu.fyi/topic/vulnerabilities), [WAF](https://yomu.fyi/topic/waf)

- Source: [Cloudflare](https://blog.cloudflare.com/phpaftershell-waf-protection)
- Source URL: https://blog.cloudflare.com/phpaftershell-waf-protection
- Ingested by Yomu: 2026-11-20T21:00:11.897Z

[Read original post](https://blog.cloudflare.com/phpaftershell-waf-protection)
