Back to Portfolio Blog · Vulnerability Analysis
// blog · vulnerability analysis

PHP2Shell
The Bug That Runs Before Your Code

Two critical flaws in PHP’s request handling, both rated 9.2, both reachable without authentication. The detail that matters is not the score — it is that they execute during request setup, before a single line of your application runs.

Alex Philip 23 October 2026 12 min read
CVE-2026-109618
CVE-2026-109619
Pre-Auth RCE
Patch Management
9.2
CVSS v4.0, both
69.3%
Of the web runs PHP
1.3M+
Exposed hosts at risk
5.4
Earliest PHP affected

01 What Happened

On 21 October 2026 the PHP project shipped emergency releases for two vulnerabilities collectively named PHP2Shell: CVE-2026-109618 and CVE-2026-109619. Both are rated 9.2 on CVSS v4.0. Both sit in the PHP engine itself rather than in any library, framework or application.

The practical consequence is that an unauthenticated HTTP request can reach the flawed code. PHP validated unauthenticated remote code execution against Apache with mod_php, where the request is handled in-process and the flaw fires before application code runs. The second flaw lists memory disclosure as a confirmed impact even where execution is not achieved.

The exposure is unusually wide. PHP accounts for roughly 69.3% of websites whose server-side language is known, per W3Techs. Independent estimates put over 1.3 million internet-exposed hosts in the potentially-vulnerable range, against a Shodan count of more than 1.9 million exposed hosts running PHP at all.

Scope: this is not a plugin, a CMS or a framework issue. If a host runs an affected PHP build and serves requests, it is in scope — NGINX with PHP-FPM, Apache with mod_php, php-cgi, FrankenPHP, LiteSpeed, containers, CI runners, and the forgotten internal tool nobody has redeployed since 2023.

02 Timeline

1 August 2026
A researcher operating as Calif finds the first flaw during an AI-assisted audit of the PHP source. Reported to the PHP project on 11 August.
24 August 2026
Wiz Research independently reports the flaws, having found them separately. Two independent discoveries inside a month is itself a signal about how reachable this code path was.
17 October 2026
Amazon Threat Intelligence observes an exploitation attempt in its MadPot honeypot telemetry — four days before any patch existed. Amazon notes it is unclear whether these pre-disclosure attempts would have succeeded against real systems.
20 October 2026
PHP announces an upcoming security release. Details of the vulnerabilities leak publicly ahead of coordinated disclosure.
21 October 2026, 14:00 UTC
Fixed builds and advisories published. CISA issues an alert urging immediate patching with internet-facing systems prioritised, advising organisations that cannot patch to take PHP systems offline. The NSA issues comparable guidance. Reuters reports government sites going dark. watchTowr observes exploitation of both CVEs in its honeypot network the same day.

03 The Two Bugs

CVE-2026-109618 — corruption on the out-of-memory path

This one is a cleanup failure. While PHP is still assembling the incoming request data, it exhausts its allowed memory. Out-of-memory handling interrupts the process mid-initialisation, and the cleanup routine that runs next treats that half-constructed state as valid and operates on it.

The trigger demonstrated in testing is mundane: a single unauthenticated POST carrying one enormous form field name — around 3.5 MB. No credentials, no session, no application interaction.

1 · Building request partially initialised 2 · Memory exhausted OOM INTERRUPT ~3.5 MB field name 3 · Cleanup runs treats half-built state as if it were valid → memory corruption, reachable without authentication
Fig 2 — CVE-2026-109618. The bug is in the error path, not the happy path.
CVE-2026-109619 — stale global state

The second is a use-after-free. A worker retains references to request memory after that memory has been released. A subsequent request handled by the same worker process can then reach the stale state, and an attacker able to influence what occupies that memory can control its contents.

Session Upload Progress — governed by session.upload_progress.enabled, which is on by default — is one confirmed route to this flaw. It is explicitly not the only one, which matters a great deal when we get to mitigations.

ONE WORKER PROCESS Request A allocates request state memory freed on finish reference survives STALE POINTER Request B refills that memory with controlled data → use-after-free: code execution, or disclosure of process memory
Fig 3 — CVE-2026-109619. Exploitation needs two requests landing on the same worker, which is why pm.max_requests=1 disrupts it.
The part worth sitting with: the earliest affected code path identified by the original researcher dates back to PHP 5.4.0. This is not a regression introduced by a recent refactor. It is a memory-safety flaw that has been reachable by an unauthenticated request for well over a decade, in the most widely deployed server-side language on the internet.

04 Not All Setups Are Equally Exposed

Every PHP installation serving web requests is affected, but the demonstrated impact differs by SAPI. This distinction is useful for prioritising a patch queue — it is not a reason to leave anything unpatched.

