Deep Dive: Anatomy of the PHP Unauthenticated RCE Vulnerabilities (CVE-2026–109618 & CVE-2026–109619)
Two memory-safety flaws in the PHP Zend Engine let an unauthenticated attacker corrupt a worker's heap by forcing an out-of-memory condition during request initialisation or teardown, then send a second request to the same worker to execute arbitrary code. The text claims this leads to full system compromise across PHP 5.4 through 8.5.11.
Published on medium.com
PHP
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Context
PHP underpins a large share of the web, and the article puts the figure at over 75% of all known websites. That reach is why a flaw in the engine itself matters: the blast radius is not one application but every deployment running the affected interpreter.
The subject here is the Zend Engine's handling of request lifecycle state in persistent worker pools. In deployments such as PHP-FPM or Apache mod_php, PHP does not start a fresh process for every HTTP request. A worker process handles a request, tears down its memory state, and then waits for the next request. That model is efficient, but it depends on one guarantee: request teardown must perfectly sanitise the internal state before the worker accepts a new request.
Two vulnerabilities, CVE-2026-109618 and CVE-2026-109619, break that guarantee by abusing Out-of-Memory (OOM) exceptions. They were disclosed by the PHP Foundation, carry a CVSS v4.0 score of 9.2, and are unofficially circulating as "PHP2Shell". Both are memory-safety bugs rooted in how the Zend Engine handles OOM conditions and worker process states, and both lead to unauthenticated Remote Code Execution.

