Skip to content

Cloudflare WAF and PHP2Shell: check the rules and the gaps

Check that Cloudflare's managed rules for PHP2Shell are on and blocking for your WordPress site, and read the events they record. You will also close the two gaps the rules leave open, a renamed upload progress field and an origin server anyone can reach directly.

If your WordPress site sits behind Cloudflare, you can check in about fifteen minutes whether Cloudflare’s firewall rules for PHP2Shell are protecting it. PHP2Shell is the nickname for CVE-2026-109618 and CVE-2026-109619, two critical PHP flaws disclosed on 21 October 2026 that can let a visitor run code on your server without logging in. Cloudflare added managed rules for them to its web application firewall (WAF), the filter that inspects requests before they reach your server, and says they protect free and paid plans by default. A setting in your own account can still switch them off or turn them down to logging only, and the rules have two blind spots that matter for real sites. Check that the rules are on and set to Block, read what they caught, close the gaps, and then patch PHP, because the WAF only buys you time.

What you’ll accomplish

  • Confirm your site’s traffic actually passes through Cloudflare, so the rules can see it.
  • Confirm the seven PHP2Shell rules are enabled with the Block action, with no override weakening them.
  • Read the Security Events those rules recorded since 21 October.
  • Find out whether your PHP uses a renamed session.upload_progress.name, which one of the rules does not cover.
  • Test whether your origin server answers requests that skip Cloudflare, and know the three ways to stop that.

Prerequisites

  • Access to the Cloudflare dashboard for the zone (the domain) with permission to view and edit security settings.
  • SSH access to the server, or a hosting panel that shows PHP settings. On managed WordPress hosting where you cannot see PHP, ask your host for steps 5 and 6.
  • A second machine outside the server’s network for the direct-to-origin test. A laptop on a home connection works.
  • Your origin server’s public IP address. It is in your hosting panel, or in the DNS record you pointed at Cloudflare.

Cloudflare’s dashboard has been redesigned over the last two years, so menu names on your account may differ slightly from the ones below. The labels here are the ones in Cloudflare’s current documentation as of 28 October 2026.

How it works

Cloudflare announced the rules on 21 October 2026 and later added an update about the PHP project’s 23 October advisory (Cloudflare blog). As of 28 October 2026, this is what Cloudflare states:

  • Customers on the free or paid WAF have been protected by default since 03:02 UTC on 21 October.
  • Free plans get the rules in the Cloudflare Free Managed Ruleset, which Cloudflare’s WAF documentation says is deployed by default on Free plans. Cloudflare’s blog calls it the Managed Free Ruleset and its changelog the Free Ruleset; all three names mean the same ruleset.
  • Pro, Business and Enterprise plans get them in the Cloudflare Managed Ruleset. Cloudflare asks paid customers to review that deployment and confirm it runs in block mode.
  • Each ruleset holds seven rules named “PHP Remote Code Execution Attack (CVE-2026-109618, CVE-2026-109619)”, then the same name with #2 to #7. Cloudflare’s two WAF changelog entries for 22 October list all fourteen with the Block action.
  • In its update, Cloudflare says rule #6 also stops known attempts on a third flaw, CVE-2026-115560, disclosed by the PHP project on 23 October. It only does so when a site uses PHP’s default upload progress field name.
  • Cloudflare also deployed a separate response ruleset, the Cloudflare Managed Response Firewall Default, on all plans including Free. It inspects what your server sends back and can block a matching response before it reaches the attacker.

One detail helps when you read old events. Cloudflare’s changelog for 21 October listed the paid rules as “Generic Rules - Anomalous Execution” 1 to 7. On 22 October they were renamed to the PHP2Shell names, with detection and actions unchanged. The rule IDs stayed the same, so filtering by ID is the reliable way to find every event.

Update, 21 November 2026. A fix for CVE-2026-115560 now exists. On 19 November 2026 the PHP project released PHP 8.5.13, 8.4.28, 8.3.37 and 8.2.36, and its ChangeLog lists the flaw as fixed in all four (php.net). The WAF still matters while you roll that update out, and the gaps in steps 5 and 6 stay open until you do. The same day, a Cloudflare WAF emergency release updated rule #6 in both rulesets (WAF changelog). Its name now lists CVE-2026-115560 and CVE-2026-126714 as well, a session flaw fixed in the same PHP release. As of 21 November 2026 the changelog shows the same two rule IDs as step 4 for rule #6, with the Block action. Cloudflare also added three rules to the Cloudflare Managed Ruleset on paid plans, for CVE-2026-129289, CVE-2026-15353 and CVE-2026-129506. They start with the Log action, so they record matches and block nothing until you change them (Cloudflare blog).

Request path showing visitors passing through the Cloudflare edge, where the PHP2Shell managed rules block attacks, before reaching the origin server, and a red dashed path where an attacker connects straight to the origin IP and skips every WAF rule

The diagram shows why the rules are a stopgap. They act only on requests that travel through Cloudflare. Anyone who knows your server’s IP address can connect to it directly, and that path meets no WAF at all.

