Minaxi Parmar
10 min read
PHP2Shell Critical RCE Vulnerabilities: Threat Analysis & Remediation Guide
10:44

What Is PHP2Shell and Why Is It Critical?

Newly disclosed critical PHP vulnerabilities - collectively known as PHP2Shell (CVE-2026-109618 and CVE-2026-109619)  - represent a grave threat to global internet infrastructure. Both security flaws carry a CVSS v4.0 rating of 9.2 (Critical) and allow unauthenticated Remote Code Execution (RCE).

To understand the blast radius, consider that PHP powers approximately 70% of all websites. This includes dominant Content Management Systems (CMS) like Magento, WordPress, Drupal, and Joomla, web hosting control panels like cPanel and Plesk, and countless enterprise applications that silently bundle PHP binaries.

PHP2Shell is uniquely dangerous because an unauthenticated attacker can trigger these vulnerabilities during initial HTTP(S) request startup, before any application code, input validation, or login mechanisms execute. As a result, every web-facing PHP runtime must be evaluated as immediately exposed.

Discovery, Embargo Leak, and Active Exploitation

The discovery and release cycle of PHP2Shell highlights a seismic shift in the threat landscape:

  • AI-Assisted Discovery: The vulnerabilities were independently identified in August 2026 by security firm Calif (using OpenAI's GPT-5.6 Sol model as part of the "Patch the Planet" initiative) and cloud security vendor Wiz (using Gemini 4 Argon and GPT-5.6 Sol alongside custom research tools).
  • Leaked Disclosure & Pre-Patch Exploitation: A prematurely published proof-of-concept video, alongside leaks on Hacker News and social media on October 20, 2026, destroyed the embargo. Amazon Threat Intelligence telemetry from MadPot confirmed active exploitation attempts dating back to October 17, four days prior to official vendor patch availability.
  • Global Operational Impact: Following advisories from CERT-EU, the UK National Cyber Security Centre (NCSC), and the US NSA, organisations worldwide instituted emergency downtime. High-profile platforms—including Wikimedia supporting services, the Internet Archive, French Interior Ministry sites, Danish national education systems, Finnish government web services, and Dutch government portals—were forced offline to mitigate risk prior to patching.

Technical Breakdown: Mechanics of CVE-2026-109618 & CVE-2026-109619

The two vulnerabilities stem from flaws in how the PHP engine manages memory exhaustion and global state across request lifecycles.

CVE-2026-109618 (Out-of-Memory Handling & Memory Corruption):

  • Mechanics: When PHP parses incoming request data (such as application/x-www-form-urlencoded or multipart form data), internal functions like _zend_hash_str_add_or_update_i() update hash table entry counters (nNumUsed and nNumOfElements) before allocating memory for the string key via zend_string_init().
  • Exploitation Path: If the key allocation exceeds PHP's memory_limit, PHP aborts execution by invoking longjmp(). This leaves an uninitialised bucket entry in the global $_POST array while its counters reflect that the entry exists. During request shutdown, PHP attempts to clean up the array by reading the uninitialised bucket memory. By using heap grooming techniques (sending forged binary payloads in preceding parameter fields), an attacker populates this uninitialised memory with arbitrary pointers. PHP interprets these bytes as valid data structures and executes the attacker's destructor callback - calling functions like system() with an attacker-controlled command string.

CVE-2026-109619 (Lingering / Stale Global State Flaw):

  • Mechanics: PHP worker processes (such as PHP-FPM or Apache mod_php workers) process multiple HTTP requests sequentially over their lifecycle. Global state variables can retain pointers to memory allocated for a specific request. If a fatal error occurs and memory is freed without resetting these internal global pointers, a "use-after-free" condition is created across request boundaries.
  • Exploitation Path: Features like session.upload_progress.enabled (which is enabled by default in PHP) parse upload progress during request startup before application code runs or session_start() is called. A subsequent request hitting the same web worker process can interact with stale state prior to normal variable initialisation, allowing an attacker to achieve unauthenticated remote code execution across request boundaries. (On PHP 8.5, fatal error backtrace handling presents an additional vector via fatal_error_backtraces).

Affected PHP Versions and Safe Upgrade Targets

All active PHP branches are affected and require immediate updates to official fixed releases.

PHP Branch Support Status Safe Patched Version Recommended Action

8.5

Active Support 8.5.12 Update immediately
8.4 Active Support 8.4.27 Update immediately
8.3 Security Fixes Only 8.3.36 Update immediately
8.2 Security Fixes Only 8.2.35 Update immediately
8.1 or older End-Of-Life (EOL) None (Upstream) Migrate or apply vendor backports

 

Warning Regarding EOL Versions and Third-Party Repositories:

  • Minimal Source Backports: Upstream pre-compiled binaries are not provided for End-of-Life branches (PHP 8.1, 8.0, 7.4). However, the PHP security team published minimal source-code backports for PHP 7.4, 8.0, and 8.1 for organisations that compile PHP from source.
  • Repository Delays: Volunteer-maintained package repositories (such as rpms.remirepo.net) do not receive embargoed fixes and will not have updated packages on release day. Systems relying on these repositories must immediately switch to official distribution-maintained LTS packages or build patched binaries from source.

Actionable 3-Step Remediation Strategy

Security operations and IT infrastructure teams should execute this remediation plan immediately.

Identify all environments running PHP runtime engines - including PHP-FPM, Apache mod_php, php-cgi, FrankenPHP, and LiteSpeed. Do not limit discovery to standard web servers; search container registries, CI/CD deployment pipelines, hosting control panels, and third-party software that embeds standalone PHP binaries (php.exe, php-cgi.exe).

Use the following platform-specific audit commands to verify installed PHP packages and check if vendor changelogs reflect patches for both CVEs:

  • Ubuntu / Debian:
dpkg -l | grep php
apt changelog php[VERSION_NUMBER]-cli | grep -E
"CVE-2026-109618|CVE-2026-109619"
  • RHEL / CentOS / Rocky Linux / AlmaLinux:
rpm -qa | grep php
rpm -q php-cli --changelog | grep -E "CVE-2026-109618|CVE-2026-109619"
  • Alpine Linux Containers:
apk info | grep php

Step 2: Apply Patches Immediately

Update all active PHP runtimes to their designated safe release targets (8.2.35, 8.3.36, 8.4.27, or 8.5.12) or install verified Linux distribution packages that backport fixes for both CVEs. Patching the underlying engine is the only complete remediation - Do not delay.

Step 3: Restart Web Workers & Rebuild Container Images

  • Restart Service Pools: Applying a binary update on disk does not update running memory. Perform a full service restart of all web server processes and upstream worker pools (e.g., systemctl restart php-fpm, systemctl restart apache2) to flush active workers executing old runtime code.
  • Rebuild Container Images: Rebuild container images directly from patched upstream base images. Patching a live container instance without updating the base image leaves deployment pipelines exposed to redeploying vulnerable runtimes.

Miss these steps and you could still be exposed.

Detecting Exploitation: Log Analysis & Telemetry Signals

Because exploitation occurs prior to script execution, standard application-level logging will not catch attack attempts. Security engineering teams should hunt for indicators across three distinct layers:

  • PHP Error Logs (Memory Exhaustion Pre-Initialisation): Look for memory exhaustion errors explicitly occurring in Unknown on line 0. This indicates a crash during engine request startup:

    PHP Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 3500032 bytes) in Unknown on line 0

