PHP session save handler RCE via file corruption
High risk · public exploit
Risk assessment
PHP before 8.2.36, 8.3.37, 8.4.28 and 8.5.13 allows RCE through interrupted session file writes (CVSS 9.2). Update PHP now.
What to do
Apply the latest security patches from the vendor. If patching is not immediately possible, review the mitigation steps in this advisory and monitor for exploitation attempts.
- No fixed version listed yet. Restrict exposure and watch the vendor advisory. NVD references
- Remediation and Mitigation in this advisory
Exploitation confirmed - public proof-of-concept - CVE-2026-126714 is a critical remote code execution vulnerability in PHP versions before 8.2.36, 8.3.* before 8.3.37, 8.4.* before 8.4.28 and 8.5.* before 8.5.13 that lets an attacker influence session data, interrupt a session file write at the right moment, and inject serialized objects that can run code when a gadget chain is present. Patched releases are available; upgrade immediately.
Overview
PHP’s default session save handler updates an existing session file in place rather than truncating it first. When a session write is interrupted partway through, the file can end up holding the start of the new session data followed by the tail of the old data. That malformed mix can cause bytes from an ordinary string to be interpreted as serialized objects the next time the session is read.
An attacker who can steer what goes into the session, for example through session upload progress, can try to interrupt a write at a point that produces a useful object injection. If the application also loads a suitable gadget chain, the injected object can lead to code execution. Even without a gadget chain, corrupted session files can break application state and cause data loss.
Impact
The CVSS score is 9.2 (critical). The attack vector is network, complexity is low, and no privileges or user interaction are required, so the barrier to attempting exploitation is low. Two outcomes matter for defenders:
- Remote code execution when a gadget chain exists in the application, since the unserialized object originates from attacker-influenced session bytes.
- Session corruption that can log users out, scramble state, or cause unpredictable application behavior even where no chain is reachable.
This is not confirmed as actively exploited, but the technical preconditions are modest and the potential payoff is high.
Remediation and Mitigation
- Upgrade PHP to 8.2.36, 8.3.37, 8.4.28 or 8.5.13, or later, on every host that runs the default session handler. This is the only complete fix.
- Reduce attack surface where an upgrade must wait: switch session storage to an alternative handler, disable session upload progress, and restrict who can reach endpoints that write session data.
- Audit gadget exposure. Review autoloaded libraries and framework chains that could turn an injected object into code execution.
- Monitor for session files that fail to parse, unexpected unserialize warnings, and repeated session write failures.
For related incident tracking, see breach reports and security news.
Security Insight
This bug is a sobering reminder that file-based session state, one of the oldest pieces of PHP, still carries implicit trust assumptions that break under interruption. The parallel to PHP’s 2016 session.upload_progress object injection issues is direct: the same feature that gave attackers a way to control serialized session content then remains a useful lever now, and the ecosystem never fully retired it. That a core handler can leave a half-written file that later unserializes attacker-influenced bytes shows how much risk sits in default settings that most deployments never revisit.
Further Reading
Exploit references 3 PoC Show
Public PoC References
Unverified third-party code
These repositories are publicly listed on GitHub and have not been audited by Yazoul Security. They may contain malware, backdoors, destructive payloads, or operational security risks (telemetry, exfiltration). Treat them as hostile binaries. Inspect source before execution. Run only in isolated, disposable lab environments (offline VM, no credentials, no production data).
Authorized use only. This information is provided for defensive research, detection engineering, and patch validation. Using exploit code against systems you do not own or do not have explicit written permission to test is illegal in most jurisdictions and violates Yazoul's terms of use.
| Repository | Stars |
|---|---|
| bimajunestifa/phpAfterShell CVE-2026-126714 (phpAfterShell) | ★ 1 |
| tani2shell/phpaftershell-lab PHP session write-race deserialization lab — gadget splice via non-atomic upload_progress writes, PHP 8.4.27 vs patched 8.4.28 pair (CVE-2026-126714). | ★ 0 |
| VABISMO/PHPAfterShell-poc Educational proof of concept for CVE-2026-126714 (phpAfterShell): unauthenticated RCE via interrupted session writes in PHP's file-based session handler. Docker lab (vulnerable/fixed/mitigated), HTTP- | ★ 0 |
Showing 3 of 3 known references. Source: nomi-sec/PoC-in-GitHub.
Get a Telegram alert when the next one lands: PHP advisories