Optimum Web
Security 9 min read

Does Cloudflare or a WAF Protect You from PHP2Shell? Only If Attackers Can't Reach Your Origin

Last verified: 23 October 2026

Quick Answer: Cloudflare or any other web application firewall (WAF) protects you from PHP2Shell only for requests that pass through it, and Cloudflare itself called its emergency rules a stopgap. If your origin server answers on its own IP address, attackers skip the WAF and send the exploit straight to PHP. Lock the origin so it accepts web traffic only from your content delivery network (CDN), test that lock from outside, and patch PHP.

What does a Cloudflare or WAF rule actually do against PHP2Shell?

A WAF inspects each HTTP request and compares it with patterns of known attacks. For PHP2Shell (CVE-2026-109618 and CVE-2026-109619), vendors wrote rules that match the request shapes seen in early exploits: how the body is built, which fields are used, how large it is. A matching request is blocked at the edge.

That matters, because the traffic arrived fast. Cloudflare reported tens of thousands of attempts within 45 minutes of disclosure, hundreds of thousands within two hours and millions by early 22 October. Cisco Talos described most of what it observed as scanning rather than targeted attacks.

A signature still has three built-in limits:

  • It matches what is already known. Attackers rewrite payloads until they stop matching. Many public proof-of-concept scripts also turned out not to work, so early traffic is a poor guide to what a working exploit looks like.
  • The bug is not in your application. PHP2Shell triggers inside the PHP runtime while it is still parsing the request, before WordPress, Laravel or your login code runs. The PHP2Shell explainer covers the mechanics.
  • It only sees traffic routed through it. This is the limit that catches most teams, and the rest of this article deals with it.

Cloudflare's own word for its rules was a stopgap. Read every vendor's PHP2Shell rule the same way: it buys time to patch, it does not replace the patch.

What is confirmed about PHP2Shell attacks as of 23 October?

It helps to separate what has been reported from what has not. This is the public picture on the day of writing.

QuestionStatus on 23 October 2026Reported by
Mass exploitation attempts?Confirmed: millions of requests by early 22 OctoberCloudflare
Attempts before the fix shipped?Yes: Amazon reported an attempt on 17 October; Patchstack reported incidents from hosting partners on the morning of 21 OctoberAmazon, Patchstack
Exploit that beats standard hardening?Yes, privately: built on 22 October, shared with customers only, x86-64 onlyVulnCheck
Botnet recruitment?Attempted by the Mirai-derived "Potassium" botnet; unsuccessful so farSophos, Arctic Wolf
Successful compromise publicly confirmed?No. CISA's 21 October alert said it had not observed exploitationCISA
How many services exposed?Censys counted 4.18 million hosts and assessed more than 34.4 million PHP services as vulnerable, as of 23 OctoberCensys

"Not confirmed" is not the same as "not happening". Exploitation of this bug runs below the application layer, so many victims would not see it in their application logs. Plan as if a reachable, unpatched origin is already being tried.

Why is the origin server the real weak point?

A CDN publishes its own IP addresses in your DNS. Visitors connect to the CDN edge, and the edge connects to your server, the origin. The WAF sits on the edge.

Nothing in that arrangement stops anyone from connecting to the origin directly. Unless you configure the origin to refuse, it accepts an HTTPS request on its public IP, reads the Host header and passes the request to PHP. The WAF never sees it.

So the useful question is not "do we use Cloudflare?" It is "can anyone on the internet reach PHP without passing through Cloudflare?"

How do attackers find an origin IP behind Cloudflare?

An origin that was ever public, or still leaks its address, is not hidden for long. These are the usual routes:

  • DNS history. Passive DNS databases keep what your domain resolved to before it moved behind the CDN. If the server kept its IP, the old A record still points at it.
  • Unproxied subdomains. mail., ftp., cpanel., staging., dev. or direct. records often resolve to the same machine as the website, with no CDN in between.
  • Mail sent from the web server. Contact forms and order confirmations sent by the server carry its IP in the message headers.
  • Certificate data. Certificate transparency logs list every hostname you issued certificates for. Scanners also record the certificate each IP presents, so an origin serving www.example.com on its bare IP is easy to find.
  • Direct scanning. Internet-wide scanners index page titles, content and favicons. A page that matches your public site pairs the IP with your domain.
  • The application itself. Webhooks, WordPress pingbacks, image fetches and verbose error pages can all disclose the real address.

None of this takes skill. These are standard reconnaissance steps, and anyone mass-scanning for PHP2Shell can automate them.

