1. Home
  2. Insights
,

PHP2Shell Vulnerability: How to Protect Your WordPress Website

What the October 2026 PHP2Shell vulnerability means for WordPress, which PHP versions are fixed, and the steps to secure your site, hosting and server.

Rows of server racks in a data center, the kind of hosting infrastructure that runs PHP

On 21 October 2026 the PHP project released emergency security updates for two critical flaws in PHP itself, tracked as CVE-2026-109618 and CVE-2026-109619 and widely known as PHP2Shell. Both are rated 9.2 (CVSS v4.0) and can let an attacker run code on a web server without logging in to anything.

Because WordPress runs on PHP, this affects almost every WordPress site. But the fix isn’t in your WordPress dashboard, and that’s what catches people out. Here’s what PHP2Shell is, which versions are patched, and what I’d check on any WordPress site right now.

The short version

  • The flaw is in PHP, not WordPress. Updating WordPress or a security plugin does not fix it.
  • You need PHP 8.5.12, 8.4.27, 8.3.36 or 8.2.35 or later, or a vendor-patched build if you’re on something older.
  • On shared or managed hosting, your host applies the patch. Ask them to confirm it.
  • A WAF such as Cloudflare’s helps, but it’s an extra layer, not a replacement for the patch.

What is the PHP2Shell vulnerability?

PHP2Shell is the name for two memory-safety bugs in how PHP cleans up after something goes wrong while it handles an HTTP request. According to the PHP security advisory:

  • CVE-2026-109618, “RCE via OOM corruption”: when PHP runs out of memory part-way through a request, it can later use internal data that was never properly set up (GHSA-w8hw-w9fx-j79w).
  • CVE-2026-109619, “RCE via stale global state”: after a fatal error, PHP can keep references to memory that has already been released (GHSA-6wmf-4rv5-p3rp).

An attacker triggers these with specially crafted requests. Depending on the server, the result can be a crashed PHP process, leaked memory (which can include passwords, tokens and API keys), or code running with the permissions of the PHP worker.

The PHP project says all PHP installations serving web requests are at risk, including PHP-FPM, Apache with mod_php, php-cgi, FrankenPHP and LiteSpeed. It rates mod_php highest, with a demonstrated exploit where an unauthenticated request triggers the attack before any application code runs. Cloudflare reports that the bugs affect PHP 5.4 and later, and that it saw real attack traffic, including attempts to get around its rules.

Why WordPress updates and security plugins don’t fix it

Most WordPress security problems live in a plugin or theme, so the usual advice is “update everything”. PHP2Shell is different. The bug sits in the PHP engine underneath WordPress, and it can be triggered before WordPress, or any security plugin, has loaded.

So a fully updated WordPress site with Wordfence or a similar plugin can still be exposed if the server’s PHP isn’t patched. WordPress auto-updates don’t touch the PHP version either. That’s set by your host or server administrator.

If an attacker does get in, the usual consequences follow: injected code, new admin accounts, spam or malware served from your domain, redirects to scam sites, and access to anything else in the same hosting account. How bad it gets depends on how the server is set up and how well accounts are isolated.

Which PHP versions are fixed?

PHP branchFixed in
PHP 8.58.5.12 or later
PHP 8.48.4.27 or later
PHP 8.38.3.36 or later
PHP 8.28.2.35 or later
PHP 8.1, 8.0, 7.4No official release. The PHP team published minimal source backports for vendors; check with your host or Linux distribution
Source: php.net security advisory, 21 October 2026.

PHP 8.1 and older are end-of-life, so the PHP project doesn’t ship new releases for them. Some hosts and Linux distributions apply the backported fixes to their own builds, which means an old version number doesn’t automatically mean you’re unpatched, and a new-looking one doesn’t automatically mean you’re safe. Confirm the patch status, not just the number.

If you’re still on 8.1 or below, this is a good moment to plan a move to a supported version. Test it on a staging copy first: older plugins and themes are the usual reason a PHP upgrade breaks a site.

