PHP2Shell: Comprehensive Reference Investigation into Core PHP RCE Crisis (CVE-2026-109618 & CVE-2026-109619)
1. Executive Summary & Threat Landscape
Section titled “1. Executive Summary & Threat Landscape”| Technical Metric / Property | Specification & Assessment |
|---|---|
| CVE Identifiers | CVE-2026-109618 & CVE-2026-109619 |
| CVSS 4.0 / 3.1 Score | 9.2 (CVSS:4.0) / 9.8 (CVSS:3.1) (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H) |
| Hermes Threat Score (HTS) | 98 / 100 (Maximum velocity: automated mass exploitation actively weaponized) |
| Hermes Asset Severity (HASS) | 94 / 100 (Systemic exposure across global cloud and on-premises infrastructure) |
| Target Ecosystems | WordPress, Drupal, Joomla, MediaWiki (Wikipedia), PrestaShop, Magento, Nextcloud, Laravel, Symfony |
| Vulnerable Versions | All PHP versions from 5.4.0 through 8.4 (PHP 5.x, 7.x, 8.0, 8.1, 8.2 $\le 8.2.26$, 8.3 $\le 8.3.14$, 8.4 $\le 8.4.1$) |
| Fixed Official Versions | PHP 8.4.27, PHP 8.3.36, PHP 8.2.35, PHP 8.5.12 |
| Discovery & Coordination | Calif (Patch the Planet / OpenAI), Wiz Research, Quarkslab, The PHP Foundation, Cloudflare |
2. The AI Turning Point in Exploit Engineering
Section titled “2. The AI Turning Point in Exploit Engineering”For over 14 years, the underlying flaws in PHP2Shell lay undiscovered and unexploited in the PHP codebase. Chaining them into reliable exploits required traversing an extraordinarily complex labyrinth: manipulating Zend allocator slabs (emalloc/efree), surviving FastCGI request cycles, and coordinating cross-worker shared memory synchronization.
graph TD A["Traditional Human Research"] -->|"Complexity Barrier"| B["Dormant flaws for 14 years<br/>(since PHP 5.4.0)"] C["Frontier AI Models<br/>(GPT-5.6 Sol & Gemini 4 Argon)"] -->|"Semantic analysis + Targeted Fuzzing"| D["Automated heap layout modeling"] D --> E["Cross-target adaptation in hours<br/>(WordPress, Drupal, Joomla)"] E --> F["Operational PHP2Shell Weaponization"]Frontier AI models (GPT-5.6 Sol used by Calif in OpenAI’s Patch the Planet program, and Gemini 4 Argon leveraged by Wiz Research via Wiz Atlas) broke through this barrier:
- Automated Cross-Request Heap Modeling: AI models simulated cross-request memory layout reallocations in minutes, a feat that previously demanded months of arduous GDB debugging.
- Polymorphic Exploit Generation: AI automated adapting exploits across divergent OS slab layouts, PHP compilation flags, and architectures (Debian, Alpine, RHEL).
- Economics of Vulnerability Research: A single researcher equipped with a frontier model accomplished in days what once required months of effort by a world-class security team.
3. Deep Technical Internals: The 4 Exploitation Primitives
Section titled “3. Deep Technical Internals: The 4 Exploitation Primitives”Joint research by Wiz, Calif, and OpenAI reveals that PHP2Shell is not a single bug, but four major memory corruption primitives unified under two CVE identifiers:
Bug 1: Session Upload-Progress Unserializer Use-After-Free (BG(unserialize))
Section titled “Bug 1: Session Upload-Progress Unserializer Use-After-Free (BG(unserialize))”CVE-2026-109618 — Pre-auth RCE demonstrated on WordPress, Drupal, and Joomla
During HTTP request startup, PHP parses multipart/form-data bodies in main/rfc1867.c within a pre-initialization window, before normal modules are loaded.
- If upload progress tracking is active (
session.upload_progress.enabled = 1), the Session module decodes session state early. - The decoder stores request-owned internal bookkeeping in the global executor variable
BG(unserialize). - By transmitting specially crafted, oversized boundary chunks, an attacker forces an out-of-memory (OOM) fatal error.
- The OOM error abruptly destroys the request heap (
zend_mm_shutdown()), but leavesBG(unserialize)pointing to freed memory. - On a subsequent request handled by the same PHP worker, PHP consumes this reclaimed memory as valid unserializer structures, granting arbitrary memory write and control-flow hijacking.
Bug 2: Remote Process-Memory Disclosure (Heartbleed-Style)
Section titled “Bug 2: Remote Process-Memory Disclosure (Heartbleed-Style)”CVE-2026-109618 — Unauthenticated live memory extraction
This primitive allows an unauthenticated remote attacker to extract sensitive memory directly from the PHP process:
- During RFC 1867 startup, upload progress handling publishes a session ID into
PS(id). - An allocation failure aborts the request before cleanup completes, freeing the heap and leaving
PS(id)pointing to the freed allocation. - A subsequent multipart request handled by the same worker reaches the upload-progress cleanup path before standard session initialization resets the pointer.
- PHP trusts this stale pointer and length as a live
zend_string, and URL-encodes the reclaimed heap contents into theSet-Cookie: PHPSESSID=...response header. - The attacker receives live process memory containing passwords, database credentials, AWS/GCP tokens, and session data from other users’ requests—even if the application never calls
session_start().
Bug 3: Fatal-Error Backtrace Cross-Request Use-After-Free (EG(last_fatal_error_backtrace))
Section titled “Bug 3: Fatal-Error Backtrace Cross-Request Use-After-Free (EG(last_fatal_error_backtrace))”CVE-2026-109619 — Pre-auth RCE demonstrated on Drupal
In vulnerable versions, PHP retains the backtrace of the most recent fatal error in EG(last_fatal_error_backtrace).
- When an OOM fatal error occurs, the request heap is destroyed without undefining this global executor pointer.
- The worker survives with a global pointer referencing memory from the previous request.
- When that same worker emits a diagnostic early in the subsequent request, it accesses this dangling pointer.
- By grooming the heap beforehand, the attacker directs execution flow into controlled shellcode.
Bug 4: Cross-Worker OPcache Type Confusion (CG(map_ptr_last))
Section titled “Bug 4: Cross-Worker OPcache Type Confusion (CG(map_ptr_last))”CVE-2026-109619 — Pre-auth RCE demonstrated on WordPress
OPcache persists compiled PHP bytecode structures in shared memory (SHM) and assigns indices into per-worker runtime-pointer maps:
- During
zend_accel_script_persist(), PHP advances the process-local frontierCG(map_ptr_last). - The corresponding shared frontier is published only after persistence finishes.
- An allocation failure between these two events leaves the process-local advance intact while the shared state still marks those slots as free.
- When another worker reuses one of those slots for a different object type, stale metadata resolves to a mismatched structure type (type confusion).
- This corrupts shared OPcache memory, allowing attackers to overwrite cached bytecode executed by all workers on the server.
4. In-The-Wild Telemetry & Crisis Timeline (Hours 0 to 12)
Section titled “4. In-The-Wild Telemetry & Crisis Timeline (Hours 0 to 12)”Embargo Collapse Timeline
Section titled “Embargo Collapse Timeline”- Oct 20, 2026, 15:20 UTC: Anonymous post on Hacker News leaks zero-day RCE details in core PHP.
- Oct 20, 2026, 18:00 UTC: Attack surface firm watchTowr validates exploitability and reproduces CVE-2026-109618.
- Oct 21, 2026, 07:43 UTC: Active scanning detected in the wild. Cloudflare telemetry intercepts initial trains of malformed multipart POST requests probing for memory exhaustion.
- Oct 21, 2026, 08:48 UTC: Remi Collet (key PHP packager for RHEL/CentOS) announces day-0 compiled packages cannot be delivered immediately.
- Oct 21, 2026, 10:35 UTC: European Precautionary Blackouts: Dutch Parliament (Tweede Kamer), NCSC-NL, and tech news outlets Tweakers.net and Security.NL take public portals offline.
- Oct 21, 2026, 14:00 UTC: Official patched releases go live (PHP 8.4.27, 8.3.36, 8.2.35, 8.5.12). Cloudflare, AWS, Akamai, and Vercel roll out emergency edge mitigations.
Why Standard WAFs Fail: The Cloudflare “Full Transaction Detection” Model
Section titled “Why Standard WAFs Fail: The Cloudflare “Full Transaction Detection” Model”Traditional WAF regexes inspect only incoming request headers. Attackers bypass them easily by altering boundary padding or injecting non-standard multipart headers supported by rfc1867.c.
- Cloudflare’s Full Transaction Detection: Correlates incoming request patterns with the origin server’s HTTP response in real time.
- If a multipart POST triggers an HTTP 500 status code accompanied by a
Set-Cookie: PHPSESSIDheader exceeding standard hash lengths (32 characters), Cloudflare drops the response immediately at the edge before it reaches the adversary, preventing heap data leakage.
5. DFIR Forensic Investigation Guide
Section titled “5. DFIR Forensic Investigation Guide”Incident responders and SOC analysts should examine the following forensic artifacts to detect PHP2Shell exploitation attempts:
1. Web Server Access Logs (access.log Nginx / Apache)
Section titled “1. Web Server Access Logs (access.log Nginx / Apache)”Look for high-frequency multipart POST requests targeted at non-upload endpoints resulting in 500 or 502 status codes:
# Search for suspicious multipart POST requests returning HTTP 500/502grep -E 'POST .* HTTP/[0-9.]+" (500|502)' /var/log/nginx/access.log | grep -i "multipart"
# Identify unusually large response headers/payloadsawk '($9 ~ /500/ && $10 > 50000) {print $1, $4, $7, $9, $10}' /var/log/nginx/access.log2. Leaked Memory Detection in Session Cookies
Section titled “2. Leaked Memory Detection in Session Cookies”Detect oversized PHPSESSID headers indicative of process memory exfiltration:
# Grep for abnormal session cookie sizes in access logsgrep -E 'Set-Cookie:.*PHPSESSID=[a-zA-Z0-9%_-]{64,}' /var/log/nginx/access.log /var/log/apache2/access.log3. PHP-FPM Error Logs (php-fpm.log)
Section titled “3. PHP-FPM Error Logs (php-fpm.log)”Look for consecutive worker crashes on SIGSEGV/SIGABRT and pre-script OOM errors:
[21-Oct-2026 07:44:12] WARNING: [pool www] child 14208 exited on signal 11 (SIGSEGV) after 1.204512 seconds from start[21-Oct-2026 07:44:15] ERROR: [pool www] child 14210 said into stderr: "PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 67108864 bytes) in Unknown on line 0"[21-Oct-2026 07:44:18] WARNING: [pool www] server reached pm.max_children setting (50), consider raising itKey indicators:
- Fatal OOM errors occurring
in Unknown on line 0(confirms crash during C-level SAPI parsing before script load). - Repeated worker cycling on signal 11 (
SIGSEGV).
4. Linux Core Dump Analysis (GDB)
Section titled “4. Linux Core Dump Analysis (GDB)”If core dumps are enabled (/var/lib/systemd/coredump/ or /tmp/):
gdb /usr/sbin/php-fpm /tmp/core.php-fpm.* -ex "bt" -ex "quit"Stack signature: Stack frames referencing php_rfc1867_callback, multipart_buffer_read, zend_mm_alloc_small, or _php_session_rfc1867_callback.
5. Suspicious Child Process Execution
Section titled “5. Suspicious Child Process Execution”PHP-FPM should never spawn interactive command interpreters or network download utilities:
# Audit active PHP child processes on hostps -eo pid,ppid,user,args | awk '$2 ~ /^[0-9]+$/ {cmd="ps -p "$2" -o comm="; cmd | getline pcomm; close(cmd); if (pcomm ~ /php-fpm|apache2|httpd/) print $0}'6. Ready-to-Deploy Detection Rules
Section titled “6. Ready-to-Deploy Detection Rules”Suricata Rule: Memory Leak Detection (Oversized PHPSESSID)
Section titled “Suricata Rule: Memory Leak Detection (Oversized PHPSESSID)”alert http any any -> any any ( msg:"HERMES CTI - PHP2Shell Memory Leak Detected (Oversized PHPSESSID)"; flow:established,to_client; http.response_header; content:"Set-Cookie|3A|"; nocase; content:"PHPSESSID="; distance:0; pcre:"/PHPSESSID=[a-zA-Z0-9%_-]{128,}/"; threshold:type limit, track by_src, count 1, seconds 60; classtype:attempted-recon; sid:2026109618; rev:1; )Suricata Rule: Abusive Multipart Boundary Exhaustion
Section titled “Suricata Rule: Abusive Multipart Boundary Exhaustion”alert http any any -> any any ( msg:"HERMES CTI - PHP2Shell Malformed Multipart Exhaustion Attempt"; flow:established,to_server; http.method; content:"POST"; http.header; content:"multipart/form-data"; nocase; pcre:"/boundary=["']?[^]{70,}/i"; classtype:web-application-attack; sid:2026109619; rev:1; )Sigma Rule: Cascade OOM and PHP-FPM Worker Crashes
Section titled “Sigma Rule: Cascade OOM and PHP-FPM Worker Crashes”title: PHP2Shell Post-Exploitation Memory Exhaustion and Worker Crashid: c4f2e968-382a-4bc1-9011-php2shell001status: criticaldescription: Detects pre-execution fatal out-of-memory errors and worker crashes resulting from PHP2Shell exploitation.logsource: product: linux service: php-fpmdetection: selection_oom: message|contains: - 'PHP Fatal error: Allowed memory size of' - 'exhausted (tried to allocate' - 'in Unknown on line 0' selection_sigsegv: message|contains: - 'child' - 'exited on signal 11 (SIGSEGV)' timeframe: 1m condition: selection_oom or (selection_sigsegv | count() > 5)falsepositives: - Misconfigured legitimate batch upload scriptslevel: criticaltags: - attack.initial_access - attack.t1190YARA Rule: Calif Exploit Payload and Stagers
Section titled “YARA Rule: Calif Exploit Payload and Stagers”rule Exploit_PHP2Shell_Calif_Payload { meta: author = "Hermes Codex Threat Intelligence" description = "Detects artifacts, stagers, and heap spray payloads from the Calif PHP2Shell framework" reference = "CVE-2026-109618 / CVE-2026-109619" date = "2026-10-21" severity = "CRITICAL" strings: $header_boundary = "---------------------------php2shell" ascii $zend_spray_1 = { 48 89 E5 48 83 EC ?? 48 8B 05 ?? ?? ?? ?? 48 85 C0 74 } $rfc1867_target = "upload_progress_" ascii $str_corrupt = "BG(unserialize)" ascii wide condition: 2 of them or ($header_boundary and $rfc1867_target)}Falco Rule: Unauthorized Shell Execution from PHP
Section titled “Falco Rule: Unauthorized Shell Execution from PHP”- rule: PHP Worker Spawned System Shell or Download Utility desc: Detects an interactive shell or network download binary spawned by a PHP worker condition: > spawned_process and (proc.pname in (php-fpm, apache2, httpd, php-cgi)) and (proc.name in (sh, bash, dash, zsh, curl, wget, nc, python, python3, perl)) output: > Critical PHP2Shell Alert: Suspicious child process spawned by %proc.pname (command=%proc.cmdline user=%user.name pid=%proc.pid container=%container.id) priority: CRITICAL tags: [security, rce, php2shell, mitre_execution]7. Turnkey Remediation & Hardening Directives
Section titled “7. Turnkey Remediation & Hardening Directives”Immediate Action Plan (Execution Window: < 2 Hours)
Section titled “Immediate Action Plan (Execution Window: < 2 Hours)”-
Step 1: Reverse-Proxy Perimeter Block (WAF / Reverse-Proxy) If updating packages immediately is not feasible, block unneeded multipart POST requests upstream:
Nginx:
if ($http_content_type ~* "multipart/form-data") {return 403;}Apache HTTPD:
RewriteEngine OnRewriteCond %{HTTP:Content-Type} multipart/form-data [NC]RewriteRule ^ - [F] -
Step 2: Harden PHP Runtime Configuration (
php.ini) Disable session upload progress immediately across all pools:session.upload_progress.enabled = 0session.upload_progress.cleanup = 1session.use_strict_mode = 1Restart PHP-FPM services afterwards:
systemctl restart php*-fpm. -
Step 3: Deploy Official Security Patches Upgrade your PHP runtimes to patched releases:
- Branch 8.4: Version 8.4.27
- Branch 8.3: Version 8.3.36
- Branch 8.2: Version 8.2.35
- Branch 8.5: Version 8.5.12
-
Step 4: Managing End-of-Life Deployments (PHP 5.x, 7.x, 8.0, 8.1) For legacy infrastructure:
- No official patches are released by The PHP Foundation.
- Isolate these hosts into private subnets without direct internet exposure.
- Route all ingress traffic through managed edge WAFs with full transaction inspection.
8. Strategic Conclusion
Section titled “8. Strategic Conclusion”PHP2Shell represents a defining milestone in web security, rivaling Heartbleed (2014) and Log4Shell (2021). It proves that frontier AI has drastically compressed the time from theoretical discovery to operational weaponization of deep memory corruption flaws.
Defenders must recognize that software-level WAFs within applications are powerless when flaws execute in the low-level C parser. Resilient posture demands kernel-enforced sandboxing (Linux namespaces, seccomp-bpf, read-only root filesystems) and automated runtime behavioral inspection.