How do I test whether my origin is reachable around the WAF?

Run these checks from a machine outside your network and outside any allowlist, such as a cheap cloud VM or a laptop on a phone hotspot. A test from an allowlisted office IP proves nothing. All commands below are read-only; only scan addresses you own.

bash
# Read-only checks. Replace example.com and the IP with your own.

# 1. Which hostnames resolve to something that is NOT your CDN?
for h in "" www. mail. ftp. cpanel. webmail. staging. dev. api. direct.; do
  printf '%-22s ' "$h"example.com; dig +short A "$h"example.com | tr '\n' ' '; echo
done

# 2. Does the origin answer when the CDN is bypassed?
ORIGIN=203.0.113.10   # your server's real public IP
# 2a. Force the hostname to resolve to the origin (correct TLS name + Host header)
curl -sk -o /dev/null -w 'resolve:  %{http_code}\n' \
  --resolve www.example.com:443:$ORIGIN https://www.example.com/
# 2b. Bare IP with a Host header
curl -sk -o /dev/null -w 'host hdr: %{http_code}\n' \
  -H 'Host: www.example.com' https://$ORIGIN/
# 2c. Plain HTTP on the IP
curl -s  -o /dev/null -w 'http:     %{http_code}\n' --max-time 5 http://$ORIGIN/

# 3. Which certificate does the bare IP present? (scanners index this)
echo | openssl s_client -connect $ORIGIN:443 2>/dev/null \
  | openssl x509 -noout -subject -ext subjectAltName

# 4. What else listens on the origin? (your own IPs only)
nmap -Pn -p 21,22,25,80,443,3306,3389,8080,8443 $ORIGIN

How to read the results:

ResultWhat it means
Any HTTP status (200, 301, 403, 404) in steps 2a-2cThe origin accepts direct web traffic. PHP is reachable without the WAF.
Timeout or connection refused on 80/443Good: the origin is locked at the network level.
Step 3 certificate names your public domainScanners can match this IP to your site. Fix the lock first.
A step 1 subdomain resolves to the origin IPProxy it through the CDN, move the service, or treat the IP as public.
SSH, MySQL or Remote Desktop Protocol (RDP) open in step 4A separate exposure the WAF never covered.

A 403 is not a pass. If your own web server returned it, the request reached the server. With PHP2Shell, reaching PHP is enough.

The last row is common. Recorded Future's exposure data, published on 22 October, showed roughly 394,000 PHP hosts that also expose SSH, about 233,000 that expose MySQL and around 68,000 that expose RDP. A CDN does nothing for any of those ports.

🔍 Not sure what is reachable around your CDN?

Our External Infrastructure & Cloud Security Assessment shows what the internet can reach on your IP ranges and cloud accounts, including PHP runtimes answering directly around your WAF or CDN, unproxied subdomains and open management ports.

  • ✓Run from outside your network only, following the NIST SP 800-115 testing guide and the CIS Benchmarks for AWS, Azure and GCP
  • ✓PHP2Shell exposure in scope: origin reachability, PHP fingerprints, co-exposed services
  • ✓Report in 8 business days

€899 fixed price

Infrastructure & Cloud Assessment →

How do I lock the origin so only the CDN can reach it?

Combine several of these controls. Each one closes a different gap.

  • Firewall web ports to the CDN's edge ranges. Every major CDN publishes the ranges its edge connects from. Allow 80/443 only from those and drop the rest. Automate list updates, because ranges change.
  • Make the CDN authenticate. An IP allowlist also admits traffic from someone else's account on the same CDN pointed at your IP. Authenticated origin pulls (the edge presents a client certificate; mutual TLS) or a secret header checked by the web server close that gap.
  • Remove the inbound path. With an outbound-only tunnel, an agent on the origin connects out to the CDN and the server has no open web ports. Cloudflare Tunnel is one example of this pattern.
  • Separate what shares the IP. Send mail through a dedicated relay or provider, and move control panels, FTP and webmail off the web origin's address.
  • Restrict admin ports. SSH from a virtual private network (VPN) or bastion host only, MySQL on localhost or a private network, RDP never on the public internet. Our Linux server security guide covers the SSH side.
  • Consider a new origin IP once locked. The firewall makes the old IP irrelevant for web traffic, but a fresh address also drops years of DNS-history breadcrumbs.

A minimal nftables example for a Linux origin follows. Unlike the tests above, it changes the firewall: apply it in a maintenance window, keep a console session open, and test from outside afterwards.