How to check your site’s PHP version

  1. In WordPress, go to Tools > Site Health > Info and open the Server section. It shows the PHP version your site is actually running.
  2. In your hosting panel (hPanel, cPanel, Plesk and similar), look for a PHP configuration or PHP version page.
  3. On a server you manage, run php -v, but remember the command-line PHP can differ from the one serving web requests. Check the PHP-FPM, LiteSpeed (lsphp) or Apache module version too.

7 steps to protect your WordPress website

1. Get the PHP patch confirmed by your host

This comes first. On shared and managed WordPress hosting you can’t patch PHP yourself; the host does it for every site on the server. Many hosts patched quickly (the PHP project gave Linux distributions and long-term support vendors the fixes in advance), but don’t assume. Ask support:

  • Is the PHP serving my site patched for CVE-2026-109618 and CVE-2026-109619?
  • Have the PHP workers been restarted since the update?
  • If my site runs an older PHP version, does your build include the backported fixes?

On a VPS, dedicated server or cloud setup, the update is yours or your server administrator’s: update the PHP packages, then restart PHP-FPM, Apache or LiteSpeed so the old processes are replaced. For containers, rebuild the image and redeploy, because running containers keep the old PHP until they’re replaced.

2. If you can’t patch yet, apply the official mitigations

For servers that can’t be updated straight away, the PHP advisory lists temporary measures. They reduce the risk; they don’t remove it:

  • Set memory_limit=-1 through php_admin_value, and use cgroup limits to cap memory at the system level instead
  • Keep post_max_size low (8M, or 32M if the site needs uploads) and set request size limits in the web server
  • Set session.upload_progress.enabled=0 and restart the PHP workers
  • On PHP 8.5, set fatal_error_backtraces=0

These are server-level settings. On shared hosting, leave them to your host. Lowering upload limits can also break media uploads, imports and form attachments, so test after any change.

One more thing worth knowing: on 23 October the PHP project published a separate advisory for a related flaw, CVE-2026-115560, in the session upload progress feature. It affects even the patched releases above and will be fixed in PHP’s next regular release. Disabling session.upload_progress, from the list above, is the relevant mitigation, and very few WordPress sites rely on that feature.

3. Put a web application firewall in front of the site

A WAF filters malicious requests before they reach your server. Cloudflare deployed managed rules for PHP2Shell about nine hours before public disclosure, and they’re switched on by default for all plans with WAF, including Free. Many hosts and managed WordPress platforms added their own server-level rules too. I explain how to set up Cloudflare and a CAPTCHA properly in this guide to stopping website bots.

Cloudflare itself says to patch anyway. Attackers were already changing their payloads to slip past the rules, and a WAF only protects traffic that actually goes through it. If your server’s IP is public, requests can bypass Cloudflare entirely unless the origin only accepts Cloudflare traffic.

4. Update WordPress core, themes and plugins anyway

This doesn’t fix PHP2Shell, but a compromised server is often followed by attackers using every other weakness they can find. Update core, themes and plugins, including WooCommerce, and any other PHP apps in the same hosting account. Delete themes and plugins you don’t use, especially abandoned ones. Take a backup first, and test larger updates on staging.

5. Lock down admin accounts and secrets

Because PHP2Shell can leak worker memory, credentials that passed through PHP are worth treating with suspicion if your server was unpatched for a while. Turn on two-factor authentication for administrators, remove accounts that no longer need access, and give each user the lowest role that works.

If there’s any sign of compromise, go further: rotate the database password and the keys and salts in wp-config.php, and regenerate API keys for payment gateways, SMTP, CRMs and other services stored on the site. Changing WordPress passwords alone won’t remove a backdoor.

6. Make sure you have a backup you can actually restore

