Skip to content
Exploit for CVE-2026

Exploit for CVE-2026

Sploitus • October 21, 2026

[![CVE](

[![CVSS](

[![Python](

[![License: MIT](

Defensive scanner to mass-validate whether the web servers in a network are

affected by **php2shell**, the chain of two critical use-after-free

vulnerabilities (CVSS v4.0 **9.2**) in the **PHP core** disclosed on

2026-10-21: unauthenticated remote code execution that triggers **before any

**Validated against real PHP** (Docker lab: vulnerable `php:8.4.26-apache` vs

patched `php:8.4.27-apache`): the behavioral oracle and the OOM evidence behave

> **Authorized use only** — your own networks or pentest engagements with

> written permission. The scanner does NOT weaponize the memory-corruption

> exploit (no RCE code included or executed); it validates exposure using

> harmless evidence. See [Disclaimer](#disclaimer).

| **CVE-2026-109618** (GHSA-w8hw-w9fx-j79w) | UAF in out-of-memory handling during `php_request_startup()`: multipart (RFC1867) parsing is interrupted with the heap half-initialized, and cleanup treats invalid data as valid. Includes remote memory disclosure via the `PHPSESSID` cookie. |

| **CVE-2026-109619** (GHSA-6wmf-4rv5-p3rp) | Request-owned internal state survives its freed memory (`session.upload_progress`, fatal-error backtraces on 8.5): a later request on the **same worker** consumes the stale state → memory corruption → unauthenticated RCE. |

Key facts (Tenable, Wiz, Sansec, watchTowr, CERT-EU, php.net, Calif):

- Execution happens **before application code** (during request parsing) — application-level maintenance mode provides no protection.

- Vector: `multipart/form-data`. `post_max_size` is validated against the **declared Content-Length**, not the bytes actually consumed → a POST with `Transfer-Encoding: chunked` (no Content-Length) **bypasses the limit entirely**.

- Affects **PHP ≥ 5.4.0**; both mod_php and PHP-FPM; default configurations are vulnerable. Pre-auth RCE demonstrated on WordPress, Drupal, Joomla, Magento, phpMyAdmin, Nextcloud, and more.

- **Fixed upstream (2026-10-21)**: **8.5.12 / 8.4.27 / 8.3.36 / 8.2.35**. Branches 7.4/8.0/8.1 only have source backports; distro builds (`8.1.2-1ubuntu2.x`) must be verified with the vendor — the scanner resolves this with its behavioral oracle.

- Active exploitation confirmed by Cloudflare/watchTowr since before the patch.

- **Partial** mitigations: `session.upload_progress.enabled=0` (+ worker restart), `fatal_error_backtraces=0` (8.5), blocking `multipart/form-data` at the edge, or `memory_limit=-1` with a bounded `post_max_size`.

| `php2shell_scanner.py` | The scanner (Python 3.8+, stdlib only). |

| `targets_ejemplo.txt` | Example target list. |

| `mock_server_test.py` | Mocks (vulnerable/patched/non-PHP) for pipeline self-testing. |

| `lab_probe.py` | Docker-lab harness used to derive/validate the probes (research documentation). |

python php2shell_scanner.py --target 10.0.1.20:80 --poc --confirm-authorized

# target list from file (host, host:port or URL per line)

python php2shell_scanner.py --list apps.txt --poc --confirm-authorized --json results.json

python php2shell_scanner.py --cidr 10.0.2.0/24 --ports 80,443,8080 --poc --confirm-authorized --threads 20

# fingerprint/version only, no active probes

python php2shell_scanner.py --list apps.txt --no-poc

JSON output via `--json`, per-verdict summary in console. **Exit code** `1` if

affected targets are found (CI-friendly), `0` otherwise.

- `--poc` / `--no-poc`: active probes (default: on; requires `--confirm-authorized`).

- `--probe-mb N` (default 9): size of the P3a oracle — just above the default `post_max_size=8M`.

- `--no-oom` / `--oom-mb N` (default 132): skip / resize the P3b evidence — crosses the default `memory_limit=128M`. Raise to 264 for `memory_limit=256M`.

- `--threads`, `--timeout`, `--verify-tls`.

**P1 — Passive fingerprint.** Initial GET: `X-Powered-By` → verdict against the

patched-version table; `PHPSESSID` cookie presence; PHP signature in body/Server.

**P2 — `session.upload_progress` oracle (harmless).** Minimal multipart POST

with a `PHP_SESSION_UPLOAD_PROGRESS` field: if PHP initializes a session on its

own (fresh cookie in the response), the confirmed attack path for

**P3a — Chunked oracle (~9 MiB).** Multipart POST with `Transfer-Encoding: chunked`:

* **Patched build**: applies `post_max_size` against the real bytes and emits

`Warning: Actual POST length does not match Content-Length, and exceeds N bytes`

before app code → **bypass CLOSED**. Also resolves distro builds carrying a

backport (old version, corrected behavior).

* **Vulnerable build**: parses the 9 MiB with no limit and no warning →

**bypass OPEN** (the CVE-2026-109618 precondition is reachable unauthenticated).

**P3b — Pre-app OOM evidence (132 MiB, only if P3a is open).** The pad crosses

`memory_limit` during startup: the vulnerable build responds

`Fatal error: Allowed memory size of 134217728 bytes exhausted ... in Unknown on line 0`

— a fatal **inside `php_request_startup()`, before the application runs and

without authentication**: the exact precondition of the php2shell chain,

captured as evidence. The worker survives (validated: 10/10 grooms, no crash).

> ** executing commands (`whoami`)**: the full RCE requires weaponized

> heap grooming with per-build offsets (reclaiming the freed slot with forged

> `zend_fcall_info` structures → `zend_call_function` → `system()`). The

> original php2shell exploit was never published, and the public skeleton

> (eness) admits it doesn't even fire against its own target without an

> external address leak. Firing that corruption blindly at production would be

> intrusive (crash risk). That's why the scanner's PoC stops at the reproducible

> precondition + patch oracle: irrefutable, harmless evidence of the same

> defect. For a command-execution demo, use a lab once a turnkey public

| `VULNERABLE_CONFIRMED` | Pre-app OOM reproduced via the chunked bypass (evidence in console/JSON). |

| `VULNERABLE_VERSION` | PHP version below the patched release (upstream). |

| `VULNERABLE_LIKELY` | Version hidden but post_max_size bypass open. |

| `VULNERABLE_VERSION (distro…)` | Vulnerable upstream version with a distro suffix. |

| `PATCHED` / `PATCHED (backport…)` | Version fixed **or** behavioral oracle confirms the fix. |

| `PROBE_BLOCKED` | WAF/edge blocked the chunked probe; inconclusive. |

| `UNKNOWN` | PHP present, version hidden, probe inconclusive. |

| `NO_PHP` | No PHP indicators on the endpoint. |

- If the target raised `post_max_size` above the probe, P3a cannot tell (use a larger `--probe-mb`); if `memory_limit` is above 132M, P3b won't fatal (use a larger `--oom-mb`).

- A WAF in front may block chunked TE (`PROBE_BLOCKED`) — version check still applies.

- P3b transfers 132 MiB per target (~1–2 s on 1 Gbps LAN); tune `--threads` to avoid saturating links.

- Hidden `X-Powered-By` + WAF + raised `post_max_size` = `UNKNOWN` (fall back to host-based validation).

1. **Upgrade** to 8.5.12 / 8.4.27 / 8.3.36 / 8.2.35 (or your distro's backport) and **restart** Apache/PHP-FPM.

2. If you can't patch today: `session.upload_progress.enabled=0` (+ `fatal_error_backtraces=0` on 8.5, + worker restart) and/or block `multipart/form-data` at the edge (breaks uploads).

3. Monitor: anomalous multipart requests followed by HTTP 500s, oversized/malformed `PHPSESSID` cookies, worker restarts.

docker run -d --rm --name php_vuln -p 8901:80 php:8.4.26-apache

docker run -d --rm --name php_patched -p 8902:80 php:8.4.27-apache

for c in php_vuln php_patched; do docker exec $c sh -c \

python php2shell_scanner.py --target 127.0.0.1:8901,127.0.0.1:8902 --poc --confirm-authorized

# expected: VULNERABLE_CONFIRMED (8901) / PATCHED (8902)

Lab findings (2026-10-21, documented in `lab_probe.py`):

- `max_input_vars=1000` and `max_input_nesting_level=64` (both also apply to `$_FILES`) neutralize the "nested-key sub-post_max_size exhaustion" amplification on stock config — the practical route is the large-value pad via chunked encoding.

- Stock PHP 8.4.26: chunked TE with no Content-Length parses arbitrary bodies (no warning, no limit); pre-app OOM fatal is 100% reproducible; the worker does not die.

- Stock PHP 8.4.27: same probe → `Actual POST length does not match Content-Length` warning (the patch enforces the limit against real bytes) — the basis of the P3a oracle.

- The `PHPSESSID` heap leak requires the precise reclaim of the weaponized exploit; it does not manifest with the simple sequence — documented, not claimed by the scanner.

Mocks (pipeline without Docker): section 7 — note the mocks don't parse chunked TE, so they validate verdicts/pipeline, not P3.

python mock_server_test.py vuln 8801 & python mock_server_test.py patched 8802 & python mock_server_test.py nophp 8803 &

python php2shell_scanner.py --target 127.0.0.1:8801,127.0.0.1:8802,127.0.0.1:8803 \

--poc --confirm-authorized --json test.json

# expected: VULNERABLE_VERSION / PATCHED / NO_PHP

This is a defensive validation tool for incident response and patching of

one's own infrastructure. The operator is responsible for having authorization

over the scanned systems. It contains no exploitation (RCE) or evasion code;

its active probes (P3a/P3b) only reproduce the memory precondition and the

patch oracle documented in the advisories, with minimal impact (workers

- php.net advisory (GHSA-w8hw-w9fx-j79w / GHSA-6wmf-4rv5-p3rp)