ConfigurationDemonstrated position
Apache + mod_phpHighest risk. PHP validated unauthenticated RCE for CVE-2026-109618 before application code runs, and session-lifecycle RCE for CVE-2026-109619. Patch these first.
PHP-FPMFor CVE-2026-109618, FPM blocks the specific startup-failure sequence, but is still considered susceptible under other conditions — no complete FPM exploit has been publicly demonstrated. For CVE-2026-109619, PHP validated RCE against FPM; that path needs a suitable application operation, a fatal error, and a later request reaching the same worker.
php-cgi, FrankenPHP, LiteSpeedNamed by PHP as at risk. Less publicly characterised than the two above, which is a reason for caution rather than comfort.

In every case code executes with the privileges of the web worker. Whatever that account can read — database credentials, API keys, session stores, mounted secrets — is in scope from the first successful request.

05 Why Hardening Fails Here

The 9.2 rating is the least interesting number in this advisory. What makes PHP2Shell worth studying is position in the stack.

Most of what we build to defend an application runs inside the application: authentication middleware, session validation, CSRF tokens, input sanitisation, role checks, rate limiting on sensitive routes. All of it is reached only after PHP has parsed the request and handed control to your code.

These flaws fire before that handoff. The controls are not bypassed or defeated by anything clever — they are simply never reached. A meticulously audited application with exemplary input validation sits in exactly the same position as an abandoned one.

Ordinary application CVE
Triage asks: do we use that component?
Often needs auth or a specific role
WAF rules can buy real time
Config change may genuinely mitigate
Blast radius: one application
PHP2Shell
Triage asks: does this host run PHP?
No authentication required
WAF is partial — the trigger resembles a large POST
Only the runtime upgrade actually fixes it
Blast radius: every PHP host you own
HTTP request unauthenticated PHP request init parse · allocate · session PHP2Shell EXECUTES HERE Your application auth · CSRF · validation · RBAC NEVER REACHED the controls you wrote live entirely downstream of the flaw
Fig 1 — Both flaws fire during request initialisation. Application-layer defences are not bypassed; execution never reaches them.

This inverts normal triage. The usual first question — are we actually using the vulnerable feature? — has no useful answer. If the host parses HTTP requests with an affected PHP build, it is exposed. That makes asset inventory, not patch analysis, the capability under test.

06 The Disclosure Broke Down

Coordinated disclosure exists to give defenders a patch before attackers get a target. Here the sequencing failed twice.

An exploitation attempt was logged on 17 October, four days before any fix existed publicly. Then on 20 October, vulnerability details leaked ahead of the scheduled release. By the time fixed builds appeared the following afternoon, the usual grace period between public knowledge and available patch had collapsed to approximately nothing.

Worth internalising: an embargo is a courtesy between researchers and vendors, not a security control. Any plan that assumes a quiet window between disclosure and exploitation is relying on a convention that has now visibly failed. Patch velocity is the control; the embargo was never load-bearing.

07 Exploitation Status — Read Carefully

This is the section most likely to be misreported, so it is worth separating precisely what has been observed from what has been proven.

  • Amazon Threat Intelligence recorded an attempt on 17 October and further attempts before and after disclosure, characterising the flaws as being broadly exploited. It also stated it was unclear whether the pre-disclosure attempts would have succeeded against real systems.
  • watchTowr observed exploitation of both CVEs against its honeypot network on 21 October.
  • Cloudflare reported early attacks emerging.
  • CISA stated on 21 October that it had not itself observed exploitation — while cautioning that this should not be read as evidence that attempts had not occurred.
  • The PHP security team inspected proof-of-concept code circulating after the leak and did not identify any functional exploits at release time.
The honest synthesis: exploitation attempts are widespread and involve multiple actors. Confirmed successful compromise at scale is a separate claim, and it is not yet established in public reporting. Both things are true at once, and conflating them produces either complacency or panic. Treat the host as exposed and patch on that basis — but do not assume breach without evidence from your own estate.

A related caution: publicly circulating proof-of-concept code for this pair includes both pranks and outright malware. Running an unvetted PHP2Shell “PoC” against your own infrastructure is an excellent way to become the incident you were testing for.

08 Detection

Useful indicators exist, with an important caveat below.

SignalWhat it means
Very large request bodiesRelevant to CVE-2026-109618. Bodies are frequently not logged, so filter on request size at the proxy or WAF rather than content.
Deeply nested multipart requestsUnusual multipart structure is worth surfacing even without a confirmed signature.
Unknown on line 0Memory-exhaustion errors in PHP logs, consistent with the out-of-memory path being reached.
AH00052 in Apache logsA child process crashed — the engine fell over mid-request.
Shell parented to a web workerStrong post-exploitation signal. A shell whose parent is apache2, httpd, php-fpm or php-cgi has no legitimate explanation.
Unexplained outbound connectionsEgress from a PHP worker that does not match known application behaviour.
New files in web roots, upload, cache or tmpWebshell placement. Worth baselining these directories regardless of this CVE.
New cron jobs or accountsPersistence established after initial access, tied to the web worker’s context.
CVE-2026-109619No published log signature. Absence of evidence carries very little weight here.
The analyst’s caveat: crash logs measure attempts, not compromises. A spike in AH00052 tells you someone tried something clumsy; it does not tell you they succeeded. Equally, a clean exploit may leave neither a crash nor a memory error — so a quiet log is not a clean bill of health. Treat these as triage leads, not verdicts.

