PHP2Shell
Two pre-authentication remote code execution vulnerabilities in PHP core, caused by an out-of-memory error or fatal error jumping out of a half-built request and leaving dangling pointers. An attacker could force an OOM at a chosen moment, leak heap memory, and chain bugs to achieve remote code execution against stock WordPress, Drupal, and Joomla.
medium.com
Published on medium.com
Php2shell
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
PHP2Shell is the name given to two pre-authentication remote code execution vulnerabilities in PHP core, CVE-2026-109618 and CVE-2026-109619, disclosed together with an emergency PHP release on 21 October 2026. The research is credited to Calif.io, Wiz Research and OpenAI. The companion lab reproduces only the publicly documented trigger, the cross-request precondition and the detection signals, not a weaponised chain.
The affected surface is not an application feature but the request lifecycle itself. PHP serves many HTTP requests from one long-lived worker process, either Apache mod_php or a PHP-FPM pool worker. Each request gets its own request heap, set up at request startup and torn down at request shutdown. Both CVEs are rated Critical (CVSS 9.2), both are pre-authentication, and both were demonstrated as remote code execution against stock WordPress, Drupal and Joomla. The bug reaches back to PHP 5.4 (2012), and Wiz's headline is quoted as: "Every PHP version released in the last decade is affected by at least one of these vulnerabilities."
Setup
The lab runs both SAPIs: Apache mod_php and nginx with PHP-FPM. The RCE demonstration uses a stock php:8.4.26-apache image with display_errors=On, memory_limit=8M, KeepAlive Off and a single-worker Apache prefork, on linux/amd64. The target page contains nothing but:
<?php echo "OK\n"; ?>
For the patch comparison, Docker Hub's php:8.4-apache was still 8.4.26 on release day, so the official 8.4.27 image was built from source and the identical payloads were fired at both. No accounts or roles are involved: every step is unauthenticated.
Finding it
The starting observation is that every PHP2Shell bug has the same shape: an exceptional control-flow path, an out-of-memory (OOM) error or any fatal error, jumps out of an operation before it finished setting up or tearing down its state. That leaves a pointer referring to memory that is uninitialised or already freed, and later code reads or branches on that pointer.
PHP implements OOM with a longjmp(), a non-local jump that abandons whatever it was doing. That is the trapdoor: land an allocation failure at the wrong moment and the engine is left holding a dangling reference.
Wiz decomposes the two CVEs into four distinct bugs. They all start from the same lever, forcing an OOM or fatal at a moment you choose, and differ only in which global ends up dangling:

Bug #2 is the one behind the question "can it read my files?". It is a memory read, not a filesystem read, but it leaks whatever is in the reclaimed heap: other users' request data, session contents, secrets sitting in process memory. Those bytes are URL-encoded straight into a response cookie. The published RCE chain combined #1 and #2: leak with #2, then drive the unserialiser UAF in #1 to execution.
Exploitation
Step 1: force an out-of-memory error on demand
Every one of the four bugs needs the same primitive first: make a chosen allocation fail at a chosen time, without tripping any size limit. Two tricks combine.
- Slip past
post_max_size. PHP checks that limit against the request's declaredContent-Length, not the bytes it actually consumes. Send the body with HTTP chunked transfer encoding (no declared length) and the initial check is simply skipped. - Amplify memory inside a tiny body. Modern PHP caps the number of multipart parts (
max_multipart_body_parts, default 1020), but it does not cap the number of header lines inside a single part, and it holds them all in memory while parsing that part. The lab measured roughly 320 bytes of PHP heap retained per header line. One part with about 300,000 cheap header lines is about 4 MiB on the wire but drives about 96 MiB of allocation, blowing a 64 MiBmemory_limit.
The body generator is deliberately boring:
for p in range(parts): # parts: keep < 1020
out += b"--" + boundary + CRLF
out += b'Content-Disposition: form-data; name="f%d"; filename=""' % p + CRLF
out += b"Content-Type: application/octet-stream" + CRLF
for h in range(headers): # headers: the UNCAPPED amplifier
out += b"X-P%d: x" % h + CRLF # ~320 bytes of PHP heap each
out += CRLF + CRLF
The request is sent with chunked transfer encoding so no length is declared:
curl -X POST -H 'Transfer-Encoding: chunked' \
-H 'Content-Type: multipart/form-data; boundary=sep' \
--data-binary @body.bin http:
Against PHP 8.4.26 the result is:
PHP Fatal error: Allowed memory size of 67108864 bytes exhausted
(tried to allocate 4096 bytes) in Unknown on line 0
"Unknown on line 0" is the tell: the fatal fires during request-startup parsing, before any application code runs, exactly where the vulnerable state lives. The application never got a say. Adding a PHP_SESSION_UPLOAD_PROGRESS field and a session cookie engages the session path behind CVE-2026-109619.
Step 2: understand how each SAPI reacts
A common question is whether running PHP-FPM instead of mod_php makes you safe. Not exactly, and the two SAPIs behave differently. The lab fires the identical ~4 MiB request at each:
TARGET | HTTP | WHAT HAPPENS NEXT
mod_php(vuln) | 500 | OOM fatal forced; worker SURVIVES & is reused
nginx+fpm(vuln) | 502 | OOM fatal forced; FPM child EXITS (code 70) & is replaced