Setup
The exploitation described requires no account, no role and no tooling beyond the ability to send HTTP requests to the target server. The report states only that the attacker needs to be able to send HTTP requests to the target server.
The affected range is broad: from PHP 5.4 all the way through 8.5.11. Because the flaw lives in the core memory allocator, it applies across deployment architectures, including PHP-FPM, Apache mod_php and Nginx FastCGI.
Finding it
The starting observation is architectural. A persistent worker reuses its process across requests, so anything that survives teardown becomes input to the next request. The PHP Foundation disclosed two ways the engine fails to keep that promise when an OOM condition interrupts normal processing.
CVE-2026-109618: the uninitialised data trap
During a request, the engine allocates memory and initialises internal structures such as the symbol table, request globals and object handlers. If an attacker forces the worker to hit its memory_limit exactly during this initialisation phase, PHP throws a fatal OOM error and jumps immediately to the request cleanup routine, the shutdown sequence.
The cleanup routine assumes the internal request data was fully and properly initialised. Because the OOM interruption happened mid-initialisation, the engine tries to clean up partially initialised, invalid data structures as if they were valid. That improper teardown causes memory corruption inside the Zend Engine's allocator (ZendMM), leaving dangling pointers that can be manipulated to control execution flow.
CVE-2026-109619: stale state and memory reuse
The second flaw is a state-leakage issue that behaves similarly to a use-after-free across request boundaries. When a request finishes, or crashes via OOM, the memory manager frees the backing memory for that request. Under specific edge cases tied to OOM handling, however, the internal state pointers owned by that request survive teardown.
The worker process does not die, so it picks up the next HTTP request in the queue. Before the normal initialisation sequence can fully reset the worker's environment, the engine tries to use the stale state from the previous request. The backing memory for that state has already been freed, and may have been reallocated with attacker-controlled data from the new request, so the engine ends up operating on corrupted memory structures.
Exploitation
The chain needs no authentication, only the ability to send HTTP requests. It runs in five stages.
Step 1: trigger the OOM
The attacker sends an HTTP request with an abnormally large payload, for example a massive POST body or heavily nested multipart/form-data, designed to exhaust the memory_limit set in php.ini.
Step 2: time the interruption
By carefully crafting the payload's size and structure, the attacker forces the OOM exception to fire precisely when the Zend Engine is allocating request-bound state structures.
Step 3: corrupt the heap
Either the interrupted initialisation (CVE-2026-109618) or the surviving stale state (CVE-2026-109619) corrupts the worker's heap.
Step 4: hijack the next request
The attacker immediately sends a second, highly specific HTTP request to the same worker process. This request carries the actual malicious payload, shellcode or a ROP chain, which is mapped into the memory space previously freed by the OOM crash.
Step 5: execute
When the worker processes the new request using the stale, now attacker-controlled pointers, it jumps to the attacker's payload. The result is a full system compromise.
The report does not include the literal request bodies, headers or responses used in any of these steps.
Root cause
The mistake is in the teardown and initialisation contract of the Zend Engine. Cleanup assumes fully initialised state, so an OOM raised mid-initialisation leads it to treat partial structures as valid. Separately, request-owned state pointers can outlive the memory they point to when OOM handling takes an edge path, and the next request on the same worker can reach them before initialisation has reset the environment. In both cases the allocator, ZendMM, is left holding dangling or reused memory that an attacker can shape.
The report does not describe any engine-level check that would have caught the partial or stale state.
Impact
Successful exploitation gives unauthenticated remote code execution, resulting in a full system compromise. The exposure covers PHP 5.4 through 8.5.11 and, because the vulnerability lives in the core memory allocator, almost all deployment architectures: PHP-FPM, Apache mod_php, Nginx FastCGI and similar setups. The CVSS v4.0 score assigned is 9.2.
Fix
Immediate patching
The PHP Foundation released patched binaries that harden the request teardown sequence and force memory state to be zeroed out even during OOM crashes. Upgrade to one of:
8.5.128.4.278.3.368.2.35
PHP 8.1 and older are End-of-Life and will not receive patches; those installations must migrate to a supported branch immediately.
Temporary mitigations
If patching is not possible yet, the goal is to prevent the attacker from triggering the OOM at all, by dropping excessively large requests at the network edge before they reach the PHP daemon.
- Nginx: enforce a strict
client_max_body_sizeinnginx.conf. - Apache: use the
LimitRequestBodydirective. - WAF rules: block requests with unusually large
Content-Lengthheaders, deeply nested JSON, or anomalous multipart form boundaries.
Lowering memory_limit in php.ini does not fix this. It makes the OOM condition easier to trigger with smaller payloads, so the defence has to sit at the reverse proxy or WAF layer.
- OOM during initialisation on other SAPI workers. Send oversized POST bodies and deeply nested multipart/form-data to a PHP-FPM pool and watch for a fatal OOM followed by abnormal behaviour on the next request to the same worker. A positive result is a worker that survives the OOM but returns corrupted or unexpected output on the following request.
- State carry-over between requests. After forcing an OOM, send a second request with distinctive content and check whether any of it is reflected in engine-level behaviour rather than application output. A positive result is evidence that request-owned pointers survived teardown.
- Edge size tuning. Vary payload size and structure around the configured
memory_limitto find the window where the OOM lands mid-initialisation rather than after it. A positive result is a reproducible crash-to-corruption transition at a stable payload size. - Proxy limit bypass. Where
client_max_body_sizeorLimitRequestBodyis set, test whether chunked transfer encoding or unusual multipart boundaries get a large body past the edge. A positive result is a request that reaches PHP despite exceeding the configured limit. - Version fingerprinting. Identify the PHP version in use and compare it against the affected range and the patched releases listed above. A positive result is a version between 5.4 and 8.5.11 that is not one of the fixed builds.
What happened, in plain words
Most websites you visit are built with a programming language called PHP. The article says PHP powers over 75% of all known websites. That is a huge number, and it is the reason a problem inside PHP itself matters so much: it is not one website that breaks, it is potentially every website running the affected version of PHP.
The PHP Foundation disclosed two serious security bugs, described in an article published on 22 October 2026. They are tracked by two identifiers, CVE-2026-109618 and CVE-2026-109619. A CVE is simply a public catalogue number for a known security flaw, so people around the world can refer to the same bug by the same name. The two bugs have been given a severity score of 9.2 on the CVSS v4.0 scale, which is a standard way of rating how bad a vulnerability is (10 is the worst). People have also started calling them "PHP2Shell".
Both bugs let an attacker run their own code on a web server without logging in first. That is what "unauthenticated Remote Code Execution" means: unauthenticated means no username or password needed, remote means the attacker does it over the network, and code execution means the attacker's instructions actually run on the machine. If that happens, the result is a full system compromise.