09 Remediation

Upgrade the runtime. Application-level changes do not help, because PHP handles the request first.

BranchFixed release
PHP 8.5.x8.5.12
PHP 8.4.x8.4.27
PHP 8.3.x8.3.36
PHP 8.2.x8.2.35 — note this branch reaches end of life on 31 December 2026
PHP 8.6 RC8.6.0RC4. RC3 does not carry the fix.
PHP 8.1 and olderUnsupported upstream. Minimal source backports exist for 7.4, 8.0 and 8.1, and some distributions ship patched packages — confirm with your provider rather than assuming.
  • Check the package, not the banner. Distributions such as Ubuntu and Red Hat backport fixes without changing the upstream version string, so php -v can look unpatched when it is fine — and occasionally the reverse. Compare package versions.
  • Rebuild images with docker build --pull. Anything pinned to a specific patch tag needs the tag updated first, or you will faithfully rebuild the vulnerable version.
  • Restart every PHP worker after upgrading or changing configuration. Long-lived workers keep running old code.
  • If you find signs of compromise, do not patch first. Isolate the host, capture memory, disk and logs, then rotate every credential the PHP process could read. Patching destroys the volatile evidence that tells you what happened.
On the configuration “mitigations”

Several advisories list .ini changes as stopgaps. They deserve a precise reading, because the gap between closes a known path and fixes the bug is where people get hurt.

These close specific paths, not the vulnerability. Session Upload Progress is one confirmed route to CVE-2026-109619 and explicitly not the only one, so disabling it narrows exposure without removing it. Three operational details matter:

• session.upload_progress.enabled=0 only helps if applied in configuration read before request parsing. Setting it via application-level ini_set() or an FPM .user.ini is too late to help.
• On PHP 8.5, fatal_error_backtraces=0 addresses an additional sub-path.
• memory_limit=-1 removes a predictable trigger for CVE-2026-109618, but underlying allocation failures can still reach the vulnerable code.

One item is worth flagging as actively counterproductive: using OS-level RLIMIT_AS or RLIMIT_DATA to constrain memory is not a mitigation here. Those limits can themselves induce the allocation-failure condition the first bug depends on. The instinct to clamp memory is reasonable and, in this specific case, wrong.

10 The AI Angle

The first of these flaws was found during an AI-assisted audit of the PHP source. That detail has been widely reported, and deserves more thought than the headline it usually gets.

Set the two facts beside each other. The earliest affected code path dates to PHP 5.4.0. PHP’s request-handling path is among the most heavily trafficked code on the public internet, read by an enormous number of competent engineers across more than a decade. A memory-safety bug reachable by an unauthenticated POST survived all of that — and then two independent parties found it within a month of each other, once this class of tooling was pointed at it.

The honest reading is neither that AI is magic nor that human review failed. It is that a cheap new way of searching old code has arrived, and the cost of finding this class of bug has dropped sharply. That cuts both ways: the same economics apply to whoever audits your dependencies next, and to whoever audits them for less friendly reasons.

What I take from it: expect more of these — long-dormant memory-safety issues in mature, widely-deployed C codebases, surfacing faster than the old disclosure rhythms were built to absorb. The defensive answer is unglamorous and entirely within reach: know every host you own, know what runtime it runs, and be able to patch it quickly. PHP2Shell rewarded inventory and patch velocity. Nothing else helped.

11 Sources & Caveats

Written 23 October 2026, two days after the patch, and revised the same day as further reporting landed. This remains a fast-moving incident. The exploitation picture in particular shifted materially between first and second draft — it moved from “contested” to “attempts widely observed” within forty-eight hours. Verify current status before acting on anything here. I have deliberately made no claim about CISA KEV listing, having been unable to confirm it at the time of writing.

Upstream advisories: GHSA-w8hw-w9fx-j79w (CVE-2026-109618) and GHSA-6wmf-4rv5-p3rp (CVE-2026-109619). The original research is published at calif.io.

[1]“GitLab helps remediate critical PHP flaws,” GitLab. about.gitlab.com
[2]“Technical Advisory: PHP2Shell Pre-Auth RCE,” Bitdefender. bitdefender.com
[3]“php2shell: Frequently Asked Questions,” Tenable. tenable.com
[4]“PHP2Shell RCE Exploited,” watchTowr Labs. watchtowr.com
[5]“CVE-2026-109618 & CVE-2026-109619,” Horizon3.ai. horizon3.ai
[6]“The internet is having a very bad cybersecurity day,” TechCrunch, 21 October 2026. techcrunch.com