CVE explainer

phpAfterShell (CVE-2026-126714): the session bug the October patches missed

Short answer

phpAfterShell (CVE-2026-126714) is a critical flaw in PHP’s default files session handler: an interrupted write can leave a session file that decodes into attacker-chosen objects. The October PHP2Shell releases don’t fix it. Update to 8.5.13, 8.4.28, 8.3.37 or 8.2.36 and restart PHP.

On this page

What is phpAfterShell?

By default PHP keeps each visitor’s session in a small file on disk (session.save_handler = files). When a request changes the session, PHP writes the new data back into that file. The write isn’t atomic. If the PHP worker dies halfway through, for example because it hit memory_limit or a timeout, the file can end up holding the start of the new session followed by leftover bytes from the old one.

On the next request PHP reads that stitched-together file and decodes it. If an attacker controlled part of what was being written, the result can decode into PHP objects of their choosing. With a suitable gadget chain in the application or its libraries, that becomes code execution as the PHP worker user.

That’s CVE-2026-126714. PHP’s own advisory calls it “Partially overwritten session files can lead to remote code execution” and rates it critical (CVSS 4.0 9.2). The researchers at depthfirst who described the technique named it phpAfterShell. PHP says the affected code has been there since PHP 4.1.0.

It was fixed on 19 November 2026 in PHP 8.5.13, 8.4.28, 8.3.37 and 8.2.36. It’s one of 17 security advisories PHP published that day; the full release breakdown covers the rest.

Why didn’t the PHP2Shell patches fix it?

Because it’s a different bug. The October releases (8.5.12, 8.4.27, 8.3.36, 8.2.35) fixed PHP2Shell, CVE-2026-109618 and CVE-2026-109619. phpAfterShell lives in the session file handler’s write routine, which those releases didn’t change. The October stopgaps don’t fully cover it either (more on that below).

So if you patched PHP2Shell in October, you’re not done. Every server needs the November release too.

Am I exposed?

Four things have to line up. The last three are the preconditions in PHP’s advisory:

  1. The built-in files session handler. It’s the default, so most PHP sites use it. Sessions in Redis, Memcached or a database aren’t hit by this particular file-write defect.
  2. Attacker influence over data stored in the session. Session upload progress is the easiest route, because it copies client-supplied upload details into the session. It isn’t the only one. watchTowr and Ostorlab reported that any large, attacker-influenced string stored in a session gives the same opening, such as a search term, a form draft or a basket note saved to $_SESSION.
  3. A write interrupted at a useful moment. Memory exhaustion and timeouts are the usual ways a worker dies mid-write.
  4. A gadget chain. Some class in the code PHP has loaded must do something useful when it’s rebuilt from session data. Analyses disagree on how hard this is. Ostorlab reported that a chain built only from PHP’s own classes also works, and that depthfirst held that part back from its public demonstration. Don’t count on this condition to protect you.

For WordPress, core doesn’t use PHP sessions, but some plugins do. Joomla stores sessions in the database by default, mySites.guru pointed out. Our WordPress and the November flaws page goes through what to check.

Fixed versions

Branch Vulnerable Fixed in
8.5 8.5.0 to 8.5.12 8.5.13
8.4 8.4.0 to 8.4.27 8.4.28
8.3 8.3.0 to 8.3.36 8.3.37
8.2 up to 8.2.35 8.2.36
8.6 pre-releases 8.6.0 (released the same day)
8.1 and older all no upstream release

Distributions backport the fix into the version they already ship, so their numbers look older. These builds were listed as fixed on 19 to 21 November:

Platform Package First fixed build
Ubuntu 26.10 php8.5 8.5.9-0ubuntu2.2
Ubuntu 26.04 LTS php8.5 8.5.4-0ubuntu1.6
Ubuntu 24.04 LTS php8.3 8.3.6-0ubuntu0.24.04.14
Ubuntu 22.04 LTS php8.1 8.1.2-1ubuntu2.29
Ubuntu 20.04 (Ubuntu Pro) php7.4 7.4.3-4ubuntu2.29+esm6
Debian 13 (trixie) php8.4 8.4.28-1~deb13u1 (DSA-6641-1)
Debian 12 (bookworm) php8.2 8.2.36-1~deb12u1
cPanel EasyApache 4 (25.98) ea-php82 to ea-php85 8.2.36, 8.3.37, 8.4.28, 8.5.13

cPanel also shipped a backport for ea-php74 in the same EasyApache release. Red Hat lists RHEL 7, 8, 9 and 10 as affected and said fixes were being expedited; no fixed packages had been published when its bulletin went out on 19 November. Follow the RHEL, AlmaLinux and Rocky guide for how to check.

To confirm a distro package carries the fix, look for the CVE ID in its changelog:

# Debian / Ubuntu (adjust the version in the path)
zgrep CVE-2026-126714 /usr/share/doc/php8.3-common/changelog.Debian.gz

# RHEL family
rpm -q --changelog php-common | grep CVE-2026-126714

How to check your server

Check the PHP that serves your website, not just the one in your terminal. They often read different ini files. Here’s how to find the right one.

# PHP-FPM: version and the session settings it starts with
php-fpm8.3 -v
php-fpm8.3 -i | grep -E '^session\.(save_handler|upload_progress\.enabled|serialize_handler) '

# Explicit settings in php.ini, conf.d and FPM pool files
grep -rn -E 'session\.(save_handler|upload_progress\.enabled)' /etc/php/

