Skip to content
Exploit for Improperly Controlled Sequential Memory Allocation in Php

Exploit for Improperly Controlled Sequential Memory Allocation in Php

Sploitus • October 21, 2026

([GHSA-6wmf-4rv5-p3rp](

"RCE via stale global state", CVSS v4.0 **9.2 Critical**, CWE-416) — the

sibling advisory of CVE-2026-109618, fixed by the same PHP core commit on

**2026-10-21** (8.2.35 / 8.3.36 / 8.4.27 / 8.5.12).

> **Overview** — PHP keeps worker-global state

> session `PS(id)`/`PS(save_path)`, the var-layer `BG(serialize)`/

> `BG(unserialize)` contexts, OPcache per-worker map frontier) that can point

> into request-owned memory. A fatal error (or OOM bailout) that abandons an

> operation before its matching reset leaves the global dangling after the

> request heap is freed. A later operation running **before normal request

> initialization** consumes the stale value: a cross-request use-after-free

> the vendor developed into unauthenticated RCE.

## Producer / consumer model (from the advisory, verified against php-src)

- **Producers**: fatal errors that skip the matching global reset — OOM,

uncaught errors, `require` failure, `Maximum execution time exceeded`; or

nonfatal diagnostics that repopulate error state after shutdown cleared it.

- **Consumers** (both run pre-RINIT, before the executor reinitializes

state): per-request INI diagnostics (mod_php `php_value`/`.htaccess`, FPM

`PHP_VALUE`/`PHP_ADMIN_VALUE`), and the session upload-progress early

machinery (application-agnostic, no `session_start()` needed).

| Producer: application-phase fatal publishes a request-owned backtrace (`fatal_error_backtraces=On`, compiled default on 8.5) | **captured** (3/3) on vulnerable php-8.5.11, patched php-8.5.12 and the ASAN twin | `evidence/01-fatal-backtrace-producer.txt` |

| Consumer: pre-RINIT diagnostic fires on an over-limit multipart POST (`main/rfc1867.c:697` gate, no body read needed) | **captured** on mod_php | `evidence/02-consume-diagnostic-pre-rinit.txt` — `Warning: PHP Request Startup: POST Content-Length of 10485760 bytes exceeds the limit of 8388608 bytes in Unknown on line 0` |

| Cross-request UAF sanitizer receipt / RCE | **documented, not reproduced here** | vendor-confirmed RCE (fatal-backtrace path on mod_php; session-lifecycle path on mod_php AND php-fpm; OPcache type confusion on WordPress — Wiz). Public audits report the exploit tiers need per-build offsets + heap grooming |

Two independent peer-review passes were performed on this material

(reject-and-fix iteration, then a zero-blocking confirmation pass).

poc/exploit_opt.py producer + consumer driver (compact)

poc/exploit_readable.py same, tutorial-grade

evidence/ captured lab transcripts (paths scrubbed)

lab/ self-contained docker compose lab (shared with

the companion advisory's lab; see its README)

python3 poc/exploit_opt.py --url --rounds 3

python3 poc/exploit_readable.py --url --rounds 3

Lab assumptions: the ASAN twin runs `php -S 0.0.0.0:8080 -t /www` inside the

container, and the PoCs read the server log via

`docker logs cve-2026-109618-asan` — both are wired for the shipped `lab/`

compose; if your container/app names differ, adjust `LAB_CONTAINER` and the

Each round: `produce` (fires the lab fixture fatal that publishes the

backtrace state) then `consume` (over-limit declared `Content-Length` — the

diagnostic fires before any body byte is read, so the transport is

fire-and-half-close; waiting on a full response would hang by design).

Output tiers are printed separately: `published=True` marks the producer

receipt; an `AddressSanitizer` report after rounds would be the UAF-tier

receipt (not yet captured in any tested configuration — the tool says exactly

## Notes that matter if you study this bug

- The consume gate compares the **declared** length only, pre-body-read —

the same property that enables the chunked bypass documented in the

- The INI-diagnostic consumer path is real on mod_php (the tested

`report_memleaks=0` per-dir deprecation fired per-request; earlier

"does not fire" reports were probe artifacts — the diagnostic goes to the

display layer, not the buffered log a naive grep watches).

- The shared fix (`31c0ea7d7f`) removes the OOM bailout class entirely

(delayed soft OOM at VM safe points + hard `_exit()`), resets the

"may be accessed before php_request_startup()" globals early, and locks

the pre-RINIT session decode to `__PHP_Incomplete_Class`.

1. **Only complete fix: update** to 8.2.35 / 8.3.36 / 8.4.27 / 8.5.12+.

2. On 8.5: `fatal_error_backtraces=0` (removes the confirmed producer)

and/or `session.upload_progress.enabled=0`, then restart every worker.

3. Eliminate attacker-reachable fatals (including upload/import/plugin

paths); apply INI via startup config instead of per-request overrides;

`pm.max_requests=1` limits each worker to a single request as a stopgap.

4. Audit with `log_errors=On` + `error_reporting=E_ALL` for repeated

pre-script diagnostics, fatals and max-execution-time events on

attacker-influenceable routes (absence of log entries is not proof of

A self-contained `docker compose` lab ships in `lab/` (identical to the

companion advisory's lab; either copy runs standalone): `cd lab && docker compose

build && docker compose up -d` — ports 8080=vuln(8.5.11), 8081=fixed

(8.5.12), 8082=asan. The producer fixture (`lab/www/fatal.php`) ships in the

- Fatals/uncaught errors followed by worker churn on the same pool.

- Repeated diagnostics appearing with `Unknown on line 0` (startup stage)

- FPM pool logs: same-child producer+consumer pairing anomalies.

For **authorized security research and defense on systems you own or are

explicitly permitted to test**, in isolated lab environments. Test the

vulnerable behavior from a source build of the last vulnerable tag

(`php-8.5.11`). No warranty, see `LICENSE`.

- [GHSA-6wmf-4rv5-p3rp — RCE via stale global state](

- [GHSA-w8hw-w9fx-j79w — companion advisory (OOM corruption)](

- Wiz Research "PHP2Shell" blog; OpenAI + Calif disclosure blogs

- xuehuolll independent audit repo; JackalSyn "php-up-2026" writeup

Prepared with the b63 exploit-foundry tooling: advisory verification against

primary sources, a reproducible pinned-build lab, two PoC variants, captured

transcripts, and two adversarial review passes. Feedback and corrections

Extracted Entities

Attack Types (1)

CWE Weaknesses (1)