phpAfterShell CVE-2026-126714: PHP RCE Bypasses PHP2Shell Fix

phpAfterShell (CVE-2026-126714) lets attackers run code via PHP file sessions, even after PHP2Shell patches. Update to PHP 8.5.13, 8.4.28, 8.3.37 or 8.2.36.

By Vivek • • 7 Min Read • 0 • Follow on Google News Add to Preferred Source
Phpaftershell cve 2026 126714 php rce

PHP has patched phpAfterShell (CVE-2026-126714), a critical flaw in its default file-based session handler that can lead to unauthenticated remote code execution even on servers that installed last month’s PHP2Shell fixes.

CVE-2026-126714 carries a CVSS v4.0 score of 9.2. The bug is a non-atomic file write in PHP’s session file rewriting while it tracks upload progress, and it affects PHP 8.2 through 8.5 before Thursday’s releases, including the 8.2.35, 8.3.36, 8.4.27, and 8.5.12 builds that shipped on October 21 to fix PHP2Shell.

Security firm Depthfirst found the flaw using its AI vulnerability-research platform, privately reported it to PHP in late October, and published its technical write-up after PHP shipped fixes in its pre-announced 14:00–14:30 UTC window.

As of November 19, the fix is available in PHP 8.5.13, 8.4.28, 8.3.37, and 8.2.36, and in the official Docker images, while Ubuntu, Debian, Red Hat, SUSE, and Amazon Linux have not yet shipped fixed packages.

How the phpAfterShell Flaw Works

phpAfterShell sits in session upload progress, a feature that writes the status of a file upload into $_SESSION so a page can draw a progress bar. When a multipart POST request arrives, PHP’s RFC 1867 upload-progress callback opens the visitor’s session file, adds progress data, and rewrites the whole file before the target script runs, so the attacker needs no upload form and the endpoint never has to call session_start().

PHP’s files session handler overwrites the existing file in place with two separate system calls, pwrite() and ftruncate(), which together are not atomic. If the PHP worker dies between them, the session file is left holding the start of the new data followed by the leftover tail of the old data.

PHP’s default php session serializer has no file-level length, checksum, or commit marker; length fields inside the stored data tell the decoder how to read it. A spliced file can therefore decode into session entries that neither original write contained, including attacker-influenced values and a serialized object carried in the old tail.

When a later request with the same session ID calls session_start(), PHP deserializes that object through its normal path. According to depthfirst, the forged session values can also change identity or authorization state before the application’s own checks run.

PHP tracks the bug as GHSA-fm2m-fjf5-v3cp, “Partially overwritten session files can lead to remote code execution,” listed under the Session module in the PHP 8 ChangeLog. Credit goes to depthfirst’s AI models working with its researchers; depthfirst researcher Yuhang Wu wrote the technical analysis.

Why the PHP2Shell Patch Did Not Stop phpAfterShell

PHP2Shell, the pair of critical PHP flaws tracked as CVE-2026-109618 and CVE-2026-109619, also abused the upload-progress callback. Details leaked on October 20, a day before PHP’s emergency release on Wednesday, October 21, and both flaws were later exploited in the wild.

The PHP2Shell fix restricted which classes PHP could resolve during the upload-progress callback, but it left the session file-update behaviour unchanged, depthfirst said. phpAfterShell goes after that remaining weakness instead of object activation inside the callback.

depthfirst’s version analysis, dated November 17, shows the October builds (8.2.35, 8.3.36, 8.4.27, 8.5.12) truncate the file before writing, while 8.4.28RC1, 8.5.13RC1 and 8.6.0RC4 onward truncate after writing. depthfirst says that reordering moves the interruption window but does not remove the retained-tail primitive.

The official end-of-life mitigation branches for PHP 7.4, 8.0 and 8.1 are not vulnerable, because their upload-progress callback returns without opening the session. Older unpatched 7.4, 8.0 and 8.1 builds keep the original vulnerable path, according to depthfirst.

How depthfirst Turned CVE-2026-126714 Into Code Execution

The depthfirst attack needs session.save_handler=files, upload progress enabled, a valid session ID and a way to kill the PHP worker mid-write. depthfirst’s researchers used memory-pressure and request-timing techniques and describe Apache worker and cgroup conditions in their test setup. A later request with the same session ID must then call session_start().

For the final step, depth-first chained PHPAfterShell with a memory-corruption bug in a PHP-native class, which allowed code execution inside the worker process. The researchers say the full chain does not depend on any application-specific gadget class, so frameworks such as WordPress or Laravel do not change exposure.

depthfirst has withheld the native decoder details and heap layout. Its public proof plants a harmless stdClass object in $_SESSION, and the full chain is shown only in a video. Code that runs this way has the PHP worker’s permissions, which depthfirst says is enough to read or change the data, credentials, and customer records the application handles.