The rest of this article explains, from scratch, how these bugs work, how an attacker would use them, and what you can do about them.
The core problem: memory management and worker state
To understand the bugs, you first need to know how PHP handles a request from a browser.
When you open a web page, your browser sends an HTTP request to the server. HTTP is the language browsers and servers use to talk to each other. The server has a program running that understands PHP, and that program has to do work to build the page you asked for.
Starting a brand new program for every single request would be slow. So modern PHP setups (for example PHP-FPM, which is a common way of running PHP, or Apache mod_php, which is PHP built into the Apache web server) keep a pool of worker processes. A worker process is a small running copy of the PHP program. It takes a request, does the work, tidies up its memory, and then waits for the next request. This is like a restaurant with a fixed number of waiters: each waiter serves one table, clears it, and then serves the next table. Hiring a new waiter for every table would be absurd.
That efficiency comes with one strict promise: before a worker takes a new request, it must completely clean up everything from the previous one. If any leftover from the last request survives, the next request could see it.
Both CVE-2026-109618 and CVE-2026-109619 break that promise by abusing Out-of-Memory (OOM) errors. Out-of-Memory means the program asked for more memory than it is allowed to use. PHP has a setting called memory_limit in a configuration file called php.ini that says how much memory a request may use. When a request goes over that limit, PHP stops it with a fatal error.
CVE-2026-109618: the uninitialised data trap
While a request is running, PHP sets up various internal structures. Think of these as the worker's desk: the symbol table (where variable names are stored), request globals (shared values for the request), and object handlers (the rules for how objects behave). Setting these up is called initialisation.
If an attacker can force the worker to hit its memory_limit exactly while this setup is happening, PHP throws a fatal OOM error and jumps straight to the cleanup routine, the shutdown sequence.
The vulnerability: the cleanup routine assumes everything was set up properly. But because the OOM happened halfway through setup, some of those structures are only half-built. The engine tries to clean up this half-built, invalid data as if it were valid. That improper teardown corrupts memory inside the Zend Engine's allocator (ZendMM). The Zend Engine is the core of PHP that actually runs your code, and ZendMM is the part that hands out and takes back memory. The corruption leaves dangling pointers, which are memory addresses that point to something that is no longer valid. An attacker can manipulate those to control what the program does next.
A simple comparison: imagine a builder who is told to demolish a half-finished house as if it were finished. Walls that were never properly attached come down in the wrong order, and the rubble damages the neighbouring buildings.
CVE-2026-109619: stale state and memory reuse
The second bug is about state leaking between requests. It behaves similarly to a Use-After-Free (UAF) bug. Use-After-Free means a program keeps using a piece of memory after it has already been handed back and possibly given to someone else.
When a request finishes, or crashes because of OOM, the memory manager frees the memory that request was using. But in certain edge cases related to OOM handling, the internal state pointers owned by that request survive the teardown. A pointer is just a note saying "the data is over there". If the note survives but the data has been thrown away, the note is now misleading.
The vulnerability: the worker process does not die, so it picks up the next HTTP request in the queue. Before the normal setup can fully reset the worker's environment, the engine tries to use the stale state left over from the previous request. The memory that state pointed to has already been freed, and it may have been reused for data the attacker sent in the new request. So the engine ends up working with corrupted memory structures that the attacker partly controls.
Comparison: a waiter clears a table but leaves the previous customer's order slip on the tray. The next customer's order gets written on the same slip, and the kitchen ends up cooking a dish nobody asked for.
The exploitation vector (PHP2Shell)
To exploit these bugs, an attacker does not need an account or a password. They only need to be able to send HTTP requests to the target server. That is the same thing your browser does every time you visit a page.
The exploitation chain has five steps.
- Triggering the OOM: the attacker sends an HTTP request containing an abnormally large payload (for example a massive POST body or heavily nested multipart/form-data) designed to exhaust the
memory_limitdefined inphp.ini. - Timing the interruption: by carefully crafting the payload's size and structure, the attacker forces the OOM exception to trigger precisely when the Zend Engine allocates request-bound state structures.
- Corrupting the heap: the interrupted initialisation (CVE-2026-109618) or the surviving stale state (CVE-2026-109619) corrupts the worker's heap.
- Hijacking the next request: the attacker immediately sends a second, highly specific HTTP request to the same worker process. This request contains the actual malicious payload (shellcode or a ROP chain) which is mapped into the memory space previously freed by the OOM crash.
- Execution: when the PHP worker attempts to process the new request using the stale, now attacker-controlled pointers, it jumps to the attacker's payload, resulting in a full system compromise.
Let us unpack the unfamiliar words in that list.
- A payload is the actual content of a request, the data being sent. A POST body is the part of an HTTP request that carries data you submit, for example when you fill in a form. Multipart/form-data is the format browsers use when a form includes a file upload. "Heavily nested" means the data is structured in many layers, like boxes inside boxes inside boxes.
- An exception is a program's way of saying "something went wrong, stop what you are doing".
- The heap is the general-purpose area of memory a program uses for data it creates while running.
- Shellcode is a small piece of machine instructions an attacker wants the computer to run. A ROP chain (Return-Oriented Programming) is a technique for making a program run the attacker's chosen instructions by reusing small snippets that already exist in its memory.
- Mapped into memory means the data is placed at a particular address in the program's memory so it can be reached.
The report does not include the literal request bodies, headers or responses used in any of these steps.
Remediation and architectural defence
The impact of these flaws spans from PHP 5.4 all the way through 8.5.11. Because the vulnerability lives in the core memory allocator, it affects almost all deployment architectures (PHP-FPM, Apache mod_php, Nginx FastCGI, etc.).
1. Immediate patching (the only true fix)
The PHP Foundation has released patched binaries that harden the request teardown sequence and ensure memory state is forcefully zeroed out even during OOM crashes. A binary is the compiled program file you install. "Zeroed out" means the memory is wiped clean, so nothing stale can survive.
- Upgrade to:
8.5.12,8.4.27,8.3.36, or8.2.35. - Note: if you are running PHP 8.1 or older, you are on an End-of-Life (EOL) version and will not receive patches. You must migrate to a supported branch immediately. End-of-Life means the makers have stopped supporting it, so no more security fixes will come.
2. Temporary mitigations (WAF and reverse proxy limits)
If you cannot patch immediately, your goal must be to prevent the attacker from triggering the OOM condition. You can achieve this by dropping excessively large requests at the network edge, before they ever reach the PHP daemon. A reverse proxy is a server that sits in front of your web server and forwards requests to it. A WAF (Web Application Firewall) is a filter that inspects incoming requests and blocks suspicious ones.
- Nginx: enforce a strict
client_max_body_sizein yournginx.conf. Nginx is a popular web server and reverse proxy;client_max_body_sizeis its setting for the largest request body it will accept. - Apache: use the
LimitRequestBodydirective. Apache is another popular web server;LimitRequestBodyis its equivalent setting. - WAF rules: deploy Web Application Firewall rules to block requests with unusually large Content-Length headers, deeply nested JSON, or anomalous multipart form boundaries. The Content-Length header is a line in the request that says how big the body is. JSON is a common text format for structured data. A multipart form boundary is the marker that separates the parts of an upload.
Warning: lowering the memory_limit in php.ini will not fix this. In fact, lowering it makes the OOM condition easier for an attacker to trigger with smaller payloads. The defence must happen at the reverse proxy or WAF layer.
Conclusion
CVE-2026-109618 and CVE-2026-109619 are stark reminders that memory safety is not just a problem for compiled binaries like C/C++ applications; the underlying engines of our interpreted languages are just as susceptible. Patch your environments, audit your legacy systems, and ensure your edge defences are dropping anomalous request sizes.
Glossary
- PHP: a programming language widely used to build websites.
- PHP Foundation: an organisation that supports the PHP language and disclosed these vulnerabilities.
- CVE: a public catalogue number for a known security vulnerability.
- CVSS v4.0: a standard scoring system for rating the severity of a vulnerability, from 0 to 10.
- RCE (Remote Code Execution): a flaw that lets an attacker run their own code on a remote machine.
- Unauthenticated: reachable without logging in or having an account.
- PHP2Shell: the unofficial nickname given to these two vulnerabilities.
- Zend Engine: the core component of PHP that executes code.
- ZendMM: the Zend Engine's memory allocator, which hands out and reclaims memory.
- OOM (Out-of-Memory): an error raised when a program asks for more memory than it is allowed to use.
- memory_limit: the
php.inisetting that caps how much memory a request may use. - php.ini: PHP's main configuration file.
- Worker process: a running copy of PHP that handles requests one after another.
- PHP-FPM: a common way of running PHP as a pool of worker processes.
- Apache mod_php: PHP built directly into the Apache web server.
- Nginx FastCGI: a setup where the Nginx web server passes requests to PHP over the FastCGI protocol.
- HTTP request: the message a browser (or attacker) sends to a server to ask for something.
- POST body: the part of an HTTP request that carries submitted data.
- multipart/form-data: the format used when a form includes file uploads.
- Payload: the actual data content of a request.
- Symbol table: PHP's internal store of variable names.
- Request globals: shared values that belong to a single request.
- Object handlers: the internal rules that define how PHP objects behave.
- Initialisation: the process of setting up internal structures before a request runs.
- Shutdown sequence: the cleanup routine that runs when a request ends.
- Teardown: the act of cleaning up after a request.
- Memory corruption: damage to a program's memory that can change how it behaves.
- Dangling pointer: a memory address that points to data that is no longer valid.
- Use-After-Free (UAF): using memory after it has been freed and possibly reused.
- State: the current values and data a program is holding at a given moment.
- Stale state: leftover state from a previous request that should have been cleared.
- Heap: the general-purpose area of memory used for data created while a program runs.
- Exception: a program's signal that something went wrong.
- Shellcode: a small piece of machine instructions an attacker wants executed.
- ROP chain (Return-Oriented Programming): a technique for running chosen instructions by reusing existing code snippets in memory.
- Binary: the compiled program file you install.
- End-of-Life (EOL): a version that no longer receives updates or security fixes.
- Reverse proxy: a server that sits in front of a web server and forwards requests to it.
- WAF (Web Application Firewall): a filter that inspects and blocks suspicious requests.
- client_max_body_size: the Nginx setting for the largest request body it will accept.
- LimitRequestBody: the Apache setting for the largest request body it will accept.
- Content-Length header: the line in an HTTP request that states the body's size.
- JSON: a common text format for structured data.
- Multipart form boundary: the marker that separates the parts of an upload.