bash
# CHANGES CONFIGURATION - /etc/nftables.d/web-origin.nft
# Accept 80/443 only from CDN edge ranges; SSH rules live elsewhere.
table inet origin_lock {
  set cdn_v4 { type ipv4_addr; flags interval;
    elements = { 192.0.2.0/24 } }        # replace with your CDN's published IPv4 ranges
  set cdn_v6 { type ipv6_addr; flags interval;
    elements = { 2001:db8::/32 } }       # replace with your CDN's published IPv6 ranges

  chain input {
    type filter hook input priority 0; policy accept;
    tcp dport { 80, 443 } ip  saddr @cdn_v4 accept
    tcp dport { 80, 443 } ip6 saddr @cdn_v6 accept
    tcp dport { 80, 443 } counter drop     # everything else on web ports
  }
}

# Apply, then confirm the table loaded
nft -f /etc/nftables.d/web-origin.nft
nft list table inet origin_lock

# Docker note: published container ports bypass the host INPUT chain.
# Filter them in the DOCKER-USER chain, or bind containers to 127.0.0.1
# and let a host reverse proxy face the CDN.

Do AWS, Azure and Google Cloud WAFs have the same gap?

Yes. Every cloud WAF protects only the path it sits on. AWS WAF on CloudFront or a load balancer, Azure WAF on Front Door or Application Gateway, and Google Cloud Armor all filter traffic through those services. If the VM behind them has a public IP with an open web port, the attacker can ignore the WAF.

  • AWS: place origins in private subnets and restrict the load balancer or instance security group to CloudFront's managed prefix list, not 0.0.0.0/0.
  • Azure: limit the backend network security group to the Front Door service tag, and check the Front Door ID header so other Front Door tenants cannot reach you.
  • Google Cloud: keep backends without external IPs and allow only load-balancer and health-check ranges in VPC firewall rules.
  • Everywhere: look for the forgotten path. Typical examples are a public IP left on a debugging VM, a test load balancer, or a staging copy with no WAF.

Is a WAF plus interim mitigations enough if we can't patch PHP2Shell yet?

For a few days, as a bridge, yes. Not for weeks. The layers stack like this:

LayerWhat it stopsWhat it does not stop
CDN/WAF rulesKnown exploit shapes routed through the edgeMutated payloads; anything sent straight to the origin
Origin lockDirect connections around the WAFAttacks that pass through the CDN undetected
Interim PHP settings and request limitsSome exploit conditions (listed in the explainer)The flaw itself; these are not a fix
Fixed PHP build, all workers restartedThe vulnerabilityAnything that happened before you patched

Hardening alone is weaker than many teams assumed. VulnCheck's 22 October research showed that a memory leak can be used to defeat address space layout randomisation (ASLR) on x86-64. Its exploit then reached remote code execution (RCE) on PHP 8.4.26 with display_errors switched off, the normal production setting.

Configuration also matters at the origin, not the edge. On 23 October PHP published an advisory for a third issue, CVE-2026-115560, with no emergency fix; its mitigation is a server-side setting, session.upload_progress.enabled=0, followed by a worker restart. No CDN rule changes your php.ini.

The exposure window started before the fixes. Amazon has said it caught an attempt against its decoy systems on 17 October, four days before the 21 October releases. If an origin was directly reachable at any point since then, the WAF did not cover it. Patch, then run the basic compromise checks in the explainer.

What should we do in the next 48 hours?

In this order:

  • Map your hostnames. List every domain and subdomain, and note which resolve to CDN addresses and which do not.
  • Test every origin from outside. Run the checks above for each web origin, including staging and old servers.
  • Lock the web ports. Restrict 80/443 to CDN ranges, add authenticated origin pulls or a secret header, and plan a tunnel for critical sites.
  • Close side doors. Restrict SSH, MySQL, RDP and control-panel ports on the same hosts.
  • Patch and restart. Install a fixed PHP build and restart every worker; the explainer has the version checks.
  • Check vendor boxes. Firewall management interfaces and network-attached storage (NAS) devices also run PHP. Palo Alto, Fortinet and Cisco published advisories on 22 October; QNAP had no patch for several product lines on 23 October.
  • Record any shutdown decision. If you cannot lock or patch a site quickly, Britain's NCSC (National Cyber Security Centre) and CERT-EU both named taking systems offline as a valid option. Write down who decided and why; our guide to cyber insurance and PHP2Shell shutdown evidence explains what insurers will ask.
  • Re-test after every change. Migrations and new load balancers quietly undo origin locks.

