National Cyber Warfare Foundation (NCWF)login

php2shell for reproducible research into the PHP session.upload_progress OOM RCE chain


0 user ratings
2026-11-08 03:30:16
milo
Red Team (CNA)
"php2shell

php2shell is a research workspace for reproducing the session.upload_progress pre-auth memory-corruption chain (CVE-2026-109618/CVE-2026-109619) in controlled, authorized laboratory environments.








Tooldevploit/php2shell — version-aware research toolkit and profile engine for the PHP session.upload_progress OOM/stale-pointer pre-auth RCE chain
CategoryExploit development / vulnerability research toolkit (Python)
Primary UseReproducing and calibrating CVE-2026-109618/CVE-2026-109619 against self-owned mod_php and PHP-FPM laboratory builds, with per-build profiles and honest negative results
Safe UseAuthorized testing only, per the README: exclusively against systems you own or have explicit written permission to test; it ships no target list and is positioned for reproducible research and defensive validation, not mass exploitation
Telemetry NoteHighly observable from the defensive side: the chain sends large request bodies, triggers pre-RINIT out-of-memory conditions and kills Apache children, so defenders can watch for oversized multipart uploads with session.upload_progress fields, repeated OOM log entries, and Apache child process crashes

php2shell from devploit is a Python research workspace built around a specific and unusually interesting memory-corruption class in PHP itself: the session.upload_progress out-of-memory and stale-pointer chain tracked as CVE-2026-109618 and CVE-2026-109619. The toolkit wraps the public research exploit by 9bie with a version-aware dispatcher, a per-build profile engine, reproducible Docker-based laboratories, a calibration factory and runtime instrumentation. The stated goal in the README is reproducible research and defensive validation, not mass exploitation, and the project's own disclaimer is unusually direct: authorized testing only, no target list, and a warning that the chain is disruptive because it sends large request bodies, triggers pre-RINIT out-of-memory conditions and kills Apache children.


What makes this repository stand out from a typical proof-of-concept dump is the engineering discipline around uncertainty. The dispatcher refuses to guess: it stops when the target build has no verified profile, when the target is a fixed release, or when the target OS does not match the profile's architecture. This is the opposite of spray-and-pray exploitation tooling, and it reflects the reality of heap exploitation — the geometry of a use-after-free chain is a function of the exact binary, its compile-time prefix, the allocator state and the SAPI, so a payload calibrated for one build is noise on another. Treating that constraint as a first-class design decision is what separates a research instrument from a weapon.


The status matrix is the heart of the documentation. It enumerates 56 profiles — 48 Apache/mod_php plus 8 PHP-FPM variants — of which 30 have verified remote code execution demonstrated as a command proof (uid=33(www-data)) on an isolated lab. Coverage spans PHP 8.5.11 down to PHP 7.4.33, across amd64 and aarch64, official Docker images and source builds. Just as valuable are the honest negatives: rows marked no where the stage-1 UAF shapes the heap differently on older subversions (8.1.x, 8.2.x, 7.4.x and 8.4.2 under mod_php) and the leak does not reproduce with the 8.4.10+ parameters. The README explicitly frames these as honest negatives, reported as such — a level of epistemic hygiene rare in exploit repositories.


Internally the chain is staged. Stage 1 is the heap leak, stage 2 the libphp leak, and stage 3 the actual code-execution primitive. The README describes the FPM variant in the most architectural detail: an out-of-memory request leaves the BG(unserialize) pointer stale, the next request reclaims the freed struct, and a forged session variable turns the session shutdown path into a call through zif_system. That is a textbook use-after-free reclaim pattern, and the toolkit's per-profile offsets, htdata references and heap parameters — inventoried in docs/offset-inventory.md — encode the calibration needed for each build.


The feature set reveals careful operational thinking, even inside a lab-first design. A configuration probe makes one request to learn the target's memory_limit, post_max_size and whether diagnostics render under display_errors, so the chain runs once instead of sweeping memory limits — and a post_max_size that would silently reject the OOM body is reported as CONFIG BLOCKED before any attempt. Worker pinning holds N-1 prefork workers busy with idle keep-alive connections so the whole multi-request chain lands on a single process: automatic for loopback labs, opt-in for remote infrastructure. --php-version covers servers that hide their version, --arch selects aarch64 or amd64, and --profile forces an exact build such as php-8.4.26-deb13-apxs2-amd64.


The stage-3 evolution is documented with similar granularity. The early-8.5 heap places the dangling reference out of reach of the upstream carrier, so the project introduced a vessel stage 3 in tools/php2shell_vessel.py: request S steers the reference one page up onto B2's blob page, where a blob embeds the reference pattern itself. This kind of narrative — the heap moved, so the technique moved with it — is exactly what makes the repository useful as a learning artifact for anyone studying allocator manipulation in long-lived server processes.


Verification methodology deserves its own paragraph because it is the project's credibility backbone. An independent re-verification dated 2026-10-30 reproduced the command proof for every RCE profile added by the stage-3 PR, and those profiles carry a contributor-reported, maintainer-confirmed status. The PHP-FPM profiles and the 8.4.26 deb13/apxs2 source build remain contributor-reported, not independently confirmed, with the caveat that compile-time prefixes shift the heap and the maintainer recommends re-running calibrate on the host that will run the exploit. The apxs2 profile is even annotated as instance-dependent — 4/4 runs on one Apache master, 0/5+ on others — which is exactly the kind of variance a professional expects from phase-sensitive heap chains.


For defenders, the telemetry note is arguably the most actionable part of the README. Exploitation of this class is loud by construction: oversized multipart request bodies with session.upload_progress metadata, repeated pre-RINIT OOM conditions in PHP error logs, and killed Apache child processes are all directly observable signals. The lab configuration itself — Apache prefork mod_php, one worker, display_errors=On, memory_limit=8M, session.upload_progress=On — doubles as a checklist of the settings that make the chain viable, which administrators can audit on their own estates: disabling session.upload_progress where it is not needed and normalizing memory_limit materially shrinks the attack surface described here.


Cloning for study is straightforward with git clone https://github.com/devploit/php2shell, and the repository is MIT-licensed, written in Python, with 272 stars at the time of writing. The docs/ tree — the offset inventory, the profile inventory, and the run screenshots — is where the educational value concentrates; reading how the calibration factory derives per-image offsets is more instructive than any single profile.


Where this fits in an authorized workflow is narrow and the project is honest about that: validating whether your own, explicitly scoped deployments running vulnerable PHP versions are actually exposed, reproducing the CVEs for training purposes in the bundled laboratories, and generating the detection hypotheses noted above. It is not a scanner, it is not a mass-exploitation framework, and its refusal logic actively prevents accidental use against mismatched or patched targets. For vulnerability researchers, bug-bounty professionals working on owned scope, and blue teams building detections for PHP memory-corruption classes, php2shell is one of the better-documented research workspaces in this niche — a project whose negatives are as informative as its positives.



Official project repository for devploit/php2shell.

Download Tool

Educational analysis for authorized security professionals. Use only in controlled, authorized environments.






Source: OffensiveSec
Source Link: https://www.offsecblog.com/2026/11/php2shell-for-reproducible-research.html


Comments
new comment
Nobody has commented yet. Will you be the first?
 
Forum
Red Team (CNA)



Copyright 2012 through 2026 - National Cyber Warfare Foundation - All rights reserved worldwide.