Key Takeaways
- PHP2Shell is two critical flaws, CVE-2026-109618 and CVE-2026-109619, in the PHP interpreter itself, each rated CVSS v4.0 9.2.
- Both can lead to unauthenticated remote code execution and have existed in some form since PHP 5.4.0.
- Any PHP stack is exposed, including PHP-FPM, Apache mod_php, php-cgi, FrankenPHP and LiteSpeed, so WordPress, Drupal, Magento and Laravel sites are all in scope.
- Attackers are already probing for it, and the PHP team considers mod_php the highest-risk setup.
- The only complete fix is upgrading to PHP 8.2.35, 8.3.36, 8.4.27, 8.5.12 or later. End-of-life branches get no fix.
- A WAF in block mode, origin protection and server hardening reduce exposure while you patch, but do not remove the flaw.
Every so often a vulnerability lands that isn’t about one application or one framework, but about the ground everything else is built on. PHP2Shell is one of those. Disclosed on October 21, 2026, by researchers from Calif, OpenAI and Wiz, it covers two critical flaws in the PHP interpreter itself: CVE-2026-109618 and CVE-2026-109619. Both are rated CVSS v4.0 9.2 (Critical). Both can lead to unauthenticated remote code execution. And both have been present, in one shape or another, since PHP 5.4.0, which shipped more than a decade ago.
PHP still runs close to 70% of the websites whose server-side language is known. That is the scale we are talking about. WordPress, Drupal, Joomla, MediaWiki, Magento, Laravel, and millions of custom applications all sit on top of it. A flaw this deep doesn’t care which CMS you run.
Why PHP2Shell Is Different from Typical PHP Vulnerabilities
Most memory-corruption bugs live in complicated application code, somewhere a developer made a mistake. PHP2Shell lives in PHP’s own runtime. You can be running a clean, well-audited application and still be exposed, because the weak point is one layer below anything you wrote. The researchers made the point bluntly: an endpoint that does nothing more than return “OK” can still be attacked, because the vulnerable processing happens before a single line of your code executes.
Both CVEs are classified as CWE-824, access of an uninitialized pointer. The short version of the cause is this. When PHP hits a fatal condition, most commonly running past its configured memory_limit, it doesn’t finish the current operation cleanly. It performs what PHP calls a bailout: it aborts and jumps to an error-handling boundary using longjmp(). In a handful of places, that jump happens after PHP has already published a pointer or reserved a cache slot, but before the matching cleanup runs. What’s left behind is a half-finished, stale piece of state that stays reachable after the operation has already failed.
In most production setups, a single worker process serves many requests one after another. So the next request to reach that same worker can stumble onto a pointer to memory the previous request already freed. From there, a skilled attacker can shape what sits in that freed space and turn a failed allocation into something far worse.
Easy To Trigger, Hard To Weaponize
One thing worth being honest about: setting off the bug and turning it into code execution are two very different levels of difficulty. Triggering memory exhaustion is straightforward. Turning the resulting dangling pointer into a working exploit is not. A follow-up request has to reach the exact same worker and land attacker-controlled data in precisely the right place. Get the timing or the memory layout wrong and the worker simply crashes or answers normally instead of running your command. That is why these carry a “high attack complexity” rating.
This is also where the story gets its edge. The flaws sat untouched for years partly because that weaponization work was so punishing to do by hand across different PHP versions and configurations. The research teams used frontier AI models to carry much of that adaptation load, iterating on failures and reshaping the exploit for each target in hours rather than months. Several of them have framed PHP2Shell as an inflection point: the bug is old, but the cost of exploiting it has dropped. It’s a reminder that “too complex to exploit in practice” is a moving line, not a fixed one.
How Attackers Exploit PHP2Shell
Three of the five demonstrated techniques abuse PHP’s session upload-progress feature. This feature updates session state while PHP is still parsing a multipart request body, before the application runs. That makes a crafted multipart upload a remote trigger that influences session handling and memory usage in this pre-application window. Force memory exhaustion at the right moment and cleanup is left incomplete, so later processing on the same worker meets the stale state.
The demonstrated effects span a range:
- Session decoder use-after-free: builds a large session, forces exhaustion during decoding, and leaves dangling bookkeeping that a later request trips over. Result: worker crash.
- OPcache stale class-cache pointer: leaves an unpublished class-cache slot behind, then gets a later lookup to read attacker-controlled data as internal structures. The researchers used it to redirect a file operation and read arbitrary files the worker can access, which can mean config files, database credentials, and API keys.
- Stale session module pointer: leaves PHP’s internal pointer referencing freed memory, leading to a crash when dereferenced later.
-
Stale session-ID pointer: the information-disclosure case. Attacker-influenced memory gets read back as an oversized string and returned in a
Set-Cookie: PHPSESSIDresponse header, exposing roughly 67 KB of live process memory per hit. The contents depend on what the worker was doing, and may include other users’ data. - Fatal-error backtrace use-after-free: a separate path that needs fatal-error backtraces enabled and produces a crash.
Chain the right primitives together and the end state is unauthenticated remote code execution, running in the security context of the PHP process. That is not automatically root, but it is enough to read application data, alter what the process can touch, and work toward deeper compromise.
Affected deployments include PHP-FPM, Apache mod_php, php-cgi, FrankenPHP, and LiteSpeed. The PHP security team considers mod_php the highest-risk setup, because a single unauthenticated request can trigger the attack before any application code runs.
Can a WAF Block PHP2Shell? Where It Fits and Where It Doesn’t
A WAF is a strong compensating control here, and we’ve rolled out detection and mitigation for the known exploit patterns. Crafted multipart upload requests that match these attacks are inspected and blocked for customers in block mode, alongside checks for anomalous multipart payloads, repeated session-related fields, suspicious upload-progress activity, and abnormally large PHPSESSID values in responses.
We’d rather set the expectation clearly than oversell it. Because the real mechanism is memory exhaustion driven by requests that can look a lot like ordinary uploads, no signature set can promise to catch every variation. A WAF meaningfully reduces the risk of a request reaching the vulnerable code and succeeding, and it buys you time. It does not remove the underlying flaw. Patching does.
Two practical notes for WAF users: keep block mode on so detections actually stop requests rather than just logging them, and make sure origin protection is in place so an attacker can’t skip the WAF by hitting your origin directly.
How to Fix and Mitigate PHP2Shell (CVE-2026-109618 and CVE-2026-109619)
Patch first. Upgrade PHP to 8.2.35, 8.3.36, 8.4.27, 8.5.12, or a later release. If you’re on an end-of-life branch, there is no fix coming for it, so plan the move to a supported version now.
PHP2Shell fixed versions by branch:
Harden the server while you get there. These reduce exposure but are not complete workarounds:
-
Enforce upload limits: PHP’s
post_max_sizeandupload_max_filesizeplus your web server’s own request-body size limit. -
As a stopgap on unpatched hosts, set
memory_limit = -1: this removes the attacker-controlled, in-PHP allocation failure that triggers the bug. Do not cap memory withRLIMIT_ASorulimit -v- a hard address-space limit re-creates the exact failure path the exploit relies on. To protect host RAM, use a cgroup/container memory limit instead, which kills a runaway worker outright rather than handing PHP a graceful allocation failure. Loweringmemory_limitis not a mitigation. -
On PHP-FPM, set
session.upload_progress.enabled=0which removes the trigger used by three of the five techniques. -
Consider
opcache.enable=0after compatibility testing, which closes the OPcache path. - Review whether fatal-error backtraces are enabled and follow the vendor guidance.
- Apply least privilege to the PHP process so a compromise reaches as little as possible.
Turn on upload protection. If your application accepts file uploads, enable our malicious file upload rules for stronger coverage. If your application doesn’t handle uploads at all, tell us and we’ll drop multipart/form-data requests entirely, which takes this whole attack surface off the table for you.
Watch for the signs. Correlate PHP memory-exhaustion errors and worker crashes with unusual request activity: oversized multipart payloads, excessive field counts, odd session-related parameters, and unexpectedly large PHPSESSID response values. If you suspect exploitation, treat it as both possible data disclosure and possible code execution, and check for unexpected child processes, changed application files, new persistence, and unusual outbound connections.
The Takeaway
PHP2Shell is a clean example of how a runtime’s response to an error can itself become a security boundary that fails. Stop processing at the wrong instant and stale pointers outlive the request that created them. The fix is in the patched PHP releases, and nothing short of applying them fully closes these holes. Put a WAF in front to blunt the known attacks and reduce your exposure, patch underneath to remove the flaw, and harden the server configuration to shrink what an attacker has to work with. Those three together are what actually shut the door.
- Need help closing the gap while you patch?
Prophaze’s 24×7 security team can confirm your PHP2Shell coverage, enable upload protection and block multipart requests your application does not need. Talk to Our Experts.
Frequently Asked Questions (FAQ)
1. What is PHP2Shell, and why is it a security risk?
PHP2Shell refers to critical vulnerabilities in PHP that could allow attackers to exploit vulnerable systems, potentially leading to remote code execution. It highlights how flaws in underlying web technologies can put web applications at risk, even when the application code itself is not the root cause.
2. How can a WAF help protect against PHP2Shell attacks?
A Web Application Firewall (WAF) inspects incoming HTTP and HTTPS traffic to identify and block malicious requests. Depending on its detection capabilities and configuration, a WAF may help detect or mitigate exploit attempts targeting vulnerable web applications.
3. Can a WAF protect web applications before a PHP vulnerability is patched?
A WAF may provide an additional layer of protection while a patch is being tested or deployed. This approach, often called virtual patching, uses security rules or detection logic to help block known exploit patterns. However, protection depends on the vulnerability, exploit technique, and WAF capabilities; patching remains essential.
4. Is a WAF enough to prevent PHP2Shell exploitation?
No. A WAF is one layer of a broader defense strategy. Organizations should also apply vendor security patches, update vulnerable PHP versions, review exposed services, and monitor systems for suspicious activity. A WAF should complement these measures, not replace them.
5. What should organizations look for in a WAF to defend against emerging vulnerabilities?
Look for accurate attack detection, rapid rule updates, protection against remote code execution attempts, low false-positive rates, and visibility into blocked and suspicious traffic. Adaptive detection and virtual patching capabilities can also help organizations respond to emerging threats while remediation is underway.