Skip to main content
Published on November 25, 2026
CVE-2026-126714 “phpAfterShell” — PHP sessions, CVSS v4.0 9.2. A partially rewritten PHP session file can lead to remote code execution. The affected session handler, files, is PHP’s default. Fixed in PHP 8.5.13, 8.4.28, 8.3.37 and 8.2.36, released on November 19, 2026. Update PHP, or turn off session.upload_progress until the package lands.

The bug in two sentences

The files session handler writes new session data over the existing file without clearing it first. If the write is interrupted, the file holds the start of the new session followed by the end of the old one: on the next session_start(), PHP unserializes that mix, and bytes from a plain string can turn into objects. According to the PHP advisory, the attack needs three things:
  • the attacker can influence session contents, for example through file upload progress tracking (session.upload_progress) or through long strings the application stores in the session;
  • they can interrupt the write at the right moment, for example with a memory exhaustion that kills the process;
  • a deserialization gadget chain is available.
The depthfirst researchers who found the flaw say their full chain does not depend on any application class: it relies on PHP’s native classes and a memory corruption. According to them, a multipart/form-data request that reaches PHP with upload progress enabled is enough as an entry point. They published a demonstration video, with no exploit code. The payoff for the attacker: code execution with the PHP worker’s privileges. The flaw can also corrupt session data. Affected versions:
  • PHP before 8.2.36;
  • PHP 8.3.0 through 8.3.36, fixed in 8.3.37;
  • PHP 8.4.0 through 8.4.27, fixed in 8.4.28;
  • PHP 8.5.0 through 8.5.12, fixed in 8.5.13.
The PHP team says the faulty code goes back to PHP 4.1.0. The fix empties the session file before writing to it: an interrupted write can still lose the session, but no longer leaves part of the old one behind. The PHP project scores the flaw 9.2 in CVSS 4.0 (AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N); NVD carries the same score. Red Hat rates it “Critical” with 8.1 in CVSS 3.1, Ubuntu medium priority. The full advisory is GHSA-fm2m-fjf5-v3cp.
According to CISA’s assessment, carried by NVD, no exploitation has been reported, but the attack is rated as automatable. The same PHP release fixes PHP-FPM (CVE-2026-129289) and PHP-FPM (CVE-2026-129291): one update covers all three.

Sizing your exposure

The question to ask: are your PHP sessions stored in files? That is the default, whichever way PHP runs (PHP-FPM, mod_php, CGI). Check the session handler and upload progress in the loaded configuration:
A PHP-FPM pool or an Apache virtual host can override these values. Look for overrides:
session.save_handler => files means file sessions. session.upload_progress.enabled => On means the entry point described by the researchers is open.
The application can also pick its session store in its own code or configuration. If you are not sure which store is in use, treat it as file sessions and update.

Updating PHP, distro by distro

The real fix is a PHP package update followed by a restart of PHP-FPM and Apache: processes already running keep the old code. Take a snapshot of your VPS first.

Debian

Ubuntu

Don’t rely on the version printed by php -v alone. Debian and Ubuntu backport the fix: Ubuntu 24.04 still reports PHP 8.3.6 once patched. Only the full package version, compared with your distribution’s advisory, is the reference.

RHEL and AlmaLinux

Red Hat lists RHEL 7, 8, 9 and 10 as affected. As of November 24, 2026, its bulletin RHSB-2026-020 says fixes are being expedited, with no erratum released yet: follow the Red Hat CVE page. For AlmaLinux, watch errata.almalinux.org.
According to Red Hat, its updated packages for PHP 8.2 and later turn upload progress off by default. A setting explicitly enabled in your configuration still takes precedence. Until the package lands, apply the mitigation below.

Containers

Red Hat recommends rebuilding images based on RHEL or UBI as soon as their base image is updated. The same goes for any image that ships PHP: rebuild it on a fixed version, then redeploy.

Turning off session.upload_progress until you can update

The PHP team and Red Hat recommend turning off file upload progress tracking until the fixed package is installed. The setting must apply before the request is parsed: an ini_set() in the application comes too late. Put it in a conf.d file loaded at startup, then restart every PHP process.
To enforce it in a specific PHP-FPM pool, add this to its configuration (for example /etc/php/8.3/fpm/pool.d/www.conf):
This mitigation closes the file upload entry point. It does not protect an application that itself stores attacker-supplied data in the session: limit that data and update. A session store that replaces each record in one go is not hit by this write defect.

Checking the mitigation

If you applied the mitigation, the expected value is session.upload_progress.enabled => Off. Red Hat reminds you to check every PHP-FPM pool, every virtual host and every application-level override: changing only the command-line PHP configuration is not enough.

Re-enabling upload progress after the update

The PHP advisory describes this as a temporary measure. Once PHP is fixed and restarted, you can bring upload progress back if an application uses it to show how far an upload has gone:
According to Red Hat, the setting also protects against CVE-2026-115560, and it covers php2shell (CVE-2026-109619) too. If no application uses upload progress, there is no need to turn it back on.

What next?

Turning off session.upload_progress is only a stopgap: the target remains your distribution’s fixed PHP package. The same update also fixes the PHP-FPM flaw CVE-2026-129289. Turn on automatic security updates to get the next fixes without waiting. For any technical question, open a ticket from your OnetSolutions customer area.