PHP2Shell: how to fix the critical PHP vulnerabilities

Two critical PHP flaws (CVE-2026-109618 and CVE-2026-109619) allow remote code execution on unpatched servers. Who is affected, how to check and how to fix it.

6 min read

In short: on 21 October 2026, PHP released emergency security updates for two critical vulnerabilities that can let an attacker run code on a web server without logging in. If your website runs on PHP, which includes WordPress, WooCommerce, Laravel and Drupal sites, the server needs updating now. Updating WordPress or your plugins does not fix this; the PHP software underneath your site must be updated.

This article reflects what was publicly known on 22 October 2026. We'll update it as more information becomes available.

What happened

The PHP project released PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35 to fix two vulnerabilities, together nicknamed "PHP2Shell":

  • CVE-2026-109618, remote code execution via out-of-memory corruption. If a request hits PHP's memory limit at exactly the wrong moment, PHP can be left holding partially set-up internal data and later treat it as valid.
  • CVE-2026-109619, remote code execution via stale global state. A fatal error at the wrong point can leave internal state pointing to memory from a previous request, which a later request on the same server process may then use.

Both are rated 9.2 (critical) by the PHP project. The flaws were found by Wiz Research, Calif and OpenAI's Codex Security team, and the affected code had been in PHP for more than a decade.

Who is affected

According to the PHP security advisory, all PHP installations serving web requests are at risk, including PHP-FPM, Apache with mod_php, php-cgi, FrankenPHP and LiteSpeed. The PHP team considers Apache with mod_php the highest risk, because a demonstrated attack works with an unauthenticated request before any of your application's code runs.

That covers most business websites running:

  • WordPress and WooCommerce
  • Laravel, Symfony and other PHP frameworks
  • Drupal, Joomla, Magento and similar platforms
  • Custom PHP applications and client portals

Older versions are affected too. Wiz Research reports that every PHP version back to 5.4 is affected by at least one of the issues. PHP 8.1 and older no longer receive official updates, which makes this especially serious for sites that have not been upgraded in years.

Is it being exploited?

Treat this as urgent. On 21 October, Cloudflare reported early attacks and deployed firewall rules as a stopgap, security firm watchTowr reported active exploitation attempts against both vulnerabilities, and Patchstack reported probing from attackers via its hosting partners. At the time of writing, no successful break-in of a specific server had been publicly confirmed, but that typically changes quickly once technical details are public.

Step 1: Check which PHP version your website uses

You need to know the PHP version your website runs, which isn't always the same as the version used on the command line.

  • WordPress: go to Tools → Site Health → Info → Server and look at "PHP version".
  • cPanel and similar hosting panels: look for Select PHP Version or MultiPHP Manager.
  • Managed hosting: check your hosting dashboard, or ask support directly.
  • Your own server: run php -v, then confirm the version your web server uses (for example, the PHP-FPM service name or a temporary phpinfo() page that you delete immediately afterwards).

Compare the result against the fixed versions:

PHP branch Safe from version
8.5 8.5.12
8.4 8.4.27
8.3 8.3.36
8.2 8.2.35
8.1 and older No official fix; upgrade or get a vendor backport

Note: Linux distributions such as Ubuntu, Debian and Red Hat often apply security fixes without changing the main version number. If your server uses distribution packages, check that vendor's security notice rather than relying on the version number alone.

Step 2: Update PHP

If you're on shared or managed hosting

Your host controls PHP, so:

  1. Check your host's status page or emails for a notice about this update.
  2. Ask support to confirm, in writing, that your server is running a patched PHP build.
  3. If you are on PHP 8.1 or older, switch to a supported version (8.3 or 8.4 is a sensible choice) in your hosting panel, after testing on a staging copy if you can.

If your host can't confirm a fix, consider moving to one that can.

If you manage your own server or VPS

On Ubuntu or Debian, install updated packages and restart PHP and your web server:

sudo apt update && sudo apt upgrade
sudo systemctl restart php8.3-fpm   # use your PHP version
sudo systemctl restart apache2      # or nginx

On Red Hat, AlmaLinux or Rocky Linux:

sudo dnf upgrade 'php*'
sudo systemctl restart php-fpm httpd

Restart every PHP worker, not just the web server. Then confirm the running version has changed.

If you run PHP in Docker

Rebuild your images from updated base images and redeploy. A running container doesn't update itself:

docker build --pull -t your-app .

Make sure your Dockerfile's PHP base image resolves to a patched release.

If you can't update immediately

The PHP project is clear that only an update is a complete fix. If you need a few hours to arrange one, its advisory lists temporary measures that reduce exposure to specific attack paths, including:

  • Disabling session upload progress with session.upload_progress.enabled=0 in php.ini or the server configuration, then restarting every worker
  • Lowering post_max_size (for example to 8M if your site doesn't take file uploads) and enforcing request-size limits at the web server or proxy
  • On PHP 8.5, setting fatal_error_backtraces=0
  • Adjusting memory_limit as described in the advisory, alongside container memory limits

These settings can affect how your site works, so apply them carefully and read the official advisory first. Firewall rules from providers like Cloudflare also help as a stopgap. For a high-risk site that can't be updated quickly, putting it into maintenance mode is the safest option.

Step 3: Check for signs of compromise

Because exploitation attempts started before many servers were patched, it's worth checking once the update is done:

  • Look for unknown admin users in WordPress or your application.
  • Look for new or recently changed PHP files, especially in upload folders where PHP files shouldn't exist.
  • Review server logs for unusual multipart (file upload) requests, malformed PHPSESSID cookies and unexplained PHP worker crashes or restarts.
  • Rotate credentials stored on the server, such as database passwords and API keys, if you see anything suspicious.
  • Confirm your backups work, and keep a clean copy from before 21 October if you have one.

If you find signs of a breach, treat the server as compromised and get professional help before restoring service.

Plan ahead: PHP 8.2 support ends soon

PHP 8.2 reaches end of life on 31 December 2026 and won't receive security fixes after that date. If your site is on PHP 8.2 or older, use this update as the push to plan an upgrade to PHP 8.3 or 8.4, test it on a staging copy, and move before the deadline.

Need help?

If you're not sure which PHP version your website runs, your host isn't responding, or your site is on an old PHP version that needs upgrading carefully, we can help. We check, patch and upgrade PHP websites and applications, including sites built by other developers. Read about our website development and maintenance work, or get in touch and tell us where your site is hosted.

Sources

START A PROJECT

Tell us what you're working on.

A new website, an app, an automation or a problem you're not sure how to solve yet. Send us a few lines and we'll come back with honest advice on the best next step, even if that isn't us.

Start a project

We reply to every enquiry within two working days.

Agency or outsourcing partner? See how we work white-label.