
Mass validator for the php2shell PHP core chain (CVE-2026-109618/109619): fingerprints versions and confirms exposure via chunked-TE and pre-app OOM oracles.
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 application code runs.
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
deterministically on both.
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.
| 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):
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.8.1.2-1ubuntu2.x) must be verified with the vendor — the scanner resolves this with its behavioral oracle.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.| File | Purpose |
|---|---|
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). |
# single target (host:port or URL)
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
# full network sweep
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
CVE-2026-109619 is live.
P3a — Chunked oracle (~9 MiB). Multipart POST with Transfer-Encoding: chunked:
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).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).
About executing commands (
whoami): the full RCE requires weaponized heap grooming with per-build offsets (reclaiming the freed slot with forgedzend_fcall_infostructures →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 exploit exists.
| Verdict | Meaning |
|---|---|
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. |
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).PROBE_BLOCKED) — version check still applies.--threads to avoid saturating links.X-Powered-By + WAF + raised post_max_size = UNKNOWN (fall back to host-based validation).