PHP2Shell Explained: CVE-2026-109618, Emergency Fixes, and the 14-Year Shadow
A critical 9.2 CVSS flaw in PHP core allows unauthenticated remote code execution. How memory exhaustion bypasses safety, which versions to patch, and whether this flaw was exploited for years.
The PHP development group released emergency security updates on October 21, 2026, to address two critical remote code execution vulnerabilities in the core engine. Tracked as CVE-2026-109618 and CVE-2026-109619, and dubbed PHP2Shell by cybersecurity researchers, the flaw allows unauthenticated remote attackers to execute arbitrary commands on servers handling standard web traffic. The vulnerability scores 9.2 out of 10 on the CVSS v4.0 scale.
Public leak of exploitation details on October 20 forced the PHP team and security vendors to accelerate their disclosure schedule, moving the release forward from October 22 to October 21. Calif and Wiz independently discovered the flaws in August 2026 (Calif on August 1, Wiz reported on August 24); watchTowr reproduced the exploit and published details on October 20. OpenAI's "Patch the Planet" program also contributed to the research. Because the vulnerability exists within the low-level C codebase of the PHP interpreter rather than an individual CMS plugin or application framework, millions of production deployments running WordPress, Laravel, Drupal, and Magento face exposure until runtime binaries receive patches.
Beyond the immediate scramble to deploy updates, the flaw raises a troubling historical reality. The vulnerable code path dates back to PHP 5.4.0, released in March 2012. For 14 years, standard PHP installations harbored an unauthenticated code execution pathway that left minimal evidence in typical application logs.
The Mechanics of CVE-2026-109618 and CVE-2026-109619
PHP2Shell combines two distinct memory management defects to achieve stable remote code execution without requiring administrative credentials or prior system access.
Incoming Multipart Request
│
▼
Standard MIME Parser Allocations
│
▼
Forced Out-of-Memory (OOM) Threshold
│
▼
C longjmp() Unwinds Stack Immediately
(Standard destructor and memory cleanup skipped)
│
▼
Stale Global State Points to Freed Request Memory (CVE-2026-109619)
│
▼
Stale HashTable / Session State Consumed as Live Data -> Controlled Memory Write -> RCEThe primary flaw, CVE-2026-109618, is an out-of-memory corruption bug in request startup. A fatal error interrupts HashTable initialization before cleanup routines execute, leaving a partially built table that shutdown routines later trust. Multipart request parsing acts as the delivery vector rather than the root flaw location. When an HTTP client uploads files or streams multipart content, PHP allocates heap memory chunks to buffer headers and payload fragments. If a request deliberately pushes heap consumption past the configured memory_limit, PHP invokes its fatal error handler.
To terminate execution cleanly in C, PHP relies on longjmp() routines. A longjmp() call performs a non-local jump across the C call stack. It skips the normal cleanup sequence that frees buffers, resets pointers, and updates engine state. Along request-startup parsing paths, including multipart and URL-encoded POST handling, this sudden jump leaves memory allocations uninitialized or partially linked. Beyond code execution, this corrupted state can leak arbitrary process memory back to clients via response headers and PHPSESSID cookies, potentially exposing session tokens, credentials, or internal secrets.
CVE-2026-109619 provides the second half of the exploit chain. Certain global engine variables hold temporary references to memory allocated during request parsing. When longjmp() aborts the request, these global references are not cleared, persisting into subsequent lifecycle routines as dangling pointers. After the application performs a post-startup decode (such as session_start() or unserialize()), a structured second request consumes the stale state. An attacker can manipulate this memory layout to treat attacker-controlled data as valid internal structures, redirecting execution flow to arbitrary code execution.
The 14-Year Shadow and Historical Exploitation Risk
The technical post-mortem from security research teams highlights an uncomfortable truth: Calif confirmed that the earliest affected code path dates back to PHP 5.4.0, released in March 2012. Related memory handling issues were previously flagged in the PHP issue tracker (#78876) in 2020 and during a 2024 security review, but maintainers did not reach consensus on a safe fix at the time.
PHP is used by roughly 69% of websites whose server-side language is known (W3Techs, October 2026). Over the 14-year window, major Linux distributions, web hosting control panels, and container base images carried this code path. On Apache mod_php, a single crafted multipart POST reaches the vulnerable path before application code runs. On PHP-FPM, exploitation requires the application to perform a post-startup decode (such as session_start() or unserialize()) followed by a second multipart request, because FPM terminates a worker whose startup fails.
The characteristics of PHP2Shell make historical detection unusually difficult:
- No persistent disk artifacts: Unlike conventional web-shell attacks that write a
.phpfile intowp-content/uploadsor temporary storage, PHP2Shell executes entirely in process memory. - Ambiguous operational signatures: A failed or experimental exploit attempt produces an ordinary PHP fatal memory error or a worker segmentation fault. System administrators typically interpret these errors as routine resource exhaustion or transient application bugs.
- Silent process recycling: Under common PHP-FPM architectures, a crashed worker process is silently replaced by the master process within milliseconds. The web server merely records a transient 502 Bad Gateway status in access logs, without logging an explicit intrusion alert.
Security analysts now question whether advanced persistent threat groups discovered and weaponized this flaw years before the 2026 public leak. Amazon Threat Intelligence found an exploitation attempt dated October 17, 2026, four days before public disclosure, and Cloudflare reported early attacks on October 21 at 07:43 UTC before the patch shipped. Whether sophisticated threat actors weaponized the flaw years earlier still remains unproven, but the 14-year window and silent failure mode make prior zero-day use a distinct possibility.
Official Patches and Affected Versions
Security teams must prioritize updating the underlying PHP runtime package. Application-level adjustments do not fix the memory management routines in the interpreter.
The PHP Group issued official security updates on October 21, 2026, across all active release branches:
| Branch | Patched Version | Upstream Support Status |
|---|---|---|
| PHP 8.5 | 8.5.12 |
Active |
| PHP 8.4 | 8.4.27 |
Active |
| PHP 8.3 | 8.3.36 |
Active |
| PHP 8.2 | 8.2.35 |
Security Fixes Only |
| PHP 7.4 - 8.1 | Source backports only (no official binaries) | End-of-Life |
| PHP 5.4 - 7.3 | None | End-of-Life |
Organizations operating unsupported PHP branches will not receive automated binary updates from the upstream PHP repository. These systems depend on Linux enterprise distribution vendors (such as Ubuntu ESM, Red Hat Enterprise Linux, or Debian LTS) to provide backported patches, or must immediately migrate workloads to modern PHP versions.
Compensating Controls and Cloud Guidance
Several emergency advisories and cloud bulletins addressed interim mitigations while teams prepare runtime updates. In AWS Security Bulletin 2026-143-AWS, Amazon confirmed that while core AWS infrastructure is unaffected, customer workloads running PHP on services including Elastic Beanstalk, Amazon Linux, Lightsail, and WorkMail require patching. AWS released Elastic Beanstalk platform v4.13.12 on October 21, with a follow-on release carrying the upstream PHP fix targeted for October 22, and outlined compensating controls for AWS WAF:
- Request body filtering: Enabling the
SizeRestrictions_BODYrule in the AWS WAF Core Rule Set (CRS) managed rule group blocks oversized payloads that trigger heap exhaustion. - Session upload inspection: Implementing a custom WebACL rule drops POST requests containing
PHP_SESSION_UPLOAD_PROGRESSin the body alongsidePHPSESSIDin either the body or cookie headers.
Security analysis from watchTowr and AWS cautions that these WAF rules and php.ini tweaks (such as disabling upload progress) are virtual stopgaps rather than root fixes. They block published exploit scripts, but attackers can structure alternative multipart payloads that bypass upload progress logic entirely. Upgrading the PHP binary is the only definitive resolution. Teams managing containerized infrastructure must rebuild base images using updated repository packages and redeploy active pods.
Defensive Architecture Beyond the Runtime
The discovery of a 14-year-old flaw in the world's most ubiquitous web engine reinforces a core architectural principle: application runtimes should never operate with direct host trust.
When a memory corruption vulnerability compromises an interpreter process, defense depends on the containment boundaries surrounding that process. Organizations applying zero-trust agent containment isolate execution workers within minimal containers, apply read-only root filesystems, drop Linux capabilities, and restrict outbound network connections through strict egress proxies. These boundaries ensure that even if an attacker achieves arbitrary code execution inside PHP-FPM, they cannot pivot to adjacent infrastructure, access cloud metadata endpoints, or persist across system restarts.
Modern engineering teams must also adopt disciplined engineering guardrails across their software supply chains. Auditing dependencies at the package manager level is insufficient when interpreter binaries themselves harbor legacy vulnerabilities. Continuous patch verification, automated image scanning, and network-level containment represent the necessary standard for resilient production infrastructure.
Sources
- watchTowr Intelligence: PHP CVE-2026-109618 FAQ
- Calif Research: php2shell technical writeup
- Wiz: PHP2Shell: AI uncovers critical RCE
- W3Techs: PHP usage statistics
- AWS Security Bulletin 2026-143-AWS: PHP Web Runtimes
- AWS: Amazon Threat Intelligence identifies PHP2Shell exploitation in MadPot
- PHP Group Security Advisory: Releases 8.5.12, 8.4.27, 8.3.36, 8.2.35
- NIST National Vulnerability Database: CVE-2026-109618 Analysis