Published
- 7 min read
By Allan D - Editor, AI Security Wire
phpAfterShell: PHP Session Partial-Write Flaw (CVE-2026-126714)
A flaw in how PHP’s default file session handler overwrites session files can let an attacker splice attacker-chosen bytes into a stored session, which PHP then deserializes on the next request. It is tracked as CVE-2026-126714, named phpAfterShell by the security firm depthfirst, and it was fixed on November 19, 2026 in PHP 8.5.13, 8.4.28, 8.3.37 and 8.2.36. It is the follow-up to the October PHP2Shell flaws, and it affects code that those earlier patches left in place.
What was disclosed
| Field | Detail |
|---|---|
| CVE | CVE-2026-126714 |
| Weakness | CWE-367 (time-of-check time-of-use race) and CWE-662 (improper synchronization), per the CVE record |
| CVSS v4.0 | 9.2 Critical, AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H, assigned by the PHP CNA |
| NVD status | Awaiting Analysis on November 24, 2026; the 9.2 shown there is the CNA’s score |
| Affected | PHP before 8.2.36, 8.3.x before 8.3.37, 8.4.x before 8.4.28, 8.5.x before 8.5.13 |
| Published | November 19, 2026 |
| Advisory | GHSA-fm2m-fjf5-v3cp, rated critical |
The 9.2 score comes from the PHP project itself. NVD had not added its own analysis when we checked, so there is no independent NVD base score yet.
How the bug works
PHP’s file session handler keeps each session in one file. According to depthfirst’s technical analysis, the handler updates an existing session by calling pwrite() at offset 0 and then ftruncate() on the same file, rather than writing a new file and swapping it in. That update is not atomic. If the worker process dies part-way through, the file ends up holding the start of the new session joined to the tail of the old one.
Serialized PHP strings carry a length field. depthfirst describes how leftover bytes from the old record can then be read as a new top-level session entry, for example evil|O:8:"stdClass":..., which session_start() deserializes on a later request. That is object injection into the session.
The PHP advisory states that the affected code has been present since PHP 4.1.0, by code inspection, and that the issue is not limited to the upload-progress feature or to PHP 8.6. The October PHP2Shell patch restricted class resolution during upload-progress updates, but according to depthfirst it did not change the non-atomic write underneath.
depthfirst separates three cases:
- Original path: earlier releases, per depthfirst’s table dated November 17, 2026, 8.2.0 to 8.2.34, 8.3.0 to 8.3.35, 8.4.0 to 8.4.26, 8.5.0 to 8.5.11 and 8.6.0RC1 to RC3.
- Variant A: the write is interrupted during a buffered
pwrite(), for example by an out-of-memory kill. It affects 8.2.35, 8.3.36, 8.4.27 and 8.5.12, the releases that fixed PHP2Shell. - Variant B: the truncate happens after the write, so the window sits between
pwrite()andftruncate(). depthfirst’s table, dated November 17 and so describing the pre-fix development trees, lists 8.4.28RC1, 8.5.13RC1 and 8.6.0RC4 onward and master, and ties it to a specific upstream commit. Do not read 8.4.28 or 8.5.13 final as vulnerable, since those are the fixed releases. No source we opened names the PHP 8.6 fix version, so that is unverified.
The advisory adds that in threaded builds a hard memory-limit failure in another thread can terminate the process mid-write.
What an attacker needs
The PHP advisory says impact requires three things: attacker influence over session data, an interruption at a useful point, and an application with a suitable deserialization gadget chain. Whether authentication is needed depends on the application. The CVE record says the same about the gadget chain. Our reading, not stated by the CNA: the AT:P (attack requirements present) metric probably reflects the timing and gadget-chain conditions.
depthfirst reports that timing is the hard part and that it needed calibration over HTTP, using three requests per attempt: a carrier, a replacement and a consumer. It reports a hit on attempt 11 for Variant A and within 10 attempts for Variant B after one coarse rebase, and a simulated 24-attempt hit rate that its adaptive controller raised from 52.8% to 88.4%. These are depthfirst’s own measurements and we have not reproduced them.
depthfirst also says it combined the primitive with a memory-corruption bug in a PHP-native class to reach remote code execution without any application gadget class, and that it withheld the decoder and heap-layout details during coordinated disclosure. That conflicts in emphasis with the CVE and advisory text, which require an application gadget chain. We treat the native-class chain as an unverified vendor claim.
Who is exposed
Wiz states that phpAfterShell needs file-based sessions and an exploitable gadget chain in the application code. depthfirst says applications that store sessions in Redis, a database or another non-file handler are not affected by this specific defect, and the CVE record names the files session save handler. That covers this CVE only; Wiz lists other November 19 fixes, such as a session serializer mismatch on shared session stores, CVE-2026-115560, that are separate issues. The PHP advisory (the php-src GitHub advisory) also suggests a store that replaces records atomically. PHP 8.1 and earlier, including the 7.4, 8.0 and 8.1 end-of-life mitigation branches, have no official fix. depthfirst says those mitigation branches disable the upload-progress callback and are not affected by the variants it describes, but our inference is that you should not read that as full immunity, given the advisory’s note that the code dates to PHP 4.1.0.
The AI-assisted discovery angle
depthfirst’s summary says the bug was “discovered by depthfirst’s frontier AI models working with depthfirst researchers” and that it was reported privately in late October. The CVE record credits two named reporters, Leo Lin and Asahi, and the GitHub advisory lists a reporter account name. We cannot reconcile these credits from public sources, so the role of AI models in the discovery rests on depthfirst’s statement alone.
Exploitation status
Wiz (November 19) reports no exploitation observed by Wiz or mentioned in public reporting; depthfirst and the GitHub advisory do not address it. The CISA coordinator SSVC entry on the CVE record (snapshot November 20) lists exploitation as “none”, automatable as “yes” and technical impact as “total”. CVE-2026-126714 had no entry in KEV catalog version 2026.11.23 when we checked on November 24. We found no evidence of exploitation as of November 24 in those sources and NVD; we did not search press or social media. For context, the October PHP2Shell flaws CVE-2026-109618 and CVE-2026-109619 were added to KEV on October 26 with a due date of October 29, and this CVE is not listed. depthfirst says it is withholding the native-class decoder and heap layout. Its post does describe the splice mechanics, the timing method and a proof using a harmless object. We did not find a public RCE exploit in the sources checked as of November 24 (depthfirst, the GitHub advisory, Wiz, the CVE record); we did not search GitHub or social media.
What to do now
- Upgrade to PHP 8.5.13, 8.4.28, 8.3.37 or 8.2.36 or later on the same branch, then restart workers.
- If you cannot upgrade yet: set
session.upload_progress.enabled = 0, which the advisory lists as a mitigation, and keep untrusted data out of sessions where you can. - Move sessions to a store that replaces records atomically, as the advisory suggests, if you rely on the default file handler.
- Audit gadget chains. Review which classes your application and its dependencies make available to
unserialize(), since the advisory makes a suitable chain a precondition. - Note the fix’s limit. The advisory says the fix truncates the session file to zero before writing and aborts if truncation fails, and that an interrupted write can still lose session data. The fix removes the splice, not the possibility of a lost session.
- Apply the other November 19 fixes. Wiz reports PHP shipped 17 fixes that day, seven rated Critical 9.2, including a PHP-FPM request smuggling flaw (CVE-2026-129289) and an incomplete fix for CVE-2026-109619 (CVE-2026-129481, per Wiz only). Wiz gives
fastcgi_keep_conn offorenablereuse=offas the workaround for the FPM issue.
Vendor interest
depthfirst and Wiz both sell security scanning or detection products, and depthfirst’s page ends with a prompt to check exposure with its service. Treat the discovery and severity framing accordingly; the CVE record and GitHub advisory are the neutral sources.
Why it matters
Session storage is infrastructure that most PHP applications trust without thinking about it. phpAfterShell shows how a hardening patch for one path can leave the shared mechanism underneath intact, which is why the October mitigations did not cover every vector, as Wiz notes. Admin panels and self-hosted dashboards written in PHP, including those fronting AI tooling, should be treated like any other estate asset: patch, restart and check how sessions are stored.
References
- depthfirst: phpAfterShell summary
- depthfirst research: phpAfterShell technical analysis
- PHP security advisory GHSA-fm2m-fjf5-v3cp, partially overwritten session files can lead to remote code execution
- CVE record: CVE-2026-126714
- NVD: CVE-2026-126714
- Wiz: phpAfterShell, critical PHP RCE vulnerabilities (CVE-2026-126714)
- PHP2Shell: Two Critical PHP RCE Flaws (CVE-2026-109618, CVE-2026-109619)
Frequently Asked Questions
- Which PHP versions fix CVE-2026-126714?
- According to the CVE record published by the PHP CNA on November 19, 2026, the fixed releases are 8.2.36, 8.3.37, 8.4.28 and 8.5.13. Earlier releases on those branches are listed as affected. Wiz reports that PHP 8.1 and earlier are end of life with no official fix.
- Is CVE-2026-126714 exploited in the wild?
- We found no evidence of exploitation as of November 24, 2026 in the sources we checked: Wiz (November 19) reports none observed, the CISA coordinator SSVC entry (snapshot November 20) lists exploitation as none, and KEV catalog version 2026.11.23 has no entry. We did not search press or social media. Recheck KEV, because that feed changes daily.
- Does an attacker need an application gadget chain?
- The CVE record and the PHP GitHub advisory both say impact depends on a suitable deserialization gadget chain in the application. depthfirst says it chained the primitive with a memory-corruption bug in a PHP-native class to reach code execution without an application gadget class, and has withheld the details. We have not verified that claim.
- Can I mitigate without upgrading?
- Partly. The PHP advisory lists disabling session.upload_progress.enabled, limiting untrusted data stored in sessions and using a session store that replaces records atomically. It also says the affected code is not limited to the upload-progress feature, so these reduce exposure and are not a full fix.