Skip to content

Patching PHP2Shell on Debian, Ubuntu, Docker, cPanel and Plesk, and proving the fix is running

What CVE-2026-109618 and CVE-2026-109619 are, how to patch Debian, Ubuntu, Docker, cPanel and Plesk, and how to check the PHP that is actually serving requests.

Key takeaways

  • Both bugs are in the PHP engine: out-of-memory handling that leaves request memory half built, and state that outlives the request that owns it.
  • Patch, then restart every PHP process that serves the web. A package on disk does not replace code already loaded in running workers.
  • Check the PHP the web server runs, not the command-line binary. Distribution and panel backports can keep an old version number.
  • Scan from outside before and after, and check every finding against the installed build.
  • PHP 8.1 and older get no release from PHP. A backported fix is a stopgap, not support.
Sections
  1. What shipped, and when
  2. The two bugs, from the advisories
  3. Who is exposed
  4. Debian and Ubuntu packages
  5. sury.org and ondrej/php
  6. Official Docker images
  7. cPanel: EasyApache 4 and MultiPHP
  8. Plesk
  9. Managed hosts and platforms
  10. Restart, then check what is actually running
  11. Scan from outside, before and after
  12. Dependencies: composer audit
  13. Move off end-of-life branches
  14. If you cannot patch today
  15. Watch for attempts

What shipped, and when

On 21 October 2026 PHP released 8.5.12, 8.4.27, 8.3.36 and 8.2.35 to fix two critical bugs in the engine, now known together as PHP2Shell. The release came a day earlier than planned: the CVE IDs began circulating online on 20 October, and PHP brought its announcement forward. The owner's view, how to find your version and what to ask your host, is in our PHP2Shell guide for site owners. This post is the engineer's checklist.

The two bugs, from the advisories

Both are rated CVSS v4.0 9.2, both are classed as use after free (CWE-416), and neither needs authentication. What follows stays at the level of the official advisories.

CVE-2026-109618, RCE via OOM corruption (GHSA-w8hw-w9fx-j79w). PHP uses longjmp() to abort a request when it runs out of memory. In some contexts request memory is reachable before it is fully initialised, and if an allocation fails at that point, request shutdown can read or branch on invalid state. The advisory lists multipart parsing problems that let a request run out of memory while staying within its apparent limits. Under Apache mod_php, shutdown runs even when request startup failed, so this happens "entirely before any application-specific code begins execution". FPM exits the child when startup fails, but running out of memory later in a request can still reach the bug. The advisory says source analysis "supports FPM as susceptible, though no complete FPM exploit has been demonstrated for this SAPI", and the PHP Foundation's post adds that remote code execution "was also confirmed on PHP-FPM through application-level code paths".

CVE-2026-109619, RCE via stale global state (GHSA-6wmf-4rv5-p3rp). A worker keeps global state, such as error, session, object and extension state, that points into memory owned by one request. A fatal error, including running out of memory, can skip the reset, the request heap is freed, and an operation early in a later request on the same worker can use the stale value. The advisory confirms two paths: fatal error backtraces on PHP 8.5, and session upload progress, which "is enabled by default, and no application call to session_start() is required". The session path was validated against both mod_php and FPM.

The fix. The patch removes longjmp() for out-of-memory, replacing it with a graceful soft limit at the next VM safe point and an immediate _exit() at a second, higher threshold, and it resets the wider request state between requests. The first advisory calls updating "the only complete mitigation", the second "the only reliable mitigation".

Write-ups label the bugs differently. Wiz, one of the reporters, describes four bugs and groups them under the two IDs in its own way. For patching it makes no difference: Wiz says the patched release "eliminates all variants".

A third ID. On 23 October PHP published an informational advisory for CVE-2026-115560, an unlikely combination of configuration and application code that the 21 October releases do not fix. Until the next regular release, PHP suggests session.upload_progress.enabled=0.

Who is exposed

  • Every web SAPI. PHP names "all PHP installations serving web requests", including PHP-FPM, Apache with mod_php, php-cgi, FrankenPHP and LiteSpeed, and rates mod_php highest.
  • Every version before the fixed four. Google Cloud's post gives the range as "All versions of PHP from 5.4 through 8.5.11", and watchTowr says it confirmed that PHP 5 is affected.
  • Copies you forget about. CISA notes that PHP "is often a component of other software". Control panels, webmail, appliances and container images carry their own PHP. cPanel patched the internal PHP behind its own interfaces, including Roundcube webmail, separately from the PHP that serves sites, and Plesk's panel engine needed its own update.
  • Exploitation. CISA added both IDs to its Known Exploited Vulnerabilities catalog on 26 October. watchTowr reports exploitation through its honeypots since 21 October. Wiz, writing on 27 October, had seen a limited number of attempts in its telemetry, none of which had succeeded. Patch as if it is being used.