Step-by-step

  1. Confirm the hostname is proxied. A DNS record set to “DNS only” (the grey cloud) sends visitors straight to your server, and no WAF rule runs. From any machine, check the response headers:

    curl -sI https://www.example.com/ | grep -iE '^(server|cf-ray):'

    Example output:

    server: cloudflare
    cf-ray: 8d2f61a7cb93e4a1-YUL

    If both lines appear, the request went through Cloudflare. If they are missing, open DNS in the dashboard and switch the record to Proxied. Repeat the check for every hostname that serves PHP, including example.com without www, staging sites and any WordPress multisite subdomains.

  2. Check the ruleset is turned on. In the dashboard, go to the Security Settings page and filter by Web application exploits. On a paid plan, Cloudflare managed ruleset must be turned on. If it is off, turn it on, review the deployment and select Save. On the Free plan, the Free Managed Ruleset is deployed for you and there is nothing to switch on. On any plan, Cloudflare points to the Security rules page to confirm that the response rules, the Cloudflare Managed Response Firewall Default, are active.

  3. Look for an override that weakens the rules. Go to the Security rules page, filter by Managed rules, and open the rule that executes the managed ruleset. Check three things:

    • Ruleset action should be Default or Block. Log records attacks without stopping them, and Cloudflare asks paid customers to confirm block mode.
    • Scope should cover all incoming requests. A custom filter here can quietly leave paths unprotected.
    • Under Browse rules, search for “PHP Remote Code Execution”. All seven rules should be enabled with the Block action.

    Then scan your custom rules for a Skip action that skips managed rules. Rules that let office IPs or monitoring tools skip the WAF also exempt those sources from the PHP2Shell rules. Our article on Cloudflare allowlist strategy explains how to scope those skips narrowly.

  4. Read the events the rules recorded. Go to the security Analytics page and select the Events tab. Cloudflare’s post names this view Security > Security Analytics > Events. Set the time range to cover 21 October onward. Security Events keeps 31 days of data, and Free, Pro and Business plans can query 30 days at a time. The whole period since disclosure was still visible on 28 October. From 21 November 2026 the earliest events start to age out of that window. The Free plan shows sampled logs only. Select Add filter, choose the rule ID field, and enter one ID from this table, published by Cloudflare:

    RuleFree Managed RulesetCloudflare Managed Ruleset
    base rule4e315666e8e344cdb64119a3b5ccf32fc1d409ad838f47f59446f21cc438d5dd
    #200c10e6cc4da4bd08722adeebcd95984f9a45927414245e3a64bb12d0a0c2f64
    #348ddf592361e4fdb97a8a85982dab691771c654ae1154d4daa72f4e1545d163c
    #43556683d512a47f2937899c524b1a4c6217005865f0145f392300bac212afcc9
    #5da07c85852e34625bb478496302ede4638efdb17ea594501bb55a1d71867b12e
    #619373a83abb840e18ab3ce5a7975ce1b4148ae686fdb4d01be673fab9d9c073d
    #707f0b6ddaabf40b1b2042dade8d613fa1389aa259617437392ce149c48143645

    Expand a few events under Sampled logs. Each one shows the action taken, the request path and the rule that matched. You want to see Block. A Log action means an override from step 3 is still in place. Sampled logs show a subset of events on busy sites, so treat the count as a lower bound.

    An empty list is not proof of safety. Amazon reported an attempt on 17 October, four days before these rules were deployed, so anything earlier is outside what Cloudflare could block. Our guide to checking a server for PHP2Shell attack attempts covers the server-side logs for that window.

  5. Check whether your PHP renamed the upload progress field. PHP can track a file upload while it is still arriving, so a page can show a progress bar. It spots those uploads by a form field whose name it reads from session.upload_progress.name. Rule #6 only recognises the default name. Ask the PHP-FPM binary (the process manager that runs PHP for the web server) which value it uses; change 8.3 to your version:

    php-fpm8.3 -i | grep -E 'session.upload_progress.(enabled|name)'

    Example output:

    session.upload_progress.enabled => On => On
    session.upload_progress.name => PHP_SESSION_UPLOAD_PROGRESS => PHP_SESSION_UPLOAD_PROGRESS

    PHP_SESSION_UPLOAD_PROGRESS is the default, so rule #6 applies. Any other name means Cloudflare’s rule does not cover CVE-2026-115560 on this server. Only the fixed PHP release in step 8 closes it there. Pool files can override php.ini, so also search them:

    sudo grep -rn 'upload_progress' /etc/php/ /opt/cpanel/ea-php*/root/etc/ 2>/dev/null

    Whatever the name says, the safer fix is to turn the feature off with session.upload_progress.enabled = 0. The PHP project recommends that for CVE-2026-109619 and for CVE-2026-115560. The 19 November release turns the feature off by default, but a setting in your own configuration that enables it overrides that default. WordPress core does not use PHP sessions, so on most WordPress sites nothing visible changes; the media upload test in the validation section confirms it. The exact placement and the worker restart are in PHP2Shell mitigations to apply until you can patch PHP. After it, the output above reads Off and the field name no longer matters.

  6. Test whether the origin answers without Cloudflare. From your outside machine, send a request straight to the server’s IP address while keeping your real hostname. In this command, 203.0.113.10 stands for your origin IP:

    curl -sk -o /dev/null -w '%{http_code}\n' --max-time 10 --resolve www.example.com:443:203.0.113.10 https://www.example.com/

    Example output on an unprotected origin:

    200

    A 200, 301 or 302 means your server serves the site to anyone who skips Cloudflare, and the PHP2Shell rules do nothing for those requests. A 000 means the connection was refused or timed out at the firewall. With Authenticated Origin Pulls in place, Nginx answers 400 because no client certificate was sent. Either result is the one you want.

  7. Lock the origin to Cloudflare. Pick one of these three, in order of effort:

    • Firewall allowlist. Allow ports 80 and 443 only from the address ranges Cloudflare publishes at cloudflare.com/ips, IPv4 and IPv6. Our guide to allowlisting Cloudflare IPs at the origin firewall has the ufw, nftables and cloud security group rules.
    • Authenticated Origin Pulls (AOP). Cloudflare presents a client certificate on every request, and your web server refuses connections without it (Cloudflare docs). Use the zone-level or per-hostname option with your own certificate. The global option uses a certificate shared across all Cloudflare accounts, so it only proves a request came from Cloudflare’s network. Authenticated Origin Pulls does not apply when the zone’s SSL/TLS encryption mode is Off or Flexible.
    • Cloudflare Tunnel. A small agent on the server opens an outbound connection to Cloudflare, so the server needs no open web ports. See exposing a private origin with Cloudflare Tunnel.

    Locking the door helps less if the address is public knowledge. Grey-clouded records such as mail or cpanel often point at the same IP; our article on an origin IP still exposed behind Cloudflare lists where it leaks.

  8. Patch PHP. Everything above narrows the paths in. The fix is a PHP release that contains the patch, then a restart of every PHP worker. As of 21 November 2026 that means PHP 8.5.13, 8.4.28, 8.3.37 or 8.2.36 or later, which also fix CVE-2026-115560, or a distribution package your vendor lists as fixed. Follow how to update PHP on a Linux server after a security fix, and keep the Cloudflare rules on afterwards, as Cloudflare recommends.