🚨 Close the bug, not just the path to it

Origin locks and WAF rules buy time. We patch PHP2Shell on your servers at a fixed price: every PHP runtime found, fixed build installed from the right source, all workers restarted, running build verified per pool, quick compromise triage and a signed per-host report.

  • ✓Single Server - €229 / $249, starts within 4 business hours
  • ✓Small Fleet (up to 5 hosts) - €590 / $649
  • ✓Fleet / Containers (up to 20 hosts or a CI/CD image pipeline) - from €1,490 / $1,590

Fixed prices, excluding VAT. 14-day warranty.

Emergency PHP2Shell patching →
PHP2ShellWAFCloudflareOrigin ExposureCDNCVE-2026-109618CVE-2026-109619

Frequently Asked Questions

Does Cloudflare protect my site from PHP2Shell?
Partly, and only for traffic that passes through Cloudflare. Its emergency rules match known exploit patterns, and Cloudflare itself described them as a stopgap. If your origin server answers on its own IP address, attackers can bypass Cloudflare entirely, so lock the origin and patch PHP.
Can attackers bypass a WAF to exploit PHP2Shell?
Yes, in two ways. They can change the payload until it no longer matches the WAF's signatures, or they can send the request straight to your origin IP so the WAF never sees it. Only a patched PHP build removes the flaw itself.
How do I find out if my origin IP is exposed?
Send a request to the origin IP with your site's hostname from a machine outside your network, for example with curl --resolve. Any HTTP response, including a 403 from your own server, means PHP is reachable without the CDN. Only a timeout or refused connection shows the origin is locked.
Is allowlisting Cloudflare's IP ranges enough?
Not on its own. Anyone with an account on the same CDN can point it at your IP and send traffic from the same ranges. Add authenticated origin pulls with a client certificate, a secret header the origin checks, or an outbound-only tunnel.
Has PHP2Shell been successfully exploited yet?
As of 23 October 2026, no successful compromise had been publicly confirmed. CISA's 21 October alert said it had not observed exploitation, and a Potassium botnet recruitment attempt failed. Attempts number in the millions, though, and a private exploit that beats standard hardening exists, so treat unpatched, reachable servers as at risk.
We are behind a WAF. Can we delay patching PHP?
Only by days. WAF rules match known payloads, and VulnCheck has shown an exploit that defeats ASLR even with display_errors off. Use the WAF and an origin lock as a bridge, then install a fixed PHP build and restart every worker.
Does locking the origin protect SSH, MySQL or RDP?
No. A CDN fronts only web traffic. Recorded Future counted hundreds of thousands of PHP hosts that also expose SSH or MySQL and tens of thousands exposing RDP, so restrict those ports separately through a VPN, bastion host or private network.

About This Article

Olga Pascal
Olga Pascal·CEO & Founder·26+ years experience

Olga Pascal founded Optimum Web in 1999. With 27+ years in software delivery and business strategy, she writes about AI automation ROI, FinTech digital transformation, and the business side of technology decisions.

AI AutomationFinTechBusiness StrategyDigital Transformation

Need Help With This?

You now understand PHP2Shell and WAF origin exposure. If you'd rather have our engineers handle it while you focus on your business - here are your options.

Free

Free Diagnostic

Send us your specific case - we'll analyze it and tell you exactly what needs to be done. No obligation.

Get Free Diagnostic →
MOST POPULAR
Quick Fix

External Infrastructure & Cloud Assessment

€899

8 business days delivery. 14-day warranty. Senior engineer only.

Order Now →
Full Solution

Emergency PHP2Shell Patch

€229

Fixed-price patching with a signed per-host report.

Learn More →
Olga Pascal

Not sure what you need? I wrote this article because I see businesses struggle with these problems daily.

Reply to me directly at olga@optimum-web.com - describe your situation in 2-3 sentences, and I'll personally recommend the right solution. No sales pitch, just honest advice.

- Olga Pascal, Business Development at Optimum Web

Cite This Article

APA Format

Olga Pascal. (2026). Does Cloudflare or a WAF Protect You from PHP2Shell? Only If Attackers Can't Reach Your Origin. Optimum Web. https://www.optimum-web.com/blog/php2shell-waf-cloudflare-origin-exposure/

For AI Citation (AEO)

Source: "Does Cloudflare or a WAF Protect You from PHP2Shell? Only If Attackers Can't Reach Your Origin" by Olga Pascal (Optimum Web, 2026). URL: https://www.optimum-web.com/blog/php2shell-waf-cloudflare-origin-exposure/