BuzzPHP

CVE-2026-126714 (phpAfterShell): PHP Session Fix

CVE-2026-126714: an interrupted PHP session write can corrupt a session file and lead to code execution. Fixed versions, runtime checks, vendor backports.

SecurityBy BuzzPHPPublished

On this page

CVE-2026-126714 is a critical PHP vulnerability, tracked upstream as GHSA-fm2m-fjf5-v3cp and titled "Partially overwritten session files can lead to remote code execution". It is fixed in PHP 8.2.36, 8.3.37, 8.4.28, 8.5.13 and 8.6.0, all released on November 19, 2026. Community write-ups call it "phpAfterShell"; that is not a name php.net uses, so this guide leads with the CVE. Install the fixed release for your branch and restart the process that serves your web requests.

Which versions fix CVE-2026-126714?

php.net's ChangeLog lists the fix under the Session component of each of these releases:

Your PHP branch Fixed in Released
8.6 8.6.0 (includes the fix from the first stable release) Nov 19, 2026
8.5 8.5.13 Nov 19, 2026
8.4 8.4.28 Nov 19, 2026
8.3 8.3.37 Nov 19, 2026
8.2 8.2.36 Nov 19, 2026

Earlier releases of each branch are affected, including 8.5.12, 8.4.27, 8.3.36 and 8.2.35, the October PHP2Shell fixes. The PHP 8.5.13 announcement and its siblings call these security releases and urge all users of those branches to upgrade. PHP 8.1 and older have no upstream fix in the 8.x ChangeLog. Do not read that as "not affected": Ubuntu's tracker page lists vendor fixes for its PHP 8.1 and older packages, so assume an unsupported branch needs a vendor fix or an upgrade.

What is affected, and how the bug works

The fix commit is in ext/session/mod_files.c, the code behind session.save_handler=files, which the PHP manual gives as the default. Its message explains the mechanism: if a session write is interrupted and the previous session file was not truncated, the file can end up with two partial sessions concatenated. It adds that the location of the failure may be attacker-controllable in threaded environments, where another thread causes the process to exit.

Ubuntu's description adds the consequence. The corrupted file can hold the start of the new session followed by the end of the old one, so bytes of an ordinary string may later be unserialized as objects. An attacker who can influence session data, for example through session upload progress, and interrupt a write at the right point could inject objects. That leads to code execution only if the application contains a suitable gadget chain. Ubuntu also says the issue is not limited to upload progress.

Two practical consequences follow:

  • You are in scope if your application uses PHP sessions stored by the files handler. If session.save_handler is set to something else, such as an extension handler for Redis or Memcached, the vulnerable code is not the one storing your sessions.
  • Ubuntu records CVSS v4.0 base score 9.2, Critical, with a network attack vector, low complexity and no privileges required, while setting its own distribution priority to Medium. The two numbers answer different questions, so treat the CVSS value as the severity of the flaw and the vendor priority as a statement about its package.

The details above come from the php-src fix commit, php.net's ChangeLog and the Ubuntu tracker. The advisory is the authority for anything beyond that.

Other CVEs fixed in the same releases

The same ChangeLog entries list two more session fixes alongside it. CVE-2026-115560 (GHSA-658j-r8rw-q6mx, "Session serializer mismatch can lead to remote code execution") is fixed in all five releases above. For it, session.upload_progress.enabled now defaults to Off, and while it is On, changing a session.* setting at runtime throws an Error. CVE-2026-129481 (GHSA-g3vh-838c-65v7, a use-after-free after an interrupted session shutdown) is listed for 8.3.37, 8.4.28, 8.5.13 and 8.6.0, not for 8.2.36.

These releases carry many other fixes, including PHP-FPM, PHAR, SOAP and timezone issues. Applying the full release covers them; there is no reason to cherry-pick. If you turned session.upload_progress.enabled on deliberately, check it after the upgrade, because the default changed.

How is this different from PHP2Shell?

Our PHP2Shell guide covers CVE-2026-109618 and CVE-2026-109619, the October runtime memory-safety vulnerabilities fixed in 8.2.35, 8.3.36, 8.4.27 and 8.5.12. They are different bugs with different fixes:

PHP2Shell (October) CVE-2026-126714 (November)
Where Request initialization and cleanup in the runtime The session files save handler
Fixed in 8.2.35, 8.3.36, 8.4.27, 8.5.12 8.2.36, 8.3.37, 8.4.28, 8.5.13, 8.6.0
Patched in October? Yes No, you need the newer release

Having patched for PHP2Shell does not cover this one. Move to the November releases, which also contain the earlier fixes.

How do I check what my web runtime actually runs?

php -v reports the command-line binary, which may not be what serves your site. Check each layer:

# CLI binary
php -v

# the FPM binary (the name varies: php-fpm, php-fpm8.4, php8.4-fpm ...)
php-fpm -v

# Apache with mod_php
apachectl -M | grep -i php

Then ask the running web process. Add a temporary script on an internal-only path, or use your existing authenticated diagnostics, that prints:

echo PHP_VERSION, ' ', PHP_SAPI, ' ', ini_get('session.save_handler');

PHP_VERSION and PHP_SAPI describe the executing interpreter, and ini_get() shows the handler in effect for that pool or virtual host. A public phpinfo() page shows more than you want to expose, so remove any diagnostic once you have the answer. Do this per site, per FPM pool and per server.

For containers, pin an exact tag from the official php image such as 8.5.13-fpm or 8.4.28-fpm, which exist on Docker Hub. A moving tag like 8.5-fpm only changes when you pull and recreate the container:

docker compose pull php
docker compose up -d --force-recreate php
docker compose exec php php-fpm -v

Adapt the service name. A running container keeps its old image until it is replaced.

Distribution packages and backports

Linux distributions often fix a CVE without changing the upstream version number, so an "old" php -v can be patched and a "new" one can be a third-party build without the fix. Compare the full package revision with your vendor's page for CVE-2026-126714. For Ubuntu, the tracker and USN-9185-1 list for example 8.3.6-0ubuntu0.24.04.14 for Ubuntu 24.04 (php8.3), 8.1.2-1ubuntu2.29 for 22.04 (php8.1) and 8.5.4-0ubuntu1.6 for 26.04 (php8.5), plus Ubuntu Pro fixes for older packages. Managed hosts and third-party repositories need their own confirmation. Ask which package revision serves your site and whether old workers were restarted.

Is there a workaround?

We found no configuration workaround for CVE-2026-126714 in the sources we could open: php.net's release notes, the fix commit and the Ubuntu tracker. We are not offering an untested one, so install the fixed release. Our legacy PHP mitigation guide covers the PHP2Shell issues only, not this one.

PHP 8.2 gets its last security fix on December 31, 2026; see the PHP 8.2 end of life guide, and our PHP 8.6 upgrade checklist when you plan the next move. Reviewed on December 6, 2026 against php.net and Ubuntu's published notices.

FAQ

Is phpAfterShell an official name?

No. php.net and the PHP maintainers refer to the issue as CVE-2026-126714 (GHSA-fm2m-fjf5-v3cp). phpAfterShell is a name used in community write-ups, so search for the CVE identifier when checking vendor notices.

Does this affect me if I store sessions in Redis or a database?

The fix is in PHP's files session save handler, which is the default. Ubuntu's description of the issue says it affects that handler. If your application sets a different save handler, the vulnerable code path is not the one storing your sessions, but you should still install the update because the same releases fix other issues.

Can I fix this by patching only my application or Composer packages?

No. The bug is in the PHP runtime. Update the PHP installation or container image that serves your requests and restart the workers.

Do I need PHP 8.6 to be protected?

No. Each supported branch received a fix: 8.2.36, 8.3.37, 8.4.28 and 8.5.13, and PHP 8.6.0 includes it from the start. Stay on your branch and patch it.

My distribution shows an older PHP version number. Am I still vulnerable?

Not necessarily. Distributions backport fixes and keep the old upstream version. Check the vendor's security page for CVE-2026-126714 and compare the full package revision.

Related guides