Validate it works

Run these four checks after the changes, from the same machines as before:

curl -sI https://www.example.com/ | grep -iE '^(server|cf-ray):'
curl -sk -o /dev/null -w '%{http_code}\n' --max-time 10 --resolve www.example.com:443:203.0.113.10 https://www.example.com/
php-fpm8.3 -i | grep session.upload_progress.enabled
php-fpm8.3 -v | head -n 1

Example output:

server: cloudflare
cf-ray: 8d2f7c04e9a1b3f2-YYZ
000
session.upload_progress.enabled => Off => Off
PHP 8.3.36 (fpm-fcgi) (built: Oct 21 2026 09:12:40) (NTS)

The version line is the October example. A server updated after 19 November 2026 shows 8.3.37 or later on the 8.3 branch.

You are done when all four agree. The headers still show Cloudflare, the direct request fails and upload progress is off. PHP reports a fixed release, or a distribution package your vendor lists as fixed. In the dashboard, the managed ruleset rule still shows the Block action. In WordPress, upload an image to the media library to confirm that the site still works through Cloudflare.

Troubleshooting

  • The Events tab shows no PHP2Shell events at all. Check step 1 first, because a grey-clouded record bypasses the WAF entirely. Then widen the time range, since the default is the last 24 hours. A small site that nobody probed may have no matches.
  • Events show the Log action instead of Block. A ruleset-level override is set to Log. Set Ruleset action back to Default and save. Old events keep their original action, so check that new ones say Block.
  • A legitimate request is blocked by one of the PHP rules. Do not disable the rule. Find the exact event by its Ray ID, then add a narrow exception for that path, as described in triaging Cloudflare WAF false positives. Patch PHP first if you can, because then the exception carries far less risk.
  • The site shows a 521 or 522 error after the firewall change. Cloudflare cannot reach the origin. Usually the allowlist misses the IPv6 ranges, or it uses an outdated range list. Reload the current list from cloudflare.com/ips and check both address families.
  • Uptime monitoring or a payment webhook stopped working after the lockdown. Those services were calling the origin IP directly. Point them at the proxied hostname, or allow their published addresses in the firewall as a narrow, named exception.

When this is the wrong approach

If your site is not on Cloudflare, none of the dashboard steps apply. Steps 5 and 8 still do, because the PHP setting and the patch work without any WAF. On managed WordPress hosting, the host controls PHP and often the origin firewall, so ask them to confirm the patch and the origin lockdown rather than changing settings yourself.

Do not treat a clean Events tab as an all-clear. The rules match known attack patterns, Cloudflare says it keeps updating them as new techniques appear, and they see nothing that reaches your server another way. For the generic Cloudflare rulesets and the WordPress-specific rules beyond PHP2Shell, see our overview of Cloudflare WAF managed rulesets for WordPress.

Running WordPress that earns real money deserves an operator — Stack Harbor runs that stack under Enterprise WordPress; book an infrastructure consult.