Correlate these errors with segmentation faults in web server error logs (e.g., Apache AH00052: child pid ... exit signal Segmentation fault (11)).

  • Process Lineage Anomalies: Monitor endpoint detection and response (EDR) telemetry for web worker accounts (www-data, apache, nobody) spawning child shell processes or network utilities

    apache2 (www-data) -> sh -c ... -> bash -> wget/curl
  • Web Application Firewall (WAF) & Proxy Signals: Inspect incoming HTTP(S) request bodies at the edge or reverse proxy for:

- Form submissions (application/x-www-form-urlencoded) containing unusually long parameter names (e.g., parameter keys ~3.5 MB in length).

- Form submissions containing raw binary payload strings or non-printable null bytes in parameter values associated with empty field names.

Mitigations & Operational Workarounds

While temporary configuration adjustments exist to restrict specific attack vectors while patches are deployed, no configuration workaround fully cures these vulnerabilities. If temporary mitigations are deployed, teams must understand the following technical operational caveat:

  • Isolation of Unpatched Assets: If immediate patching or verified reverse-proxy boundary controls (WAF rules filtering oversized form field names) cannot be applied, organisations should follow direct guidance from CERT-EU, the UK NCSC, and the NSA: isolate internet-facing applications or take unpatched PHP systems temporarily offline until vendor patches can be installed and verified.

Unsure if your environment was exposed?

If you suspect active exploitation, observe anomalous outbound traffic, or need immediate incident response support, contact our security team right away. We can assist with forensic triage, rapid runtime containment, and patch verification.

Subscribe to our Blog

Request more information

Contact Foregenix for strategic advisory 

Minaxi Parmar
Minaxi Parmar

Minaxi has accumulated extensive experience with banking and payment systems used in the financial services industry and the infrastructure and processes that underpin global electronic payments. She has an in-depth understanding of Card Scheme specific regulatory and security standards particularly focused on eCommerce businesses. Minaxi has performed over one hundred (100) PFI related investigations within a wide range of industries world-wide.

See All Articles
SUBSCRIBE

Subscribe to our blog

Security never stops. Get the most up-to-date information by subscribing to the Foregenix blog.