On October 21, 2026, PHP released emergency updates for two critical vulnerabilities in the interpreter itself. An unauthenticated attacker can reach the vulnerable code while PHP is preparing or cleaning up a request — in the highest-risk mod_php path, before the application gets a chance to run.
That last detail matters. WordPress can be fully updated. Laravel middleware can reject the request. The route can require authentication. None of those controls help when the memory corruption happens inside PHP before application code begins.
A harmless index.php is enough. The vulnerability lives below it.
The two issues are CVE-2026-109618, an out-of-memory state-corruption bug, and CVE-2026-109619, a family of stale worker-global state bugs. Together they became known as PHP2Shell.
What PHP2Shell Actually Is
PHP normally treats each HTTP request as an isolated unit. Request memory is allocated, the request runs, cleanup resets internal state, and the request heap is released. The worker process then handles another request.
PHP2Shell breaks that lifecycle in two related places:
| CVE | Failure | Role in the demonstrated chain |
|---|---|---|
| CVE-2026-109618 | An out-of-memory bailout leaves partially initialized request state behind | Interrupts request A while cleanup invariants are broken |
| CVE-2026-109619 | Worker-global fields retain pointers into memory owned by a completed request | Lets request B consume request A’s freed memory |
Both issues are rated Critical, CVSS 9.2. They require no account and no user interaction. Exploit reliability depends on the PHP build, SAPI, worker scheduling, extensions, frontend behavior, and heap layout, which is why the CVSS attack complexity is high. That complexity changes reliability; it does not remove the impact.
The broken invariant is simple:
Once a request ends, nothing reachable from the persistent worker may still point into that request’s heap.
The vulnerable paths violate that rule. State outlives the memory backing it, and a later request can place new attacker-controlled data at the same addresses.
How Two Requests Become Code Execution
The reproduction lab combines the out-of-memory and stale-state failures through PHP’s session upload-progress handling.
| |
The first request is the producer. It creates state that remains reachable after the request should have disappeared. The second request is the consumer. It reaches that stale state before ordinary request initialization replaces it.
The same-worker requirement explains why a lab with one Apache prefork child is deterministic while a busy production server may require repeated attempts. More workers reduce the chance that two requests land on the right process in sequence. They do not fix the lifetime bug.
mod_php path runs during multipart request startup. Authentication middleware, CSRF checks, upload handlers, framework routing, and security plugins have not executed yet.Resolving ASLR
Corrupting memory is only part of a reliable exploit. The attacker also needs useful addresses despite Address Space Layout Randomization.
The lab’s PHP 8.3.35, 8.4.26, and 8.5.11 profiles use repeated HTTP request pairs to disclose the Zend heap base and the loaded libphp.so base. Exact offsets from the pinned binary then locate the required PHP functions and structures.
PHP 8.2.34 behaves differently: it clears the relevant cookie-send state and prevents the same in-band disclosure. That profile reads the two base addresses from /proc/1/maps inside the researcher’s own Docker container, then passes only those values to the restricted runner.
This distinction is important. The 8.2 profile proves the corruption and controlled-call primitive in the lab. It does not prove a remote, ASLR-independent exploit for arbitrary PHP 8.2 installations.
What the PoC Reproduced
The lab records successful command execution on four exact official Docker images:
| Exact vulnerable image | Address acquisition | Docker result | Kubernetes result |
|---|---|---|---|
php:8.2.34-apache | Local Docker-assisted lookup | www-data proof | Not implemented |
php:8.3.35-apache | HTTP-only disclosure | www-data proof | Not implemented |
php:8.4.26-apache | HTTP-only disclosure | www-data proof | Verified |
php:8.5.11-apache | HTTP-only disclosure | www-data proof | Not implemented |
The profiles are pinned to immutable image digests and linux/amd64. Symbol offsets and heap geometry are build-specific. A native distribution package, ARM image, PHP-FPM build, different extension set, or alternative compiler configuration can require an entirely different layout.
The proof action is deliberately constrained. The command is fixed in source to:
| |
It writes the Apache worker identity to an isolated ephemeral volume. A read-only PHP page displays the result:
| |
The runner accepts only target:80, 127.0.0.1:8088, or localhost:8088; it cannot accept an arbitrary payload from the command line. The automatic workflow uses an internal Docker network, drops all Linux capabilities, mounts a read-only root filesystem, and never exposes the Docker socket.
Reproducing It Safely
The browser workflow binds the vulnerable Apache container to loopback only:
| |
After confirming that http://127.0.0.1:8088/ displays php-lab, run the fixed proof from a second terminal:
| |
Refresh the page, collect the result, and remove the vulnerable container and proof volume:
| |
Do this only in the included local lab or another environment explicitly authorized for security testing. Never expose the vulnerable image through a public interface, Ingress, NodePort, LoadBalancer, or shared production network.
Who Is Exposed?
PHP’s October 21 security notice treats every PHP installation serving web requests as potentially at risk, including:
- Apache with
mod_php - PHP-FPM
php-cgi- FrankenPHP
- LiteSpeed / LSAPI
The risk is highest for mod_php. The complete pre-application HTTP chain has been demonstrated there with ordinary prefork configurations, including configurations with multiple workers.
PHP-FPM is not automatically safe. A child normally exits when early request startup fails, which breaks the exact mod_php sequence. The stale-state advisory also describes a validated FPM path where application execution publishes state, a fatal error interrupts it, and a later upload-progress request consumes the stale value. That route depends more heavily on application behavior, but it still crosses the same request-lifecycle boundary.
The exact lab PoC validates Apache mod_php only. It should not be described as a universal exploit script for every SAPI.
Patch Matrix
The maintained branches received emergency releases on October 21, 2026:
| PHP branch | Vulnerable upstream versions | First release with both fixes |
|---|---|---|
| 8.2 | < 8.2.35 | 8.2.35 |
| 8.3 | < 8.3.36 | 8.3.36 |
| 8.4 | < 8.4.27 | 8.4.27 |
| 8.5 | < 8.5.12 | 8.5.12 |
PHP 8.1 and older are end-of-life upstream. PHP made minimal source backport branches available for 7.4, 8.0, and 8.1, and some Linux distributions or LTS vendors may ship their own patched packages. An old-looking upstream version string can therefore contain a vendor backport; verify the package revision against that vendor’s security notice.
Unsupported versions are not unaffected because they are missing from the maintained-branch table. Upgrade them to a maintained PHP branch or obtain a confirmed vendor backport.
Patching Is More Than Installing a Package
Replacing files on disk does not replace a vulnerable PHP process already serving requests. The correct response is:
- Inventory every runtime. Include Apache modules, FPM pools, CLI daemons, queue workers, containers, pods, appliances, control panels, and software that bundles its own PHP.
- Install a release containing both fixes. Use the fixed upstream release or a package explicitly confirmed by your vendor.
- Restart or roll every long-lived process. Restart Apache and the PHP-FPM master and children; rebuild and redeploy container images; roll every pod and replica.
- Verify the runtime that receives web traffic. A patched
/usr/bin/phpCLI says nothing about a different FPM binary, Apache module, container layer, or appliance runtime. - Check for compromise. Patching closes the vulnerable path. It does not remove a web shell, stolen credential, scheduled task, or other persistence created before the update.
For containers, rebuild from the fixed base and verify the image digest running in every workload. Restarting a container from the same vulnerable image merely starts vulnerable code again.
| |
php -v in your shell.Temporary Controls While You Patch
PHP explicitly states that there is no complete configuration mitigation. The following settings break known links in the chain and can buy time while the update is being deployed.
Disable Session Upload Progress
If the application does not use PHP’s session-backed upload-progress feature, disable it in administrative startup configuration:
| |
Restart every worker afterward. This blocks the demonstrated early session producer and consumer. It does not cover other stale error, object, exception, or extension state addressed by CVE-2026-109619.
Do not rely on ini_set() in application code. Request-body processing can reach the vulnerable path before the script runs.
Remove the Predictable PHP Memory-Limit Failure
The official temporary guidance for CVE-2026-109618 is counterintuitive:
| |
Enforce it where an application or per-directory configuration cannot turn a finite limit back on. This removes the controlled per-request PHP OOM used by confirmed exploit paths. It also removes an application-level resource boundary, so pair it with conservative proxy request limits, operating-system or container controls, and monitoring.
An underlying allocation can still fail. Container memory limits are useful availability boundaries but are not a complete vulnerability fix. PHP specifically warns against substituting RLIMIT_AS or RLIMIT_DATA, because failed mmap() calls can reach the vulnerable bailout path.
PHP 8.5 Fatal Backtraces
On an unpatched PHP 8.5 deployment, disable the producer used by the confirmed fatal-backtrace path:
| |
Restart all workers. This setting covers that producer only.
Reject Multipart Where It Is Not Needed
A reverse proxy or WAF can reject multipart/form-data before PHP parses it. This is useful for routes that never accept forms or uploads. Any allowlisted upload route remains exposed, intermediaries may parse malformed multipart syntax differently from PHP, and PHP 8.4’s explicit body parsing creates additional method considerations.
Treat edge filtering as time bought for deployment, not as proof that PHP is safe.
A Separate Double-Free Still Needs Triage
The emergency releases fix the two published CVEs according to PHP’s advisories. A separate memory-management report appeared during the same disclosure window.
In the research thread linked here, Elise reported an AddressSanitizer-detected double-free on PHP 8.4.25 and explicitly concluded that it was a different vulnerability. The researcher later reproduced the crash on PHP 8.5.12, using the CLI with USE_ZEND_ALLOC=0, reported a three-line reproducer privately to PHP security, and reiterated that the bug was separate and had existed for some time.
As of October 21, 2026, that evidence supports a narrow statement: a separately reported double-free remained reproducible in the patched 8.5.12 release under a sanitizer test configuration. Public information does not yet establish that the bug is remotely reachable, crosses a security boundary, works with the normal Zend allocator, leads to code execution, or belongs to either PHP2Shell CVE.
The practical response is to deploy the emergency updates now, retain low-cost hardening such as disabling unused session upload progress, and monitor upstream for the separate report’s triage and any follow-up release.
Detection and Incident Response
Memory-corruption attempts often crash workers while an attacker tunes heap layouts. Review the period before and during patching for:
- Apache or PHP-FPM workers exiting on
SIGSEGV,SIGABRT, or signal 11 - bursts of worker replacement, unexplained
502responses, and repeated OOM errors - unusual multipart requests reaching PHP endpoints that do not normally accept uploads
- shell, interpreter, download utility, or network-tool processes spawned by a PHP or Apache worker
- unexpected files created by the web account in document roots,
/tmp,/var/tmp, or/dev/shm - outbound network connections from PHP workers to unfamiliar destinations
- new scheduled tasks, SSH keys, users, startup units, or modified application files
Default access logs rarely preserve enough request-body detail to identify the exploit. Correlate reverse-proxy timing and status codes with PHP, Apache, kernel, container-runtime, EDR, and process-execution telemetry.
Do not stop at finding a crash. A successful command may execute before the worker dies, and Apache can replace the child quickly enough that the service appears healthy.
The Real Lesson Is Request Lifetime
PHP2Shell is not an upload bug in a CMS, and it is not a bad application calling a dangerous function. It is a broken ownership boundary inside a long-lived interpreter: request-owned memory became reachable from process-lifetime state, an exceptional path skipped cleanup, and a later request reused the memory.
That class of bug is particularly dangerous in systems built around persistent workers. A request can be over from the application’s perspective while its data is still alive from the runtime’s perspective.
Patch the interpreter, restart the workers, verify what is actually serving traffic, and investigate the exposure window. Then keep watching the separate double-free report. The two emergency CVEs have fixes; PHP’s broader memory-safety story is still moving.
References:
- PHP security notice — Critical remote code execution vulnerabilities
- CVE-2026-109618 / GHSA-w8hw-w9fx-j79w — RCE via OOM corruption
- CVE-2026-109619 / GHSA-6wmf-4rv5-p3rp — RCE via stale global state
- PHP2Shell reproducible local lab
- Elise’s separate double-free research thread
- Follow-up reproduction on PHP 8.5.12
- Follow-up clarification that the bug is separate