Why PHP and depthfirst Describe the Risk Differently

depthfirst says phpAfterShell is reachable under default settings: file-based sessions are PHP’s default, and the PHP manual lists session.upload_progress.enabled as on by default in releases before this fix.

PHP’s November 18 notice said its critical issues require “either non-default configuration or uncommon setups.” PHP has not explained how that applies to CVE-2026-126714, and the depthfirst chain still depends on interrupting a worker at the right moment, a step that adds friction to real-world attacks.

The Other Flaws Fixed in the November 19 PHP Release

The November 19 release fixes 17 flaws with PHP advisories, seven rated critical at CVSS 9.2, plus a bundled uriparser fix (CVE-2026-48841) in 8.5.13. The criticals include CVE-2026-129289, PHP-FPM request smuggling that applies when FastCGI connection reuse is enabled, and CVE-2026-115560, a session serializer mismatch PHP first warned about on October 23.

Three more criticals follow the PHP2Shell pattern: CVE-2026-129481, a use-after-free after an interrupted session shutdown in 8.3 to 8.5, and two 8.5-only use-after-free bugs in backtrace handling, CVE-2026-129182 and CVE-2026-129474 (GHSA-8mjj-2r7p-4hg2). The seventh, CVE-2026-129496, is a timezone cache use-after-free.

The fix for CVE-2026-115560 also turns session upload progress off by default in 8.2.36, 8.3.37, 8.4.28, and 8.5.13. An explicit session.upload_progress.enabled = On in php.ini, an FPM pool or a virtual host overrides the new default and keeps the phpAfterShell attack path open.

Which PHP Versions and Distributions Have a Fix

Product / DistributionStatus as of November 19, 2026Fixed version or advisory
PHP 8.5Fixed8.5.13
PHP 8.4Fixed8.4.28
PHP 8.3Fixed8.3.37
PHP 8.2Fixed8.2.36
PHP 8.6Fixed at release8.6.0
PHP 8.1 and olderEnd of life, no fixOfficial EOL mitigation builds not affected
Official Docker PHP imagesFixedphp:8.2.36, 8.3.37, 8.4.28, 8.5.13, 8.6.0
UbuntuNeeds triageNone yet; Ondřej Surý PPA has builds for 26.04
DebianVulnerable (sid)None yet
Red Hat / SUSENot fixed / under analysisNone yet
Amazon Linux 2023Pending fixphp8.1: No Fix Planned

Distribution and Docker statuses are from Precursor Security’s live tracker as of the evening of November 19; Cyber Kendra could not access the Ubuntu and Debian trackers directly. Distribution packages often backport fixes without changing PHP_VERSION, so the vendor advisory, not the version string, decides whether a server is patched.

Is CVE-2026-126714 Being Exploited?

As of November 19, neither PHP nor depthfirst reports attacks using phpAfterShell, and CVE-2026-126714 is not in CISA’s Known Exploited Vulnerabilities catalog, which does list the two October PHP2Shell flaws. No weaponised public exploit exists; depthfirst has published only the harmless stdClass proof and a video of the full chain.

For comparison, F5 Labs recorded PHP2Shell scanning at 08:36 UTC on October 21, more than five hours before PHP published those fixes.

What PHP Admins Should Do Now

Upgrade to PHP 8.5.13, 8.4.28, 8.3.37 or 8.2.36, restart PHP-FPM or Apache so every worker loads the new binary, and rebuild container images rather than relying on floating tags. Servers patched for PHP2Shell in October must be patched again; servers on PHP 8.1 or older should move to a supported branch.

Check the version that serves web requests, not just the CLI, by loading a phpinfo() page or running php-fpm8.3 -v (adjust for the installed version). Then search for any explicit setting that re-enables the feature with grep -rn "session.upload_progress.enabled" /etc/php* /etc/httpd /etc/apache2 /etc/nginx.

Until the upgrade is done, depthfirst recommends setting session.upload_progress.enabled = 0 in php.ini or the FPM pool and restarting PHP workers; the setting is INI_PERDIR, so ini_set() in application code cannot change it. depthfirst warns that “this removes the easiest path to the flaw, not the flaw itself.”

Sites that store sessions in Redis or a database rather than PHP’s file handler are not affected by CVE-2026-126714, though CVE-2026-115560 may still apply. depthfirst also advises limiting the untrusted data an application stores in sessions.

Community Discussion

Join the conversation. Ask questions, share solutions, and help others.

0 Comments

Be the first to start the discussion!

Leave a Comment

Your email address will not be published. Required fields are marked *

We respect your privacy, your information is safe with us.

Latest Articles

View all