php2shell Explained: What to Patch Today, and What to Replace This Year
Two critical PHP vulnerabilities, CVSS 9.2, unauthenticated remote code execution, and no safe server configuration. What to do this week, why your version number cannot tell you if you are exposed, and why patching to PHP 8.2 buys you ten weeks.

On 21 October 2026 the PHP project disclosed two vulnerabilities in the language runtime itself, nicknamed php2shell. CVE-2026-109618 and CVE-2026-109619 both carry a CVSS v4.0 base score of 9.2, and both can lead to unauthenticated remote code execution. They are fixed in PHP 8.2.35, 8.3.36, 8.4.27 and 8.5.12, released the same day.
This is not a WordPress bug or a Magento bug. It is a bug in the engine underneath them, which is why Sansec was able to confirm unauthenticated remote code execution against Magento 2.4.9, WordPress, Drupal, Joomla, Laravel, Symfony and several other applications whose own code is perfectly clean. PHP runs 69.3% of websites whose server-side language is known, so the blast radius is most of the web.
The PHP security team's own guidance is unusually blunt: there are no complete mitigations, and updating is the only safe choice.
What php2shell actually is
Two separate flaws that happen to combine well.
CVE-2026-109618 is memory corruption during out-of-memory handling. PHP exits a request on OOM using longjmp(), and in some contexts request memory is reachable before it has been fully initialized. The early jump leaves that memory invalid, and request shutdown then reads or branches on it.
The part that makes this reachable from the internet is how the out-of-memory condition gets triggered. It is not a huge request body. It is a cheap body that is expensive to parse: a multipart request with no usable declared content length passes the initial post_max_size check, parts can carry headers that expand substantially in memory, and empty file controls do not count toward max_file_uploads while still allocating file-metadata arrays. Multipart parsing happens before module initialization, which is precisely why application-level hardening does not help.
CVE-2026-109619 is a cross-request use-after-free. Request-owned global state can survive after its backing memory has been freed, and a later request handled by the same worker may use that stale state before normal initialization resets it. Exploitation needs a producer, which stores state that persists through a fatal error, OOM or timeout, and a consumer that acts on it on a later request in the same worker. Session upload progress is a confirmed consumer, and it is enabled by default.
Wiz, who found and reported the flaws, also demonstrated a memory disclosure path that leaks freed memory into a PHPSESSID cookie, exposing passwords, tokens, API keys and certificates, and defeating address space layout randomization along the way.
Whether you are exposed, and why your version number cannot tell you
This is where most of the advice circulating this week is quietly wrong.
The obvious check is to look at your PHP version and compare it against the fixed list. That check produces false answers in both directions, because Linux distributions backport security fixes without changing the version number. A patched PHP 8.1.34 and an unpatched PHP 8.1.34 report exactly the same string. If you run php -v, see 8.1.34, and conclude you are vulnerable, you may be wrong. If you see it and conclude you are fine, you may also be wrong.
What actually answers the question is your vendor's package version and its changelog. On Ubuntu 22.04 the patched package is 8.1.2-1ubuntu2.28. On Debian bookworm it is 8.2.35-1~deb12u1. Those are the strings that mean something, not the number PHP prints.
What to do in the next 24 hours
- Update to a patched branch and restart every worker. The fixed versions are 8.2.35, 8.3.36, 8.4.27 and 8.5.12. Both producer and consumer in the second flaw have to land on the same worker process, so a restart matters as much as the package.
- Check your distribution, not just PHP. The version you need may be a backport that carries an older-looking number.
- Apply the administrative mitigations where you cannot patch immediately. Set
memory_limit=-1where applications cannot override it, setsession.upload_progress.enabled=0, and on PHP 8.5 also setfatal_error_backtraces=0. These reduce exposure. They do not make an installation safe, andini_set()and.user.iniare applied too late to help. - Put a WAF in front of it as a stopgap. Cloudflare shipped rules including on the free tier, and Google Cloud published guidance recommending its File Upload and RFI rule categories along with a rule for request bodies that exceed inspection limits. This protects traffic routed through the proxy and nothing else.
On exploitation, the honest position is narrower than the headlines. Amazon observed an exploitation attempt against its MadPot honeypot on 17 October, four days before disclosure, and details leaked publicly on 20 October, which moved the release forward by a day. But Recorded Future's Insikt Group states that the available evidence does not establish the extent of successful exploitation or confirmed compromises, and SANS ISC describes the circulating proof-of-concept code as incomplete and not reliable. Neither CVE appears in CISA's Known Exploited Vulnerabilities catalog as of 22 October 2026.
That is still a reason to patch today. It is not a reason to believe anyone who tells you a working public exploit is available, and unverified exploit code circulating this week should be treated as malware rather than as a testing tool.
The end-of-life trap
Here is the part that turns a patching exercise into a planning problem.
The PHP project is not releasing fixes for PHP 8.1 or earlier. For 7.4, 8.0 and 8.1 the security team published minimal source backports only: not releases, not renewed support, just patches you are expected to apply and compile yourself.
Distributions partially fill that gap, and the detail matters more than the headline.
The same CVE, four different answers depending on where you run
| Platform | Where the fix lives |
|---|---|
| Ubuntu 22.04, php8.1 | Standard archive, 8.1.2-1ubuntu2.28. No subscription needed |
| Ubuntu 20.04, php7.4 | Paid Ubuntu Pro and ESM only, as 7.4.3-4ubuntu2.29+esm5 |
| Debian bookworm, php8.2 | Standard, 8.2.35-1~deb12u1 |
| Debian bullseye | Not listed in the security tracker for these CVEs |
So the real risk of running end-of-life PHP is not that no patch exists. Sometimes one does. The risk is that you no longer control whether it exists. You are depending on a paid support tier, or a distribution that may have dropped your release, or your own team's willingness to compile a source patch under time pressure, or a version string that cannot confirm what you have. Sources: Ubuntu and the Debian security tracker.
This is not a rare situation. Black Kite's scan of version-disclosing internet-facing PHP hosts found roughly 72.5% running end-of-life branches, with PHP 7.4 the single largest. W3Techs puts PHP 7 at 26.9% of PHP sites and PHP 5 at 7.7%, which is a third of everything running PHP.
Why PHP 8.2 is not a destination
Most teams reading this will patch to the nearest supported branch and move on. For a lot of them that means 8.2.35.
PHP 8.2 reaches end of life on 31 December 2026.
That is ten weeks from this article. A team that patches to 8.2 this week has not solved the problem, it has rented a solution until the new year, at which point it is back in exactly the position described above: depending on a backport someone else may or may not produce.
This is the argument for treating php2shell as a scheduling event rather than an incident. The patch is urgent and it is not a plan. The plan is knowing which branch you are on, what your actual upgrade path looks like, what breaks when you take it, and whether the application on top is worth upgrading in place or worth moving.
What that looks like in practice
The useful question is not "are we vulnerable", because the honest answer this week is usually "probably not any more, and we cannot prove it from the version string". The useful questions are narrower:
- Which PHP branch is each application actually running, per environment rather than per assumption?
- Is the fix on that host from the standard archive, a paid support tier, or nowhere?
- What is the upgrade path to a branch that is supported past 31 December 2026, and what breaks on the way?
- Which applications are worth upgrading in place, and which are old enough that the upgrade cost and the replatform cost have converged?
The last one is the only question with real money attached, and it is the one nobody asks during an incident. It is worth asking in the two weeks afterward, while the risk is still legible to everyone who signs off budgets.
If you want a second pair of eyes on it, that is the work we do. The honest version of this engagement is short: we read what is actually deployed, tell you where the fix came from, and give you an upgrade path with the breakages named. Anyone who quotes you a replatform before answering the first three questions is selling you the wrong thing.
Key takeaways
- The bug is in the engine, not the application. Sansec confirmed unauthenticated remote code execution against Magento 2.4.9, WordPress, Drupal, Joomla, Laravel and Symfony installations running clean code.
- A patched PHP 8.1.34 and an unpatched PHP 8.1.34 print the same version string, so version checks produce false answers in both directions. The vendor package version is the one that means something.
- Do not use RLIMIT_AS or RLIMIT_DATA as a mitigation. They make mmap() fail, which actively triggers the vulnerable code path.
- Black Kite found roughly 72.5% of version-disclosing internet-facing PHP hosts running end-of-life branches, with PHP 7.4 the largest single group.
- Exploitation attempts began before disclosure, with Amazon observing one on 17 October, but Recorded Future states the evidence does not establish the extent of successful compromise, and neither CVE is in CISA's KEV catalog as of 22 October 2026.
Questions people ask about this
Sourced from client conversations, Search Console, and AI-search citation monitoring.
- php2shell is the nickname for two vulnerabilities in the PHP runtime disclosed on 21 October 2026: CVE-2026-109618, a memory corruption during out-of-memory handling, and CVE-2026-109619, a cross-request use-after-free. Both carry a CVSS v4.0 base score of 9.2 and both can lead to unauthenticated remote code execution. Because they sit in the PHP engine rather than in application code, they affect applications whose own code is correct.
- PHP 8.2.35, 8.3.36, 8.4.27 and 8.5.12, all released on 21 October 2026. PHP 8.1 and earlier have reached end of life upstream and are not receiving releases, although the security team published minimal source backports for 7.4, 8.0 and 8.1, and some Linux distributions ship their own patched packages.
- Checking the PHP version alone does not answer it. Linux distributions backport security fixes without changing the version number, so a patched and an unpatched build can report an identical string. The reliable check is the vendor package version and its changelog on the host itself, for example 8.1.2-1ubuntu2.28 on Ubuntu 22.04 or 8.2.35-1~deb12u1 on Debian bookworm. Checking the version a site advertises in its response headers is a useful first orientation, because it tells you which branch you are on and whether that branch is still supported, but it cannot confirm patch status.
- Not as an upstream release. The PHP security team published minimal source backports for 7.4, 8.0 and 8.1, which are patches to apply and compile rather than supported releases. Distribution coverage varies and is the thing to check: Ubuntu fixed php8.1 on 22.04 in the standard archive, but php7.4 on 20.04 is fixed only through the paid Ubuntu Pro and ESM tiers, and Debian bullseye is not listed in the security tracker for these CVEs.
- 31 December 2026. This matters for anyone patching php2shell, because 8.2.35 is one of the fixed versions and is the branch many teams will upgrade to this week. Moving to 8.2 resolves the immediate vulnerability but leaves the same end-of-life exposure a few weeks later, so the upgrade path beyond it is worth planning at the same time.
- Not an established one. Proof-of-concept code is circulating, but the PHP team inspected post-leak proofs of concept and found no functional exploits at release, and SANS ISC describes the published proof of concept as incomplete and not reliable. Exploitation attempts have been observed, including one against an Amazon honeypot on 17 October 2026, four days before disclosure, but Recorded Future states the available evidence does not establish the extent of successful exploitation. Unverified exploit code circulating this week should be treated as potential malware rather than as a testing tool.
Keep reading
Related articles.
More on the same thread, picked by tag and category, not chronology.
What Is WordPress? 8 Key Benefits of Using It for Your Website
Wondering what WordPress is? This article explains how it works and highlights 8 key benefits of using WordPress to build and manage your website.
The AI Code Review Bottleneck
Anthropic went from 2,500 merges a day to over 30,000 in four months and replaced git to cope. You cannot buy what they built, and they say so. What transfers is the diagnosis, and what it looks like at ordinary scale.
52 AI Engineer Interview Questions
52 real AI engineer interview questions across LLM API integration, RAG and retrieval, agent frameworks, evaluation and observability, and production operations. With scoring rubric and what good answers look like. Used at Cubitrek to pre-vet every staff-augmentation candidate.
Ready when you are
Want Cubitrek to run Security and Compliance for you?
We install security and compliance programs for growing companies across the US and Europe. Book a call and we'll come back with a one-page plan in 72 hours.



