Patching

PHP2Shell: CVE-2026-109618 and CVE-2026-109619

Two remote code execution bugs in PHP itself, not in a framework or a plugin, and no login needed. If a server runs PHP for a website, this is the update to install today.

The short answer

Update to PHP 8.5.12, 8.4.27, 8.3.36 or 8.2.35, or to your distribution's patched package, and restart every PHP-FPM pool. Both bugs are rated CVSS v4.0 9.2 and let an unauthenticated attacker run code on the server. The PHP security team says there is no complete mitigation. PHP 8.1 and older get no official release.

What the two bugs are

CVE-2026-109618, RCE via out-of-memory corruption. When PHP runs out of memory at the wrong moment, request data can be left half initialised, and cleanup then treats it as valid. An attacker who can push a request into that state can corrupt memory.

CVE-2026-109619, RCE via stale global state. Some state that belongs to one request stays in a global after the request's memory is freed. The next request on the same worker can use it before normal initialisation resets it, which is a use after free. The advisory confirms two paths: early INI diagnostics and session upload progress, which is on by default and does not need the application to call session_start().

Ubuntu ships fixes for its packages as far back as PHP 5, so treat every version you run as affected. watchTowr, which published an FAQ the same day, reports exploitation in the wild. The PHP project's own announcement does not say that, so treat it as reported rather than confirmed.

Where the fix is

SourceFixed versionNotes
PHP upstream8.5.12, 8.4.27, 8.3.36, 8.2.35Source and Windows builds on php.net
Debian 13 trixiephp8.4 8.4.27-1~deb13u1DSA-6574-1, trixie-security
Debian 12 bookwormphp8.2 8.2.35-1~deb12u1DLA-4848-1, through Debian LTS
Ubuntu 26.04 LTSphp8.5 8.5.4-0ubuntu1.5Ubuntu security pocket
Ubuntu 24.04 LTSphp8.3 8.3.6-0ubuntu0.24.04.13Ubuntu security pocket
Ubuntu 22.04 LTSphp8.1 8.1.2-1ubuntu2.28Ubuntu security pocket
Official Docker imagesphp:8.5, php:8.4 and the point tagsRebuilt 21 October 2026; your own images still need a rebuild

If you use the volunteer-run Remi repository, the PHP team said it would not have updates on release day and recommended distribution packages or a source build instead.

Check what you are running

# Which PHP is the web server actually running? The CLI can differ from FPM.
php -v
php-fpm8.4 -v                       # Debian/Ubuntu, adjust the version
dpkg -l 'php*-common' | awk '/^ii/ {print $2, $3}'
rpm -q php-common                   # RHEL family

# Is the risky default still on? (CVE-2026-109619 mitigation)
php -i | grep session.upload_progress.enabled

Check the FPM binary or the package version, not only php -v. On servers with several PHP versions installed side by side, the CLI is often not the one serving the site.

Update and restart

# Debian / Ubuntu
sudo apt update && sudo apt install --only-upgrade 'php8.*'
sudo systemctl restart php8.4-fpm   # every FPM version you run
sudo systemctl reload apache2       # if you use mod_php

# RHEL family
sudo dnf upgrade 'php*'
sudo systemctl restart php-fpm httpd

A package upgrade alone is not enough. Old FPM workers keep the vulnerable code in memory until they restart. In containers, pull the new base image and rebuild. A running container does not change because the tag on Docker Hub moved.

If you cannot update today

The PHP security team published stopgaps that close the confirmed attack paths. They are explicit that these reduce exposure and do not make a server safe:

; Stopgaps only, from the PHP security team. Not a fix.
; Put these in php.ini or the FPM pool (php_admin_value), not ini_set() or .user.ini
session.upload_progress.enabled = 0
post_max_size = 8M        ; 32M if the site takes uploads
; PHP 8.5 only:
fatal_error_backtraces = 0

Restart every worker after changing them. The team also suggests limiting request size, field count and multipart parts at the web server or proxy, and using a container or cgroup memory limit rather than RLIMIT_AS or RLIMIT_DATA, which can trigger the vulnerable allocation failure. Setting memory_limit=-1 removes the PHP-level memory limit failure for CVE-2026-109618, but an underlying allocation failure can still reach the bug.

Gotchas

How this was checked. On 21 October 2026 we read the PHP security announcement and the two GitHub advisories, the Debian security tracker entries for both CVEs, and Ubuntu's CVE page. We confirmed the Docker Hub update times for the php:8.5 and php:8.4 tags through the Docker Hub API. Not tested: the vulnerabilities themselves. We did not try to reproduce either bug.

Sources

  1. PHP News Archive 2026, PHP project, security announcement and release notes, 21 October 2026
  2. GHSA-w8hw-w9fx-j79w: RCE via OOM corruption, php/php-src
  3. GHSA-6wmf-4rv5-p3rp: RCE via stale global state, php/php-src
  4. CVE-2026-109618 and CVE-2026-109619, Debian security tracker
  5. CVE-2026-109618, Ubuntu security
  6. PHP Remote Code Execution FAQ, watchTowr

Questions

What is PHP2Shell?

PHP2Shell is the name used for two critical PHP vulnerabilities disclosed on 21 October 2026. CVE-2026-109618 is remote code execution through out-of-memory handling that leaves request data partly initialised. CVE-2026-109619 is remote code execution through global state that survives after its memory is freed and is then used by the next request on the same worker. Both are rated CVSS v4.0 9.2 and need no authentication.

Which PHP versions fix CVE-2026-109618 and CVE-2026-109619?

PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35. PHP 8.1 and older get no releases from the PHP project, although the security team published minimal source backports for 7.4, 8.0 and 8.1. Distribution packages carry the fix under their own version numbers, for example 8.4.27-1~deb13u1 on Debian 13 and 8.3.6-0ubuntu0.24.04.13 on Ubuntu 24.04.

Can I mitigate PHP2Shell without updating?

Only partly. The PHP security team lists stopgaps such as session.upload_progress.enabled=0, a low post_max_size and, on PHP 8.5, fatal_error_backtraces=0, but says they block specific attack paths and do not make an installation safe. Updating is the only complete fix.

Do I need to restart PHP-FPM after updating?

Yes. Running FPM workers keep the old code in memory until they restart. Restart every FPM service and reload Apache if it runs mod_php, then confirm the version the web server reports, not only the CLI.

Not sure which PHP your servers run?

The free review lists every PHP version and pool on your servers and how each one gets patched. Pricing.

Free server review