Back up the files and the database, and keep at least one copy outside the hosting account. If an attacker gets into the account, backups stored next to the site can be deleted or tampered with. Test a restore now and then. And if you ever do restore after an incident, patch the server first, or you’ll be restoring onto the same hole.

7. Look for signs of compromise

If your site ran unpatched PHP after the flaws became public, a quick review is sensible. Look for:

  • PHP files in wp-content/uploads, which should only hold media
  • Core, theme or plugin files modified recently without an update to explain it
  • Admin users you don’t recognise
  • Unfamiliar cron jobs, in WordPress or in the hosting panel
  • Spikes of large POST requests, PHP crashes or memory errors in the server logs

None of these proves PHP2Shell was used, and each can have an innocent explanation. A malware scan plus a file integrity check (Wordfence does both, and WP-CLI’s wp core verify-checksums checks core files) is a good start. If you find real evidence, bring in your host or an incident-response specialist before cleaning up, so you don’t destroy what shows how they got in.

What to do on each type of hosting

Shared hosting: your host patches PHP for the whole server. Confirm with support, check Site Health for your version, and switch to a supported PHP branch in the panel if you’re on an old one.

Managed WordPress hosting: look for the host’s security notice. Most managed platforms patch centrally and add firewall rules; follow their guidance rather than changing server settings yourself.

VPS or dedicated server: you, or whoever manages the server, update PHP and restart every PHP service. Check each PHP version installed, not just the default one; control panels often run several side by side.

Containers and cloud: update the base image, rebuild, redeploy and confirm the running workloads report a fixed version.

PHP2Shell checklist for website owners

  • Host has confirmed the PHP serving the site is patched
  • Site Health shows PHP 8.2.35, 8.3.36, 8.4.27, 8.5.12 or later (or a confirmed vendor-patched build)
  • Mitigations applied on any server that can’t be patched yet, including disabling session upload progress
  • WAF switched on, and the origin not reachable around it
  • WordPress core, themes and plugins updated; unused ones removed
  • Two-factor authentication on every admin account
  • Off-site backup taken and a restore tested
  • Uploads folder, admin users and logs reviewed for anything unexpected

Sources

Frequently asked questions

What is PHP2Shell?

PHP2Shell is the name for two critical remote code execution vulnerabilities in PHP, CVE-2026-109618 and CVE-2026-109619, disclosed on 21 October 2026. They’re memory-safety bugs in how PHP handles errors during a request, and both are rated CVSS 9.2.

Is my WordPress site affected by PHP2Shell?

If it runs on PHP older than 8.2.35, 8.3.36, 8.4.27 or 8.5.12 without a vendor patch, it may be. Check the version under Tools > Site Health > Info > Server, then ask your host to confirm the patch.

Does updating WordPress fix PHP2Shell?

No. The flaw is in the PHP engine, which your host or server administrator updates. WordPress updates are still worth doing, but they don’t change the PHP version.

Can a security plugin like Wordfence protect against PHP2Shell?

Not on its own. The attack can happen before WordPress and its plugins load. A security plugin is still useful for spotting malware and file changes afterwards.

Does Cloudflare protect against PHP2Shell?

Cloudflare deployed WAF rules for known PHP2Shell exploits on all plans, including Free. It reduces the risk for traffic that passes through Cloudflare, but Cloudflare still recommends patching PHP.

I’m on PHP 8.1 or older. What should I do?

Ask your host whether their build includes the backported fixes, and plan an upgrade to a supported PHP version. Test the upgrade on a staging copy first, because old plugins and themes may not be compatible.

Need a hand checking your site?

I look after WordPress sites for agencies and businesses: safe updates, PHP upgrades tested on staging, security checks and clean-ups, and talking to the host when the problem is on their side. See how my WordPress maintenance and support works or get in touch.

This article is general information, not a security assessment of your server. Patch status and the right mitigations depend on your hosting platform.

Next step

Got a project to hand over?

Send the brief and I’ll reply within one working day with questions or a quote.