Debian and Ubuntu packages

PHP gave the distributions the patches ahead of the release. Their fixed packages carry the distribution's own version numbers:

ReleasePackageFixed version (or later)
Debian 12 (bookworm)php8.28.2.35-1~deb12u1 (DLA-4848-1)
Debian 13 (trixie)php8.48.4.27-1~deb13u1 (DSA-6574-1)
Ubuntu 26.04 LTSphp8.58.5.4-0ubuntu1.5
Ubuntu 24.04 LTSphp8.38.3.6-0ubuntu0.24.04.13
Ubuntu 22.04 LTSphp8.18.1.2-1ubuntu2.28

Ubuntu 20.04 and older have fixes through Ubuntu Pro. On Ubuntu the upstream part of the number does not move (24.04's fixed package still starts 8.3.6), so compare the full package version, or look for the CVE in the package change log, as Google's guidance suggests.

Debian or Ubuntuupdate, then confirm the installed packages for your release
sudo apt update
sudo apt upgrade
# The branch your release ships: php8.2 on Debian 12, php8.4 on Debian 13,
# php8.3 on Ubuntu 24.04 (php8.1 on 22.04, php8.5 on 26.04)
V=8.2
apt-cache policy php$V-fpm libapache2-mod-php$V   # compare with the table
apt-get changelog php$V-fpm | grep -m1 CVE-2026-109618

Check php$V-fpm if the site runs on PHP-FPM and libapache2-mod-php$V if Apache loads mod_php; both come from the same source package.

sury.org and ondrej/php

Many servers take PHP from Ondřej Surý's repositories instead: ppa:ondrej/php on Ubuntu and packages.sury.org/php on Debian, which let several PHP versions run side by side. He has packaged PHP for Debian since PHP 5, and his packages carry PHP's own version numbers: on 21 October the PPA published 8.2.35, 8.3.36, 8.4.27 and 8.5.12 for Ubuntu 24.04. Here the upstream number is the check. The PPA is being merged into packages.sury.org, which is already the canonical source for Ubuntu 26.04.

sury or ondrej/phpeach installed branch has its own FPM binary, in /usr/sbin
sudo apt update && sudo apt upgrade
sudo php-fpm8.3 -v                        # 8.3.36 or later
sudo php-fpm8.2 -v                        # and so on for every branch installed
apt-cache policy libapache2-mod-php8.3    # if Apache loads mod_php

These read the binaries on disk. Restart, then check the running version (below).

Official Docker images

Docker's official php image has fixed tags for every supported branch: 8.5.12, 8.4.27, 8.3.36 and 8.2.35, each with its -fpm, -apache and -cli variants. There is no fixed 8.1 tag; the 8.1 tags were last updated on 2 January 2026. A running container never patches itself. As Google puts it, container images you build yourself are your responsibility: rebuild from the new base and redeploy.

Dockerfilethe minor tag follows each new patch release
FROM php:8.3-fpm
rebuild--pull fetches the new base even when an old one is cached
docker build --pull -t my-app .
docker run --rm my-app php -v     # 8.3.36 or later

The minor tag points at the newest patch release of its branch (today 8.3-fpm is the same image as 8.3.36-fpm) and will move to PHP's next patch release when that ships. That matters here: the related CVE-2026-115560 (above) is only fixed in the next regular release, so rebuild again when it ships. The php -v check reads the new image; after you redeploy, check the running service with the version file below.

If you build on another base image, check that vendor's advisory. NCSC-NL's php2shell repository tracks the status of more than 900 products, images among them.

cPanel: EasyApache 4 and MultiPHP

  • Site PHP. EasyApache 4 25.91, released on 21 October, "fixes two critical PHP vulnerabilities (CVE-2026-109618 and CVE-2026-109619) in ea-php74 through ea-php85". PHP made no new 7.4, 8.0 or 8.1 release, and 25.92 rebuilt the ea-php74, ea-php80 and ea-php81 meta packages so their change logs list the backport. On those, check the change log for the CVE, not the version.
  • cPanel's own PHP. The interfaces, including Roundcube webmail, run on a separate internal PHP that needed a cPanel & WHM update: 138.0.18, 136.0.50 and 134.0.66 include PHP 8.4.27, and 110.0.153 has backported fixes for PHP 8.1.34.
  • Every domain. In EasyApache 4 each domain can use any installed PHP version, so check each one in MultiPHP Manager, not only the system default. A domain left on ea-php74 is patched for this issue but is still end of life.

Plesk

Plesk ships PHP builds for hosted sites and a separate PHP engine for the panel itself, and both need updating.

  • Linux: 8.5.12, 8.4.27, 8.3.36 and 8.2.35 or later, plus fixed builds of 8.1.34, 8.0.30 and 7.4.33 that keep their numbers. Those are identified by a build date of 21 October 2026 or later.
  • Windows: 8.5.12, 8.4.27, 8.3.36 and 8.2.35 or later.
  • The panel's engine (sw-engine on Linux, plesk-engine on Windows): Plesk Obsidian 18.0.81 Update 4 or 18.0.80 Update 11.
Plesk on Linuxone binary per installed version
/opt/plesk/php/8.3/bin/php -v   # 8.3.36 or later, built 21 October 2026 or later

For PHP 5.6, 7.2 and 7.3, Plesk recommends paid extended support.

Managed hosts and platforms

If someone else runs PHP for you, the patch is theirs to apply, and the check is still worth doing. Google Cloud is a good example of how much it varies by product. App Engine standard on PHP 8.2 and newer was patched automatically. App Engine flexible apps had to be redeployed, and Cloud Run services built without automatic base image updates had to be rebuilt. Runtimes on PHP 8.1 and older were not patched at all. Read your provider's own advisory rather than assuming.

Restart, then check what is actually running

Google's guidance is direct: "Upgrading packages on disk leaves vulnerable libphp.so or php-fpm binaries resident in running worker processes." Restart the process that serves the web (php-fpm, Apache, FrankenPHP or LiteSpeed), including workers run under a supervisor.

Debian or Ubunturestart every PHP process that serves the web
sudo systemctl restart php8.3-fpm     # each installed FPM branch
sudo systemctl restart apache2        # if Apache loads mod_php
ps -o lstart=,cmd= -C php-fpm8.3      # started after the upgrade?

Service names differ elsewhere: on other distributions, restart your distribution's PHP-FPM service and web server; on cPanel and Plesk, restart PHP-FPM and the web server the way the panel's documentation describes.

php -v reports the command-line binary. The site may run a different one: an FPM pool, Apache's module, or a per-domain version picked in a panel. Ask the web server itself, through the same virtual host the site uses, with a file you delete straight after:

v-8f3k2q.phptemporary: upload, request once, delete
<?php
header('Content-Type: text/plain');
echo PHP_VERSION, ' ', PHP_SAPI, "\n";
checkthen remove the file
curl -s https://example.com/v-8f3k2q.php   # for example: 8.3.36 fpm-fcgi, or later

PHP_VERSION is the running version and PHP_SAPI the server API, so you can tell FPM from mod_php. On distribution packages, pair it with the package check above, because the version string alone may not show a backport.

OPcache notes

  • OPcache keeps compiled scripts in shared memory. opcache_reset() empties that cache so scripts are compiled again. It does not load the new PHP binary; the restart does.
  • opcache_reset() "only resets in-memory cache, not the file cache". If you use opcache.file_cache, you may also clear that directory during the upgrade.
  • With opcache.validate_timestamps=0, code you deploy alongside the upgrade also needs a reset or a restart to take effect. The restart above covers both.
  • An opcache.preload script runs at server start. After a branch change, check that it still loads cleanly on the new version.
  • Wiz's research included an OPcache type-confusion path, and the fixed releases cover it. Turning OPcache off is not one of PHP's stopgaps; patching is the fix.

Scan from outside, before and after

php2shell-scanner, released by Searchlight Cyber, built by the Assetnote Security Research Team and MIT licensed, tests for the fault itself, and falls back on the PHP version the server advertises only when its probes show no crash. It sends a 42-byte control request, then up to three multipart probes growing from 1 MiB to 20 MiB, about 29 MiB per path. It reports a host vulnerable on a PHP memory-exhaustion error, a differential empty HTTP 500, an FPM worker failure, or an advertised PHP version known to be unpatched. It tests /index.php unless you pass --path.

php2shell-scannerthe README's Docker route; options as for scanner.py
git clone https://github.com/assetnote/php2shell-scanner
cd php2shell-scanner
docker build -t php2shell-scanner .
docker run --rm php2shell-scanner -u https://example.com -v
docker run --rm php2shell-scanner -u https://example.com --sapi fpm   # when you know it runs FPM

Without Docker, use a virtual environment. On Debian and Ubuntu the venv module is a separate package, python3-venv:

without DockerDebian or Ubuntu
sudo apt install python3-venv
python3 -m venv .venv && . .venv/bin/activate
pip install -r requirements.txt
python3 scanner.py -u https://example.com -v

Three cautions:

  1. Scan only what you own, or have written permission to test. The probes make PHP run out of memory on purpose. Its authors call that "fundamentally risky in nature" and tell users to take care. Pick a quiet hour and expect HTTP 500s in the logs.
  2. Check every finding. The README reproduced a false positive on patched 8.4.27 with memory_limit between 2M and 32M, and on 8.3.36 at 128M when max_multipart_body_parts is 2785 or higher. It says results "should therefore be verified against the installed PHP version and any vendor backports". The version fallback has the opposite blind spot: it compares only the upstream number, so a patched distribution or panel build that keeps an old one (Ubuntu 24.04's 8.3.6, Plesk's 8.1.34) is reported vulnerable. Check those against your distribution's CVE page, such as Ubuntu's or Debian's security tracker.
  3. One clean path is one data point. Pair the scan with the package and running-version checks above.

Dependencies: composer audit

PHP2Shell is in the runtime. composer audit checks the packages you have installed against security advisories, from Packagist by default, and also flags abandoned and malware packages, so it will not report PHP2Shell. Run it as its own step. It exits with a non-zero code when it finds something, which makes it easy to fail a CI job on.

composeraudit, then see what blocks the next PHP version
composer audit
composer why-not php 8.3     # which packages refuse PHP 8.3

If your composer.json sets config.platform.php, move it to the version you are moving to. Composer's docs warn that a faked platform stops dependencies being checked against the PHP you really run, and recommend running composer check-platform-reqs as part of the deploy.

Move off end-of-life branches

  • PHP 8.1 reached end of life on 31 December 2025, 8.0 on 26 November 2023 and 7.4 on 28 November 2022. For PHP2Shell, PHP published minimal source backports for 7.4, 8.0 and 8.1 "to help people building from source or without access to an LTS vendor", and distributions and panels shipped their own. These close this hole. They do not bring the branch back into support.
  • Security support for 8.2 ends on 31 December 2026, so aim for 8.3 or later.
  • PHP's migration guide for each version lists its backward-incompatible changes and deprecated features; the 8.3 guide warns of "a few incompatibilities that should be tested for before switching PHP versions in production environments". On WordPress, the PHP Compatibility Checker plugin is a first pass, as WordPress's own guide suggests, though WordPress warns it "may miss items or flag false positives".
  • Move on a copy first, with the test suite and a backup you have restored, then switch production.

If you would rather hand it over, our PHP fix and upgrade covers one website or app for a flat fee: PHP moved to a supported, patched release, dependencies updated, a backup first and a before-and-after report with the scanner check.

If you cannot patch today

PHP's advisory lists stopgaps that "reduce exposure to specific attack paths but do not make an installation safe":

  • session.upload_progress.enabled=0, set in php.ini, an FPM pool or server configuration that applies before request parsing (not ini_set() or .user.ini), then restart every worker.
  • On PHP 8.5, fatal_error_backtraces=0, then restart every worker.
  • memory_limit=-1, set so applications cannot override it, and a low post_max_size (8M without uploads, 32M with), keeping upload_max_filesize below it. An underlying allocation failure can still reach the bug. Cap memory with a container or cgroup limit instead, preferably one that kills only the affected worker, and never with an RLIMIT_AS or RLIMIT_DATA limit such as ulimit -v: PHP warns these "can cause the vulnerable allocation failure".

Web application firewall rules help too: Cloudflare's are on by default for every plan with its firewall, and Google Cloud Armor has its own. CISA goes further: take PHP systems offline if they cannot be updated now or still run PHP 8.1 or earlier.

Watch for attempts

Wiz suggests watching for unusual multipart requests followed by memory-limit errors or repeated HTTP 500 responses, unexpectedly large or malformed PHPSESSID response cookies, and unexplained PHP worker churn. CISA adds PHP worker processes launching shells or downloading tools, and links a SIGMA detection rule. If a host shows those signs, Google's advice is to capture worker memory before you restart it, because restarting workers destroys that evidence.

Got a PHP site that needs this?

Send us the address and where it is hosted. We reply within one working day.