Skip to main content

php2shell: Two Unauthenticated PHP RCEs, One Image Rebuild per Service

· 9 min read
Ankush K
Co-founder and CTO, Dwaar
php2shell: Two Unauthenticated PHP RCEs, One Image Rebuild per Service

You cannot fix this one from your application repository. The two flaws PHP disclosed yesterday sit in the interpreter, and the first was demonstrated over HTTP before any application code runs. The fix is a new runtime in every image and on every host, which makes today's real question an inventory question: where is all your PHP?

At a glance
IdentifiersCVE-2026-109618, RCE via OOM corruption, and CVE-2026-109619, RCE via stale global state
AffectedPHP before 8.2.35, 8.3.36, 8.4.27 and 8.5.12, per PHP. PHP's announcement and CISA say all PHP installations serving web requests. UK NCSC says all versions may be affected.
Fixed in8.2.35, 8.3.36, 8.4.27, 8.5.12
SeverityCritical, CVSS 4.0 base 9.2 for both, scored by the PHP project as CNA
Exploited as of 2026-10-22Attempts and early attacks reported. No confirmed compromise in these sources. Not in CISA KEV.
Disclosed21 October 2026. php.net's changelog dates all four fixed releases 22 October.

The bug is in how PHP gives up​

PHP handles out-of-memory errors with longjmp(): it jumps out of the current context and aborts the request. In some contexts, request memory is reachable before it is fully initialised. If an allocation fails there, request shutdown then reads or branches on invalid state.

So the attacker's job is to exhaust memory at the right moment, and the advisory lists ways that need no application help. A multipart request without a usable declared content length can pass the initial post_max_size check. A part can carry unlimited headers that cost far more inside PHP than on the wire.

CVE-2026-109619 is the same family with a longer fuse. Persistent worker globals keep pointers to request memory after it is freed, because a fatal error, OOM included, can abandon an operation before its matching reset. A later request on the same worker then reads or frees the stale value. PHP confirms two consumers: INI diagnostics raised before request initialisation, and session upload progress handling.

The CVE-2026-109618 patch removes longjmp() for OOM. PHP now takes a soft OOM at the next VM safe point and calls _exit() at a second, higher threshold, so shutdown never sees invalid state. The CVE-2026-109619 patch resets the wider request-owned state so it cannot survive into operations that run before the next request initialises.

Your SAPI sets the order, not the exemption​

SAPICVE-2026-109618, per PHP's advisoryCVE-2026-109619, per PHP's advisory
Apache mod_phpShutdown runs even when startup fails. RCE validated over HTTP with default input and memory limits.RCE confirmed through the PHP 8.5 fatal backtrace path and validated through the session lifecycle path.
PHP-FPMThe child exits when startup fails. Source analysis suggests it stays susceptible after normal startup. No complete exploit demonstrated.Session lifecycle RCE validated, depending on a suitable application operation. Conditionally exposed when the frontend sends PHP_VALUE or PHP_ADMIN_VALUE parameters that produce a diagnostic before request initialisation.
FrankenPHPSource analysis says likely susceptible to application-independent attacks.No equivalent early configuration consumer established in the default configuration, which PHP says does not make it immune.
LSAPIModelled on FPM. Application-specific exploits likely but unvalidated.Can apply special environment INI values early, which makes it a conditional candidate.

BleepingComputer quotes PHP: "We consider the risk highest for mod_php." Use the table to order your queue, not to skip anyone. Exploit portability depends on build, extensions, frontend behaviour and allocator layout, which is friction for an attacker, not a boundary for you.

What is reported so far​

Amazon says its MadPot honeypot logged an attempt on 17 October, four days before disclosure, and that proofs of concept appeared from about 02:00 UTC on 21 October, ahead of the 14:00 UTC embargo lift. Cloudflare CTO Dane Knecht said the company saw early attacks before the patches shipped, per BleepingComputer. Help Net Security reports a working exploit triggered by a single unauthenticated request.

Honeypot attempts are not compromises, and PHP vouches only for its own demonstrations: mod_php for CVE-2026-109618, mod_php and PHP-FPM for CVE-2026-109619. The missing KEV entry is still no reason to wait.

What to do now​

  1. Upgrade. Move to 8.2.35, 8.3.36, 8.4.27 or 8.5.12, or later in the same branch, then rebuild and redeploy everything carrying the runtime. Amazon and PHP both say updating is the only complete fix.
  2. On distribution packages, read the vendor's advisory. Help Net Security reports that Linux distributions and LTS vendors received patches before public release. Confirm the fix for the package you run.
  3. On 8.1 or older, treat yourself as affected. PHP's advisories list only 8.2 onward and those branches get no upstream updates, but minimal source backports exist for 7.4, 8.0 and 8.1, which tells you enough. NCSC says to consider taking offline what you cannot patch or mitigate.
  4. If you cannot patch today, reduce exposure, and know it is partial. WAF rules from AWS and Cloudflare are defence in depth, not a fix.
    • For CVE-2026-109618, set and enforce memory_limit=-1 administratively, restart every worker, and confirm that no pool, directory or application setting restores a finite limit. PHP says a cgroup memory.max limit can stand in for PHP's own, with caveats: it does not guarantee against allocation failure, and a kill can take the master and every worker unless each worker has its own group. Avoid RLIMIT_AS and RLIMIT_DATA, which make mmap() fail at the limit and reach the vulnerable path. Keep post_max_size conservative, and block multipart at the frontend if you do not use it.
    • For CVE-2026-109619, set session.upload_progress.enabled=0 and, on 8.5, fatal_error_backtraces=0 administratively, then restart every worker. PHP: "There is no complete generic configuration mitigation."
  5. Hunt from 17 October, not from disclosure. Amazon suggests looking for POST requests containing PHP_SESSION_UPLOAD_PROGRESS in form uploads, and for unexpected process execution or file changes on web servers. Code runs as the web worker account, so if you find signs, treat whatever that account can read as exposed.

The inventory is the incident​

A library bug gets a dependency bump. An interpreter bug gets a new runtime under every service. Code scanning and application reachability analysis have little to say about the mod_php path, which runs before your code does, and even on FPM, where an application operation can matter, the fix is still the runtime. What decides priority is the runtime version, the SAPI and the deployment, all of which live in the artifact you ship. Often that PHP arrived through a base image, not a decision anyone remembers.

So do not start from a list of "our PHP services". Start from what is running: deployed images, then hosts, then software you bought. NCSC calls out PHP embedded in other software and appliances, and tells organisations to keep monitoring third-party vendors for updates to appliances and services that may bundle it.

Discovering what you ship from source control, registries and cloud accounts, scanning it, and keeping one findings list with EPSS and KEV signals beside it is the problem we work on at Dwaar.

Take your largest registry or cloud account and answer three questions for every running image: which PHP version, which SAPI, and is it reachable from the internet? Internet-facing mod_php goes first. If building that list takes longer than the patch, you have found your next project.

References​