Adjust the version and paths for your system (RHEL uses /etc/php.ini and /etc/php-fpm.d/). A pool-level php_admin_value doesn’t show up in php-fpm -i; to see the final values, use a temporary phpinfo() page and delete it straight afterwards. In a container, run the same commands with docker exec.

Or paste your version into the checker on our home page. It tells you whether the number includes the November fixes.

If you can’t upgrade today

Each of these narrows the opening. None of them closes it. PHP’s advisory treats upgrading as the fix and these as temporary.

1. Turn off session upload progress. Few sites use it, and it’s the easiest way to get attacker data into a session:

; php.ini used by the web runtime
session.upload_progress.enabled = 0

Or per FPM pool, where applications can’t switch it back on:

php_admin_flag[session.upload_progress.enabled] = off

Two caveats. watchTowr reported that this doesn’t fully protect against CVE-2026-126714, because other session data can be used. And the fixed releases reportedly turn upload progress off by default, but an explicit session.upload_progress.enabled = 1 anywhere in your config still wins. Grep for it.

2. Keep raw request input out of sessions. Don’t store large, user-supplied strings in $_SESSION. Cap the length of anything you do store.

3. Move sessions off disk. Redis or a database handler sidesteps this file-write bug. It’s a bigger change than it sounds: test logins and session locking, and check how your chosen backend replaces records, as Ostorlab pointed out that each backend has its own atomicity questions.

4. Restart PHP-FPM or Apache after any of these. Old workers keep the old settings.

None of the vendor write-ups we read on 20 and 21 November offered a WAF rule for this specific bug.

Signs to look for

As of 20 November no attacks using phpAfterShell had been reported, and it wasn’t on CISA’s Known Exploited Vulnerabilities list. Reports differ on whether working exploit code is public. These checks come from Ostorlab’s analysis and are leads, not proof:

  • Decode errors. Messages such as “Failed to decode session object” in your PHP or application log, especially repeated for the same session IDs.
  • Odd session behaviour. Users logged out at random, or seeing state that isn’t theirs.
  • Objects in session files your app doesn’t store. Confirm session.save_path first, then look for serialized objects:
sudo grep -l -E '\|(O|C):' /var/lib/php/sessions/* 2>/dev/null | head

Many applications store objects in sessions legitimately, so compare with what a normal session looks like on your site.

  • Workers killed during uploads. Out-of-memory kills of PHP-FPM children are one way a write gets interrupted:
sudo journalctl -k --since "2026-11-01" | grep -iE 'out of memory|killed process' | grep -i php
  • Upload progress requests. Multipart POSTs carrying the PHP_SESSION_UPLOAD_PROGRESS field. Real upload progress bars produce these too.

If anything looks wrong, work through the compromise checklist.

Does Redis session storage protect me?

From this bug, largely yes: the flaw is in the files handler’s write routine. It doesn’t protect you from CVE-2026-115560, which is about two different serializers reading and writing the same store, and it does nothing for the other 16 fixes in the release. Update anyway.

Is PHP 8.1 affected?

PHP doesn’t release fixes for 8.1 and older, and its advisory only lists supported branches. Analyses disagree about end-of-life versions: some say every 8.1 and older release is affected, others that the minimal backports PHP published in October for 7.4, 8.0 and 8.1 avoid the main trigger. Given the code dates back to PHP 4.1.0, treat old PHP as exposed unless your vendor says otherwise.

Some vendors have shipped builds. Ubuntu lists fixes for php8.1 on 22.04 and, through Ubuntu Pro, php7.4 on 20.04. cPanel backported to ea-php74. Our PHP 8.1 and older page has the options, and the upgrade plan.

Is phpAfterShell the same as CVE-2026-115560?

No, although some write-ups use the name for both. CVE-2026-115560 is a serializer mismatch in session upload progress, announced on 23 October and fixed in the same November releases. Both are session bugs, both are rated critical, and turning off upload progress helps with both. Ostorlab and PHP’s advisories treat them as separate flaws.

What to do now

  1. Update every PHP version on the server to 8.5.13, 8.4.28, 8.3.37 or 8.2.36, or your distro’s fixed build. Patch guides.
  2. Restart PHP-FPM or Apache, and rebuild containers.
  3. Check the version the website reports, not the CLI.
  4. While you’re there, run through the quick checks for the other November fixes.

Rather not do it yourself? We patch and verify one server, from €79. To hear about the next PHP security release the day it ships, join the email alerts.

Shayan Abbas writes these PHP security guides from the official advisories and vendor guidance listed below, and updates them when those change. About this site

Sources

  1. GitHub php-src advisory GHSA-fm2m-fjf5-v3cp: Partially overwritten session files can lead to remote code execution
  2. php.net: PHP 8.2.36, 8.3.37, 8.4.28 and 8.5.13 released (19 Nov 2026)
  3. php.net: PHP 8 ChangeLog (8.5.13 security fixes)
  4. Ubuntu: CVE-2026-126714 status by release
  5. Debian security tracker: php8.2 / php8.4 fixed builds (DSA-6641-1)
  6. Red Hat: RHSB-2026-020: Multiple vulnerabilities in PHP
  7. cPanel: EasyApache 4 change log (25.98, 19 Nov 2026)
  8. Ostorlab: phpAfterShell: PHP session file RCE
  9. watchTowr: PHP CVE-2026-115560 / phpAfterShell FAQ
  10. mySites.guru: PHP 19 November 2026 security releases for Joomla and WordPress

Know about the next critical PHP bug first

Short, plain-English alerts when a serious PHP vulnerability or fix lands — with what to patch and how. About two emails a month.