PHP2Shell: the flaw is in the interpreter

PHP2Shell: the flaw is in the interpreter

On 21 October 2026 the PHP project released 8.5.12, 8.4.27, 8.3.36 and 8.2.35, fixing two critical remote code execution flaws in the interpreter itself. Not in a framework, not in a plugin, not in anything you wrote. In PHP.

The PHP security team's own summary of your options is one sentence: "There are no complete mitigations, updating is the only safe choice."

The name PHP2Shell comes from the researchers — Wiz combined the two bugs into a single exploit script and called it that. It is not a vendor product name and not a marketing invention.

The two flaws

CVE-2026-109618 — remote code execution via out-of-memory corruption. PHP uses longjmp() to abandon a request when it runs out of memory. Some code paths make request memory reachable before it is fully initialised, so if an allocation fails at exactly that moment, the early exit is not accounted for and the cleanup that runs afterwards reads or branches on invalid memory. An attacker who can reliably drive the process to out-of-memory at a chosen point gets code execution. The fix removes longjmp() for out-of-memory entirely.

CVE-2026-109619 — remote code execution via stale global state. PHP keeps worker-level globals that temporarily point into memory owned by the current request. If one of those is not reset — because a fatal error, parse failure, uncaught error or execution timeout interrupted things — it can still point at that memory after it has been freed. A later request on the same worker then reads it before initialisation cleans up. The result is a use-after-free, memory disclosure, and with the right heap layout, code execution.

Both are scored 9.2 under CVSS v4.0 by the PHP project. NVD independently assigned 9.8 under CVSS v3.1; the difference is entirely attack complexity, which PHP rates high and NVD rates low. PHP published no v3.1 score, so the 9.8 is NVD's figure rather than the vendor's.

The default setting that makes this everyone's problem

If you read one thing here, read this.

PHP has a feature called session upload progress, which records the progress of a multipart file upload into the session. It activates when a POST contains a field named after session.upload_progress.name — by default PHP_SESSION_UPLOAD_PROGRESS. The field name comes from the request, so the handler runs whether or not your application has an upload progress bar, and whether or not your code ever calls session_start().

PHP's advisory states it plainly: "Session upload progress is enabled by default, and no application call to session_start() is required. It can supply a producer, consumer or both."

It runs before ordinary module initialisation, which is exactly the window CVE-2026-109619 needs. That is why nearly every write-up names it as the exploitation path.

One correction worth carrying, because a lot of coverage has it backwards: session upload progress belongs to CVE-2026-109619, not CVE-2026-109618. PHP's advisory is unambiguous on this.

A second consumer is almost worse. A warning, notice or deprecation raised while PHP applies invalid or deprecated INI settings also reaches global state too early — and PHP spells out that you cannot suppress your way around it: "Changing error_reporting, using @, or disabling display_errors or log_errors does not protect against this vulnerability."

Does your setup matter?

Somewhat, and not in a reassuring direction.

For mod_php, PHP says the module "unconditionally invokes the request shutdown procedure, even when request startup has failed… entirely before any application-specific code begins execution". Application-independent, confirmed.

For PHP-FPM, the picture differs per CVE. On 109618, FPM exits the child when request startup fails, so PHP says source analysis "supports FPM as a susceptible" SAPI while noting no complete FPM exploit has been demonstrated for it. On 109619 there is no such hedge: the validated FPM path publishes state during normal application execution, hits a fatal error, and then uses session upload progress as the early consumer. PHP's confirmed-impact statement covers both: "The fatal backtrace path has confirmed RCE against mod_php. Session lifecycle RCE was validated against mod_php and FPM."

FrankenPHP is described as likely susceptible, LSAPI as likely but unvalidated.

Which versions

This is the part where the sources genuinely disagree, so here is who says what.

The PHP project officially asserts only this: 8.2 below 8.2.35, 8.3 below 8.3.36, 8.4 below 8.4.27, and 8.5 below 8.5.12. Its CVE record declares everything else unaffected by default and says nothing at all about older branches.

Wiz, one of the reporting firms, says all PHP versions from 5.4 onward are affected by at least one of the two. Cloudflare, Sansec and Google Cloud repeat the 5.4 figure. watchTowr says "PHP 5 onward" but attaches the caveat that matters: that scope "has not been confirmed by an official vendor advisory". It still has not been.

There is a practical consequence. NVD's version data for the first affected range has no lower bound at all, so vulnerability scanners that consume NVD literally will flag PHP 5.6 installations. Treat that as a scanner artefact to investigate, not as a vendor statement.

If you are on an unsupported branch

PHP 8.1 reached end of life on 31 December 2025. PHP 8.0 ended in November 2023, PHP 7.4 in November 2022. There is no supported release for any of them.

But the common claim that older branches got nothing is wrong. PHP's advisory says: "Given the severity of these vulnerabilities, the PHP security team provided minimal source-backports for PHP 7.4, PHP 8.0, and PHP 8.1 to help people building from source or without access to an LTS vendor." Those live on branches in the php/php-src repository. Source only — no official binaries, and nothing for 7.3 or earlier.