The OOM fires on both. The difference is the aftermath, and it is the whole game. On mod_php the worker survives the fatal and serves the next request; in the lab the Apache worker PID is identical before and after:
worker_pid= 22 <- before the OOM fatal
worker_pid= 22 <- after: worker SURVIVED & REUSED
Request A leaves a global pointing into its freed heap; request B, your next request on the same worker, walks that stale pointer. That reused worker is exactly the window CVE-2026-109619 abuses, and it is the path the advisories demonstrate app-independently.
On PHP-FPM the child that handled the fatal exits and is recycled, so this particular request-startup sequence does not survive to be consumed. FPM is still listed as susceptible by both CVEs, but via a separate, application-dependent path: state published during normal request execution, then consumed by upload progress. The researchers did not fully detail that path and the lab does not reproduce it. FPM is not immune, but "fire a startup OOM and win" is a mod_php story.
Step 3: turn the dangling state into a shell
The RCE is confirmed and demonstrated, not theoretical. The CVE-2026-109618 advisory states full unauthenticated RCE was validated over HTTP against mod_php with default input and memory limits, and Calif and Wiz report pre-auth RCE against stock WordPress, Drupal and Joomla.
The honest caveats: it is rated AC:H / AT:P, high complexity and special conditions. Success depends on heap grooming landing correctly and defeating ASLR; it is "run it until it wins", not a guaranteed one-shot.
Under the lab settings, the full chain, heap leak, ASLR bypass, fake zend_reference placement and zif_system execution, completes in seconds over plain HTTP against the page that only prints OK:

The same chain plants a webshell on the victim and drops into an interactive command loop as www-data, all pre-auth, all over ordinary HTTP POST requests.

Actual Exploit Demo: (https://www.youtube.com/watch?v=5oEa2Y_CL1Q)
Step 4: account for the lab constraints
The lab pins every knob to make heap grooming deterministic: display_errors=On so a warning flushes headers (needed for the Set-Cookie leak), memory_limit=8M so the heap stays small enough for calibrated placement, KeepAlive Off so each connection maps to exactly one request on one worker, and a single prefork child so every request hits the same process. Change any one of those and the demo script breaks.
The host platform matters too. The demo's heap grooming uses calibrated filler counts, exact numbers of POST variables that position allocations at specific Zend memory manager slots. Those counts were measured on a standard Linux x86_64 kernel. When the same linux/amd64 container runs inside Docker Desktop's LinuxKit VM (macOS or Windows), or under QEMU emulation on Apple Silicon, the VM's kernel and memory allocator shift the heap layout just enough that the calibrated fillers can miss. The demo is most reliable on native Linux; on Docker Desktop, mileage varies by version. The vulnerability is the same either way: it is the lab script's grooming that is fragile, not the bug.
POC for dynamic testing: (still testing) https://youtu.be/7gn5Gku1TQY

None of this means production PHP is safe. It means a generic, one-size script is hard. Each of those constraints has a production-realistic bypass that the researchers demonstrated:

The AC:H / AT:P rating means hard, not impossible. Calif and Wiz achieved pre-auth RCE against stock WordPress, Drupal and Joomla on default PHP settings. Their exploit is more sophisticated than the lab script, but the underlying vulnerability is the same longjmp out of a half-built request that the demo triggers. The researchers withheld their full chain precisely because it works under realistic conditions.
Step 5: confirm the OOM and the patch
It is easy to check the OOM. Sweep the header count against PHP 8.4.26 and the limit snaps shut at a sharp edge, one extra header's worth of heap tips a ~64 MiB memory_limit:
200,000 headers (2.6 MiB on the wire) -> HTTP 200
220,000 headers (2.9 MiB on the wire) -> HTTP 500 <- OOM fatal
Firing the identical payloads at 8.4.26 and 8.4.27 shows the before and after:
PHP | PAYLOAD | HTTP | APP CODE RAN?
8.4.26 | header-bomb | 500 | no (fatal before any app code)
8.4.27 | header-bomb | 200 | yes (request served normally)
On 8.4.27 the error log stays empty: the request no longer gets near the limit, even at 2 million headers (27 MiB).
Root cause
The mistake is not the OOM itself. The OOM was the lever. The bug is that an out-of-memory condition longjmps out of a half-built request, so request shutdown later walks half-initialised state and a global is left pointing at freed or uninitialised memory. On mod_php the worker survives the fatal and is reused, so the next request on that worker consumes the stale pointer. The multipart parser's willingness to hold an unbounded number of header lines inside a single part is what makes the OOM cheap to trigger from a small body, and the post_max_size check against the declared Content-Length rather than the consumed bytes is what lets a chunked body slip past the size limit.
Existing defences did not stop it because the activity happens below the application layer: the fatal fires during request-startup parsing, before any application code runs, so application-level controls never see it. Edge and WAF mitigations from Cloudflare, AWS, Akamai, Fastly, Imperva, Google and Microsoft buy time but do not fix it.
Impact
An unauthenticated attacker can achieve remote code execution against PHP mod_php deployments, demonstrated against stock WordPress, Drupal and Joomla, and can plant a webshell and run commands as www-data. Bug #2 additionally leaks reclaimed heap memory, including other users' request data, session contents and secrets in process memory, URL-encoded into a response cookie.
The conditions matter. The lab chain needs non-default settings (display_errors=On, memory_limit=8M, KeepAlive Off, single worker, mod_php, linux/amd64) to make grooming deterministic, and a real-world exploit would need to handle production configurations, multi-worker environments and different ASLR layouts. The rating is AC:H / AT:P, so success is probabilistic and depends on heap grooming and defeating ASLR. PHP-FPM is listed as susceptible by both CVEs but via a separate, application-dependent path that was not fully detailed. The bottom line given is that an unpatched PHP up to 8.4.26 on mod_php should be treated as exploitable in the wild.
Fix
The patch is one commit, Avoid state corruption via bailout, and it does two things. First, the multipart parser stops hoarding junk headers, so the amplifier is gone:
+ if (!php_mime_should_save_hdr(line)
+ || php_mime_get_hdr_value(*header, line)) {
+ key = NULL;
+ } else {
+ key = estrdup(line);
Second, and this is the real bug fix, an out-of-memory no longer longjmps out of a half-built request. The soft limit queues a delayed error raised after parsing finishes; a higher hard limit _exit()s the worker outright. Either way, request shutdown never walks half-initialised state again:
# Zend/zend_alloc.c + main/SAPI.c
+ * When the soft limit is to be exceeded, a delayed OOM error is queued.
+ * When the hard limit is to be exceeded, the function does not return.
The patch keeps PHP's ability to run out of memory and removes the dangling state that made it a weapon. Commits: 01a40e89fbfc (8.2), 3c832b523ee1 (8.3), 506e87fa7dcd (8.4), 31c0ea7d7ff1 (8.5).
Upgrade to PHP 8.2.35 / 8.3.36 / 8.4.27 / 8.5.12 (or later) and restart all workers: the stale state lives in running processes, so an unrestarted worker stays vulnerable.
If you cannot patch immediately, these interim measures are partial and not a substitute:
- PHP-FPM:
session.upload_progress.enabled=0andmemory_limit=-1, then restart. mod_php:memory_limit=-1, then restart.- Do not rely on
RLIMIT_AS/RLIMIT_DATA; they can trigger the bug. - Block multipart at the edge if your app does not use it; cap headers-per-part and decoded body size at the front end; on FPM consider
pm.max_requests=1.
Removing the memory cap raises real DoS risk, so treat these as stopgaps and patch.
Variants to test
- Header-count sweep against your own PHP build. Send the multipart body with increasing numbers of header lines inside one part and watch for the sharp edge where the response flips from 200 to 500 with an OOM fatal in
Unknown on line 0. A positive result is a fatal during request-startup parsing before application code runs. - Chunked body with no declared length. Send the same body with
Transfer-Encoding: chunkedand noContent-Length. A positive result is thatpost_max_sizedoes not reject the request even though the consumed body exceeds it. - Worker reuse on
mod_php. Record the worker PID before and after an OOM fatal. A positive result is the same PID serving the next request, which is the precondition for the cross-request stale pointer. - Session path. Add a
PHP_SESSION_UPLOAD_PROGRESSfield and a session cookie to the OOM request. A positive result is engagement of the session path behind CVE-2026-109619. - Leak check. Look for oversized or
%-encodedPHPSESSIDresponse cookies. A positive result is leaked worker memory from bug #2 appearing in the cookie. - Detection signals. Watch for unusual multipart requests immediately followed by memory-limit errors, repeated HTTP 500 (and on FPM, 502) from one source, and unexplained PHP worker churn.
- Patch verification. Fire the identical payload at the patched build. A positive result is HTTP 200 with the request served normally and an empty error log, even at 2 million headers.
Run any of this only against systems you own.
What happened, in plain words
On 21 October 2026 the people who maintain PHP, the programming language that powers a huge share of the web (WordPress, Drupal and Joomla all run on it), released an emergency update. The update closed two serious security holes, tracked as CVE-2026-109618 and CVE-2026-109619. Together the researchers at Calif.io, Wiz Research and OpenAI call them PHP2Shell.
Both holes are rated Critical, with a severity score of CVSS 9.2. Both can be used by someone who has not logged in at all, which is what pre-authentication means. Both were shown to lead to remote code execution, meaning an attacker sitting at a keyboard somewhere else can make the server run their own commands. The researchers demonstrated this against stock WordPress, Drupal and Joomla. The flaw reaches back to PHP 5.4, released in 2012. Wiz's headline is quoted as:
"Every PHP version released in the last decade is affected by at least one of these vulnerabilities."
If you run PHP, and if you run WordPress you run PHP, this is a patch-today event. This article explains why it is so bad, at the level of mechanism and defence. It does not contain a working attack; the researchers deliberately withheld that, and so does this write-up.
A few words before we start, because the rest of the article leans on them.
- A server is a computer that stays on and answers requests from other computers. When you open a website, your browser asks a server for a page and the server sends it back.
- PHP is the software on that server that builds the page. A file ending in
.phpis a recipe the server follows to produce the HTML your browser displays. - A vulnerability is a mistake in software that lets someone make it do something the author did not intend. A CVE is a public catalogue number given to a known vulnerability so everyone can refer to the same thing.
- Remote code execution (RCE) is the worst kind of vulnerability: the attacker gets the server to run commands of their choosing, as if they were sitting at its keyboard.
- Authentication is proving who you are, usually with a username and password. Pre-authentication means the attack works before any of that, so the attacker needs no account at all.
The one idea behind all of it
To understand the bug you need one picture: a worker process. A process is a running copy of a program. PHP does not start a fresh program for every visitor. Instead it keeps a small number of long-lived worker processes, and each worker handles many requests one after another. This is what makes PHP fast: starting a program is expensive, so the worker stays warm and reuses itself.
Each request a worker handles gets its own private scratch area in memory, called the request heap. The heap is where PHP puts the temporary data for that request: form fields, uploaded file details, session information. The heap is set up at request startup, before any of your application code runs, and torn down at request shutdown, after your code has finished.
Every PHP2Shell bug has the same shape:
An exceptional control-flow path, an out-of-memory (OOM) error or any fatal error, jumps out of an operation before it finished setting up or tearing down its state. That leaves a pointer referring to memory that is uninitialised or already freed. Later code then reads or branches on that pointer.
Unpacking that sentence:
- Memory is the workspace where a running program keeps its data. Think of it as a huge wall of numbered pigeonholes, each holding a small value.
- A pointer is a slip of paper with a pigeonhole number written on it. The program uses pointers to find its data again.
- Freed memory is a pigeonhole the program has handed back and declared empty. Uninitialised memory is one it never wrote anything into. Either way, whatever is in that pigeonhole now is not what the program expects.
- A dangling pointer is a slip of paper pointing at a pigeonhole that has been emptied or reused. If the program later trusts that slip, it reads or acts on rubbish.
- An out-of-memory (OOM) error happens when the program asks for more memory than it is allowed to use. PHP has a setting called
memory_limitthat caps this, so a runaway script cannot eat the whole machine. - A fatal error is an error serious enough that the current operation cannot continue.
PHP implements OOM with a longjmp(). That is a function that makes the program jump out of whatever it was doing, all the way back to a safe point, abandoning the work in progress. It is like pulling a fire alarm in the middle of cooking: everyone leaves the kitchen immediately, and the half-prepared dish is left on the counter. That is the trapdoor. Land an allocation failure at the wrong moment and you leave the engine holding a dangling reference.
Four bugs, one lever
Wiz decomposes the two CVEs into four distinct bugs. They all start from the same lever, force an OOM or fatal at a moment you choose, and differ only in which global ends up dangling:

A global here means a variable that lives outside any single request and is shared by the worker across requests. That is why the problem crosses from one visitor to the next: the worker keeps the global, and the global keeps the stale pointer.
Bug #2 is the one behind the question "can it read my files?". It is a memory read, not a filesystem read. In other words, it does not open files on disk; it reads whatever happens to be sitting in the reclaimed heap. That can include other users' request data, session contents, and secrets sitting in process memory. Those bytes are then URL-encoded straight into a response cookie.
A cookie is a small piece of text a website asks your browser to store and send back with every later request. It is how a site remembers you between page loads. URL-encoding is a way of writing arbitrary bytes as safe text, replacing awkward characters with % followed by two hex digits, so the data can travel inside a cookie without breaking it. A session is the server-side record of a logged-in visitor, and the cookie usually carries only an identifier for it.
The published RCE chain combined #1 and #2: leak with #2, then drive the unserialiser UAF in #1 to execution. Unserialising is turning stored text back into live program data, and a use-after-free (UAF) is using memory after it has been freed. Put together, the attacker first steals information with bug #2, then uses bug #1 to turn that information into running code.
Stage 1: forcing an out-of-memory error on demand
Every one of those bugs needs the same primitive first: make a chosen allocation fail at a chosen time, without tripping any size limit. An allocation is a request to the memory manager for a chunk of space. The attacker needs to control when that request fails, because the bug only appears if the failure lands at the right instant.
Two tricks combine.
- Slip past
post_max_size. PHP checks that limit against the request's declaredContent-Length, not the bytes it actually consumes. Send the body with HTTP chunked transfer encoding (no declared length) and the initial check is simply skipped. - Amplify memory inside a tiny body. Modern PHP caps the number of multipart parts (
max_multipart_body_parts, default 1020), but it does not cap the number of header lines inside a single part, and it holds them all in memory while parsing that part. The lab measured roughly 320 bytes of PHP heap retained per header line. One part with about 300,000 cheap header lines is about 4 MiB on the wire but drives about 96 MiB of allocation, blowing a 64 MiBmemory_limit.
Some terms here:
post_max_sizeis a PHP setting that limits how large a submitted form (a POST request) may be. It exists to stop people sending enormous bodies.Content-Lengthis a header in which the browser announces how many bytes it is about to send. A header is a line of metadata at the top of a request, like the label on a parcel.- Chunked transfer encoding is an alternative way of sending a body in pieces, without ever announcing the total size up front. The server learns the size only as the pieces arrive.
- Multipart is the format browsers use to send forms that include file uploads. The body is split into parts, each with its own small block of headers.
- MiB means mebibytes, 1,048,576 bytes. A byte is a unit of eight bits of data.
The body generator is deliberately boring:
for p in range(parts): # parts: keep < 1020
out += b"--" + boundary + CRLF
out += b'Content-Disposition: form-data; name="f%d"; filename=""' % p + CRLF
out += b"Content-Type: application/octet-stream" + CRLF
for h in range(headers): # headers: the UNCAPPED amplifier
out += b"X-P%d: x" % h + CRLF # ~320 bytes of PHP heap each
out += CRLF + CRLF
Line by line:
for p in range(parts):starts a loop that builds one multipart part per iteration. The comment reminds us to keep the number of parts below 1020, because PHP does cap that.out += b"--" + boundary + CRLFwrites the separator that marks the start of a part.boundaryis a made-up string that tells the parser where one part ends and the next begins.CRLFis the two-character line ending (carriage return, line feed).out += b'Content-Disposition: form-data; name="f%d"; filename=""' % p + CRLFwrites the header that names the form field. The%dis replaced by the part number, and the filename is left empty.out += b"Content-Type: application/octet-stream" + CRLFdeclares the part as generic binary data.for h in range(headers):is the inner loop, the amplifier. It writes many header lines inside this single part.out += b"X-P%d: x" % h + CRLFwrites one such header line, namedX-Pfollowed by a number. The comment notes that each one costs about 320 bytes of PHP heap.out += CRLF + CRLFcloses the part.
The point of the generator is that the body on the wire stays small while the memory PHP uses to parse it grows far larger. That gap is the amplification.
The request is sent with chunked transfer encoding so no length is declared:
curl -X POST -H 'Transfer-Encoding: chunked' \
-H 'Content-Type: multipart/form-data; boundary=sep' \
--data-binary @body.bin http:
curlis a command-line tool for sending HTTP requests. HTTP is the language browsers and servers speak.-X POSTsays to use the POST method, the one used for submitting data.-H 'Transfer-Encoding: chunked'adds the header that announces the body will arrive in chunks with no declared length. This is the trick that slips past thepost_max_sizecheck.-H 'Content-Type: multipart/form-data; boundary=sep'tells the server the body is a multipart form and that the separator string issep.--data-binary @body.binsends the contents of the filebody.bin, which is the output of the generator above.- The URL at the end is where the request goes.
Against PHP 8.4.26 the result is:
PHP Fatal error: Allowed memory size of 67108864 bytes exhausted
(tried to allocate 4096 bytes) in Unknown on line 0
This is PHP's own error message. It says the allowed memory, 67,108,864 bytes (64 MiB), ran out while trying to grab another 4,096 bytes. "Unknown on line 0" is the tell: the fatal fires during request-startup parsing, before any application code runs, exactly where the vulnerable state lives. The application never got a say. Adding a PHP_SESSION_UPLOAD_PROGRESS field and a session cookie engages the session path behind CVE-2026-109619. That field is a special form field PHP uses to report upload progress, and it is the hook that pulls the session machinery into the picture.
mod_php and PHP-FPM react differently
A common question is whether running PHP-FPM instead of mod_php makes you safe. Not exactly, and the two SAPIs behave differently. SAPI stands for Server Application Programming Interface; it is the glue between the web server and PHP. mod_php is PHP loaded directly inside the Apache web server. PHP-FPM is PHP running as a separate pool of worker processes, usually behind nginx. nginx and Apache are two popular web servers.
The lab fires the identical ~4 MiB request at each:
TARGET | HTTP | WHAT HAPPENS NEXT
mod_php(vuln) | 500 | OOM fatal forced; worker SURVIVES & is reused
nginx+fpm(vuln) | 502 | OOM fatal forced; FPM child EXITS (code 70) & is replaced
- The
TARGETcolumn names the setup being attacked. - The
HTTPcolumn shows the status code the client receives. 500 means the server hit an internal error. 502 means a gateway (here nginx) got a bad answer from the process behind it. - The last column describes what happens to the worker afterwards. On
mod_phpthe worker survives and is reused. On FPM the child exits with code 70 and is replaced.

The OOM fires on both. The difference is the aftermath, and it is the whole game. On mod_php the worker survives the fatal and serves the next request; in the lab the Apache worker PID is identical before and after:
worker_pid= 22 <- before the OOM fatal
worker_pid= 22 <- after: worker SURVIVED & REUSED
A PID is a process identifier, the number the operating system gives each running program. Seeing the same number before and after proves the same process handled both requests.
Request A leaves a global pointing into its freed heap; request B, your next request on the same worker, walks that stale pointer. That reused worker is exactly the window CVE-2026-109619 abuses, and it is the path the advisories demonstrate app-independently. In everyday terms: the first visitor leaves a note pointing at a pigeonhole that has since been emptied, and the next visitor's request follows the note.
On PHP-FPM the child that handled the fatal exits and is recycled, so this particular request-startup sequence does not survive to be consumed. FPM is still listed as susceptible by both CVEs, but via a separate, application-dependent path: state published during normal request execution, then consumed by upload progress. The researchers did not fully detail that path and the lab does not reproduce it. FPM is not immune, but "fire a startup OOM and win" is a mod_php story.
So does it really get a shell?
Yes. This is confirmed, demonstrated, pre-auth remote code execution, not a theoretical "maybe". The CVE-2026-109618 advisory states full unauthenticated RCE was validated over HTTP against mod_php with default input and memory limits, and Calif and Wiz report pre-auth RCE against stock WordPress, Drupal and Joomla.
A shell is a command prompt on the server, the same kind of interface you would get sitting at its keyboard. Getting one means the attacker can run any command the web server's user is allowed to run.
The honest caveats: it is rated AC:H / AT:P, high complexity and special conditions. AC stands for Attack Complexity and AT for Attack Requirements in the CVSS scoring system; H means high and P means present. In plain words, the attack is fiddly and needs particular circumstances. Success depends on heap grooming landing correctly and defeating ASLR. Heap grooming is arranging memory contents on purpose so that the next allocation lands exactly where you want it, like tidying a shelf so a particular book ends up in reach. ASLR, Address Space Layout Randomisation, is a defence that shuffles where things sit in memory each time a program starts, so an attacker cannot hard-code addresses. It is "run it until it wins", not a guaranteed one-shot.
Under the lab settings, the full chain, heap leak, ASLR bypass, fake zend_reference placement and zif_system execution, completes in seconds over plain HTTP against the page that only prints OK:

zend_reference is an internal PHP structure that represents a reference to a value, and zif_system is the internal function that runs a system command. Placing a fake reference and then calling the system function is how the chain turns a memory mistake into a command.
The same chain plants a webshell on the victim and drops into an interactive command loop as www-data, all pre-auth, all over ordinary HTTP POST requests. A webshell is a small script an attacker uploads so they can send commands through the website later. www-data is the low-privilege user account the web server normally runs as.

Actual Exploit Demo: (https://www.youtube.com/watch?v=5oEa2Y_CL1Q)
Lab setup vs. the real world
The lab pins every knob to make heap grooming deterministic: display_errors=On so a warning flushes headers (needed for the Set-Cookie leak), memory_limit=8M so the heap stays small enough for calibrated placement, KeepAlive Off so each connection maps to exactly one request on one worker, and a single prefork child so every request hits the same process. Change any one of those and the demo script breaks.
display_errors=Onmakes PHP print warnings into the response. The leak needs a warning to push the headers out early, which is when theSet-Cookieheader carrying the stolen bytes is sent.memory_limit=8Mkeeps the heap small, so the attacker can predict where things land.KeepAlive Offstops the browser reusing one connection for several requests, so each request maps cleanly to one worker.- A single prefork child means there is only one worker, so every request hits the same process and the stale pointer is always there to be walked.
There is one more dimension: the host platform. The demo's heap grooming uses calibrated filler counts, exact numbers of POST variables that position allocations at specific Zend memory manager slots. Those counts were measured on a standard Linux x86_64 kernel. When the same linux/amd64 container runs inside Docker Desktop's LinuxKit VM (macOS or Windows), or under QEMU emulation on Apple Silicon, the VM's kernel and memory allocator shift the heap layout just enough that the calibrated fillers can miss. The demo is most reliable on native Linux; on Docker Desktop, mileage varies by version. The vulnerability is the same either way: it is the lab script's grooming that is fragile, not the bug.
A container is a packaged, isolated copy of a system that runs on top of your own. Docker Desktop is a tool for running containers on a laptop. A VM (virtual machine) is a simulated computer running inside another. QEMU is software that emulates a computer, including its processor. Apple Silicon is Apple's own chip family. x86_64 and amd64 are names for the common Intel-style processor architecture. Kernel is the core of the operating system that manages memory and processes. Filler counts are the exact numbers of dummy form fields the script sends to nudge memory into the right shape.
POC for dynamic testing: (still testing) https://youtu.be/7gn5Gku1TQY
A POC is a proof of concept, a small demonstration that the problem is real.

None of this means production PHP is safe. It means a generic, one-size script is hard. Each of those constraints has a production-realistic bypass that the researchers demonstrated:

The AC:H / AT:P rating means hard, not impossible. Calif and Wiz achieved pre-auth RCE against stock WordPress, Drupal and Joomla on default PHP settings. Their exploit is more sophisticated than the lab script, but the underlying vulnerability is the same longjmp out of a half-built request that the demo triggers. The researchers withheld their full chain precisely because it works under realistic conditions.
Bottom line: if you run an unpatched PHP up to 8.4.26 on mod_php, treat this as exploitable in the wild. The lab constraints make our demo simple, not the bug itself simple to hit.
Detecting it
The activity happens below the application layer, so your app logs may be quiet. Watch for, per Wiz:
- Unusual multipart requests immediately followed by memory-limit errors.
- Repeated HTTP 500 (and on FPM, 502) from one source.
- Oversized or
%-encodedPHPSESSIDresponse cookies, which is leaked worker memory from bug #2. - Unexplained PHP worker churn, workers dying and recycling.
PHPSESSID is the default name of the cookie that carries a session identifier. Seeing one that is unusually long or full of % sequences is a sign that stolen memory has been stuffed into it.
Cloudflare, AWS, Akamai, Fastly, Imperva, Google and Microsoft have shipped edge and WAF mitigations; those buy time, they do not fix it. WAF stands for Web Application Firewall, a filter that inspects incoming requests and blocks suspicious ones. Edge means the filter runs at the network's outer boundary, before traffic reaches your server.
Does the OOM really happen, and what does the patch change?
It is easy to check. Sweep the header count against PHP 8.4.26 and the limit snaps shut at a sharp edge, one extra header's worth of heap tips a ~64 MiB memory_limit:
200,000 headers (2.6 MiB on the wire) -> HTTP 200
220,000 headers (2.9 MiB on the wire) -> HTTP 500 <- OOM fatal
This is a sweep: send the same body with different numbers of header lines and watch the response. At 200,000 headers the request is served normally (HTTP 200). At 220,000 it fails with an OOM fatal (HTTP 500). The jump between the two is the sharp edge, and it shows the amplification is real: 2.9 MiB on the wire is enough to exhaust 64 MiB of memory.
Firing the identical payloads at 8.4.26 and 8.4.27 shows the before and after:
PHP | PAYLOAD | HTTP | APP CODE RAN?
8.4.26 | header-bomb | 500 | no (fatal before any app code)
8.4.27 | header-bomb | 200 | yes (request served normally)
On 8.4.27 the error log stays empty: the request no longer gets near the limit, even at 2 million headers (27 MiB).
The fix is one commit, Avoid state corruption via bailout, and it does two things. First, the multipart parser stops hoarding junk headers, so the amplifier is gone:
+ if (!php_mime_should_save_hdr(line)
+ || php_mime_get_hdr_value(*header, line)) {
+ key = NULL;
+ } else {
+ key = estrdup(line);
This is a code change, with + marking added lines. Read it as a decision: if the header line is not one the parser needs to keep, or it is a duplicate of one already stored, set key to nothing (NULL). Otherwise, copy the line (estrdup duplicates a string). The effect is that junk headers are no longer kept in memory, so the amplifier is gone.
Second, and this is the real bug fix, an out-of-memory no longer longjmps out of a half-built request. The soft limit queues a delayed error raised after parsing finishes; a higher hard limit _exit()s the worker outright. Either way, request shutdown never walks half-initialised state again:
# Zend/zend_alloc.c + main/SAPI.c
+ * When the soft limit is to be exceeded, a delayed OOM error is queued.
+ * When the hard limit is to be exceeded, the function does not return.
These are comments added to two files, Zend/zend_alloc.c (the memory manager) and main/SAPI.c (the server interface). A soft limit queues a delayed error; a hard limit ends the worker outright. When the soft limit is crossed, the error is queued and raised after parsing finishes, so the request is not abandoned halfway. When the hard limit is crossed, the function does not return at all, and the worker is exited outright. Either way, shutdown never walks half-initialised state.
The OOM was never the vulnerability; it was the lever. The patch keeps PHP's ability to run out of memory and removes the dangling state that made it a weapon. Commits: 01a40e89fbfc (8.2), 3c832b523ee1 (8.3), 506e87fa7dcd (8.4), 31c0ea7d7ff1 (8.5). A commit is a recorded change in a code repository, identified by a long hash.
What to actually do
Patch. It is the only complete fix. Upgrade to PHP 8.2.35 / 8.3.36 / 8.4.27 / 8.5.12 (or later) and restart all workers: the stale state lives in running processes, so an unrestarted worker stays vulnerable.
If you cannot patch this minute, these interim measures are partial and not a substitute:
- PHP-FPM:
session.upload_progress.enabled=0andmemory_limit=-1, then restart. mod_php:memory_limit=-1, then restart.- Do not rely on
RLIMIT_AS/RLIMIT_DATA; they can trigger the bug. - Block multipart at the edge if your app does not use it; cap headers-per-part and decoded body size at the front end; on FPM consider
pm.max_requests=1.
memory_limit=-1 removes the cap entirely, which is why it is a stopgap: it prevents the OOM but opens the door to a denial-of-service attack, where someone floods the server until it falls over. RLIMIT_AS and RLIMIT_DATA are operating-system limits on how much memory a process may use; the warning is that they can trigger the bug rather than prevent it. pm.max_requests=1 tells FPM to recycle each worker after a single request, so no stale state survives to the next one.
Variants to test
- Header-count sweep against your own PHP build. Send the multipart body with increasing numbers of header lines inside one part and watch for the sharp edge where the response flips from 200 to 500 with an OOM fatal in
Unknown on line 0. A positive result is a fatal during request-startup parsing before application code runs. - Chunked body with no declared length. Send the same body with
Transfer-Encoding: chunkedand noContent-Length. A positive result is thatpost_max_sizedoes not reject the request even though the consumed body exceeds it. - Worker reuse on
mod_php. Record the worker PID before and after an OOM fatal. A positive result is the same PID serving the next request, which is the precondition for the cross-request stale pointer. - Session path. Add a
PHP_SESSION_UPLOAD_PROGRESSfield and a session cookie to the OOM request. A positive result is engagement of the session path behind CVE-2026-109619. - Leak check. Look for oversized or
%-encodedPHPSESSIDresponse cookies. A positive result is leaked worker memory from bug #2 appearing in the cookie. - Detection signals. Watch for unusual multipart requests immediately followed by memory-limit errors, repeated HTTP 500 (and on FPM, 502) from one source, and unexplained PHP worker churn.
- Patch verification. Fire the identical payload at the patched build. A positive result is HTTP 200 with the request served normally and an empty error log, even at 2 million headers.
Run any of this only against systems you own.
Credits and references
All credit to the researchers, Calif.io, Wiz Research and OpenAI, and to the PHP security team for the fix.
- Calif.io, php2shell: https://calif.io/php2shell/
- Wiz Research, PHP2Shell: https://www.wiz.io/blog/php2shell-php-rce
- CVE-2026-109618:
GHSA-w8hw-w9fx-j79w - CVE-2026-109619:
GHSA-6wmf-4rv5-p3rp - PHP October 2026 Security Release: https://www.php.net/
The companion lab reproduces only the publicly documented trigger, the cross-request precondition and the detection signals, with no weaponised chain. Run it only against systems you own.
Glossary
- AC:H / AT:P: CVSS rating meaning high attack complexity and special attack requirements present.
- Allocation: a request to the memory manager for a chunk of space.
- ASLR: Address Space Layout Randomisation, a defence that shuffles where things sit in memory each time a program starts.
- Authentication: proving who you are, usually with a username and password.
- Byte: a unit of eight bits of data.
- Chunked transfer encoding: sending a body in pieces without announcing the total size up front.
- Commit: a recorded change in a code repository, identified by a long hash.
- Container: a packaged, isolated copy of a system that runs on top of your own.
- Content-Length: a request header announcing how many bytes the body will contain.
- Cookie: a small piece of text a website asks your browser to store and send back with later requests.
- CVE: a public catalogue number given to a known vulnerability.
- CVSS: a scoring system for the severity of a vulnerability.
- Dangling pointer: a pointer to memory that has been freed or reused.
- Denial of service (DoS): an attack that makes a service unavailable, often by flooding it.
- Docker Desktop: a tool for running containers on a laptop.
- Edge: the outer boundary of a network, where traffic can be filtered before reaching a server.
- Fatal error: an error serious enough that the current operation cannot continue.
- Filler counts: exact numbers of dummy form fields sent to nudge memory into the right shape.
- Freed memory: memory the program has handed back and declared empty.
- Global: a variable that lives outside any single request and is shared by the worker across requests.
- Hard limit: a threshold whose crossing ends the worker outright.
- Header: a line of metadata at the top of a request or response.
- Heap: the area of memory where a program keeps temporary data.
- Heap grooming: arranging memory contents on purpose so the next allocation lands where you want it.
- HTTP: the language browsers and servers speak.
- Kernel: the core of the operating system that manages memory and processes.
- Longjmp: a function that makes a program jump out of what it was doing back to a safe point.
- Memory: the workspace where a running program keeps its data.
- memory_limit: a PHP setting capping how much memory a request may use.
- MiB: mebibyte, 1,048,576 bytes.
- mod_php: PHP loaded directly inside the Apache web server.
- Multipart: the format browsers use to send forms that include file uploads.
- nginx: a popular web server.
- OOM (out of memory): an error when a program asks for more memory than it is allowed to use.
- PHP: the programming language that builds many web pages on the server.
- PHP-FPM: PHP running as a separate pool of worker processes, usually behind nginx.
- PID: process identifier, the number the operating system gives each running program.
- Pointer: a value that records where in memory some data lives.
- POC: proof of concept, a small demonstration that a problem is real.
- post_max_size: a PHP setting limiting how large a submitted form may be.
- Pre-authentication: an attack that works before any login.
- Process: a running copy of a program.
- QEMU: software that emulates a computer, including its processor.
- Remote code execution (RCE): a vulnerability that lets an attacker run their own commands on a server.
- Request heap: the private scratch area in memory for one request.
- Request shutdown: the moment a request's state is torn down.
- Request startup: the moment a request's state is set up, before application code runs.
- RLIMIT_AS / RLIMIT_DATA: operating-system limits on how much memory a process may use.
- SAPI: Server Application Programming Interface, the glue between the web server and PHP.
- Session: the server-side record of a logged-in visitor.
- Shell: a command prompt on a server.
- Soft limit: a warning threshold.
- Uninitialised memory: memory the program never wrote anything into.
- URL-encoding: writing arbitrary bytes as safe text using
%followed by two hex digits. - Use-after-free (UAF): using memory after it has been freed.
- Unserialising: turning stored text back into live program data.
- VM: virtual machine, a simulated computer running inside another.
- Vulnerability: a mistake in software that lets someone make it do something unintended.
- WAF: Web Application Firewall, a filter that inspects incoming requests and blocks suspicious ones.
- Webshell: a small script an attacker uploads so they can send commands through the website later.
- Worker process: a long-lived process that handles many requests one after another.
- www-data: the low-privilege user account the web server normally runs as.
- x86_64 / amd64: names for the common Intel-style processor architecture.
- zend_reference: an internal PHP structure representing a reference to a value.
- zif_system: the internal PHP function that runs a system command.