Your distribution may have done better:

  • Ubuntu shipped the broadest coverage on 21 October at Critical priority, including php8.1 on 22.04 under standard support — no Ubuntu Pro needed. php7.4, 7.2, 7.0 and php5 were also patched, those via Pro and ESM.
  • Red Hat rates it Important rather than Critical and backported to php:7.4 on RHEL 8, including ELS, alongside errata for RHEL 9 and 10.
  • Debian patched php8.4 on trixie and php8.2 on bookworm. Nothing older.
  • AlmaLinux was still showing patches in progress, and has explicitly deferred AL9 php:8.1 and AL8 php:7.2, 7.3 and 8.0 — note that php:7.2 is still AlmaLinux 8's default stream.
  • CloudLinux shipped an Imunify360 ModSecurity rule that blocks the circulating exploit shape, and is explicit that it is "a stopgap mitigation", not a fix.

CISA's advice for anyone stuck is blunt: organisations that cannot update immediately, or that continue to run PHP 8.1 or earlier, "should take PHP-based systems offline until they can be patched or updated."

How to actually check

php -v tells you about the command-line binary, which is frequently not the one serving your website. Check php-fpm -v, or put a phpinfo() page somewhere temporary and delete it afterwards.

Then the trap JFrog flagged: distributions backport security fixes without changing the upstream version string. A server reporting 8.1.2 on Ubuntu 22.04 may well be patched. Verify against your vendor's advisory, not against the number. OpenAI published a checker for this at github.com/openai/php2shell-checker.

One more thing worth knowing: both advisories exist only as repository-level entries. They are absent from GitHub's global advisory database and from OSV, so dependency scanners keyed to those feeds will not report them yet.

If you cannot patch today

PHP's own list, with its own caveat that these "reduce exposure to specific attack paths but do not make an installation safe":

  • Set session.upload_progress.enabled=0 and restart every worker. PHP suggests doing this even after patching, noting it "might be prudent… as more attackers try to find flaws in this hardly-used and hardly-tested feature."
  • On PHP 8.5 only, also set fatal_error_backtraces=0 and restart.
  • For the memory bug, set memory_limit=-1 administratively — counter-intuitively, removing the limit rather than tightening it, because a predictable finite limit is what makes the out-of-memory condition controllable. Enforce it in the FPM pool or Apache config, not somewhere an application can override.
  • Do not use RLIMIT_AS or RLIMIT_DATA. PHP warns these cause mmap() to fail at the limit, which triggers the vulnerable path.
  • Lower post_max_size and put limits at the front end on decoded body size, input count, multipart parts and header count — including for requests with no usable Content-Length.

Is it being exploited?

Carefully: the evidence is contested, and several outlets have flattened "attempts" into "compromises".

Hadrian reported seeing it "exploited in the wild at scale" on 21 October, mostly via the session upload progress path, without publishing numbers. AWS called it "broadly exploited" and reported an attempt in its telemetry dated 17 October — four days before disclosure, uncorroborated by anyone else — while also saying it was "unclear if any of these attempts would have succeeded". Cloudflare saw attack traffic against customers and turned WAF protection on by default hours before the release.

Against that: Imperva observed no traffic matching the exploit patterns during the same pre-disclosure window. Huntress had not seen in-the-wild exploitation on partner systems. watchTowr, which did see active attempts, said it had not observed successful ones — its Jake Knott put it as "whilst nobody has been successful to date, we don't expect that will last long."

Neither CVE is in CISA's Known Exploited Vulnerabilities catalogue as of today, and CISA stated on 21 October that it "has not observed exploitation of these vulnerabilities as of the time of publication".

Unit 42 counted over 22.6 million exposed instances potentially vulnerable — that is an exposure figure, not an exploitation figure, and it is the number most likely to be misquoted.

Worth noting too that the CVE IDs leaked on 20 October around 15:00 UTC with a wrong release time and a wrong score of 10.0, which pushed PHP to bring the whole release forward by a day. No technical details leaked at that point, and PHP says its team "did not identify any functional exploits at the time of release".

The short version

Patch. The version you need is 8.5.12, 8.4.27, 8.3.36 or 8.2.35, or your distribution's equivalent. Check what your web server actually runs rather than what your CLI reports. If you are on 8.1 or older, find out whether your distribution patched it, and if it did not, take the thing off the internet until you have a plan.

If you are not certain what PHP you publish — which sites exist, which versions they report, which of them nobody remembers owning — that part is answerable from the outside. A ClickScan external scan enumerates what responds on your addresses, and what it checks covers the exposure around an application as much as the application itself. Where it needs a person, ClickSecure AI's expert services cover that.

Sources: PHP 21 October 2026 release announcement · CVE-2026-109618 record · NVD entry for CVE-2026-109618 · PHP supported versions policy · watchTowr analysis · JFrog research

The affected range below PHP 8.2 is reported by Wiz and repeated by several vendors but has never been confirmed in a PHP advisory. Exploitation claims differ sharply between vendors observing different traffic, and none has published counts; attempts are not compromises. Distribution package status was accurate at the time of writing and is moving daily — check your own vendor's advisory.

← Back to blog