Skip to content
Speedchilli
Critical· 9.2No known exploitation

phpAfterShell: remote code execution through PHP session files

CVE-2026-126714 · Updated

PHP's default file-based session handler overwrites session files in place without clearing them first. If an attacker can put data into a session and interrupt the write, the file is left holding new data followed by old leftover bytes, which PHP can read back as attacker-chosen objects. That can lead to remote code execution. It reuses the same upload-progress entry point as PHP2Shell, so servers patched for PHP2Shell in October are still affected.

Latest update · 19 November 2026

PHP releases fixes

PHP 8.2.36, 8.3.37, 8.4.28, 8.5.13 and 8.6.0 released with advisory GHSA-fm2m-fjf5-v3cp. depthfirst published its research the same day. Cloudflare extended its managed WAF rule to cover this CVE.

Product
PHP 8.2 – 8.5 (and unpatched older releases)
Exploitation
No exploitation in the wild reported as of 23 November 2026.
First published
23 November 2026
Last updated
19 November 2026

CVE-2026-126714

CWE-367, CWE-662

Partially overwritten session files can lead to remote code execution

  • CVSS 4.0: 9.2(PHP)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

What to do

  1. Upgrade PHP

    Move to PHP 8.5.13, 8.4.28, 8.3.37, 8.2.36 or 8.6.0, or your distribution's fixed package. These releases also fix the PHP2Shell flaws and the other critical issues listed below. Restart PHP-FPM or Apache so every worker runs the new version.

  2. If you cannot upgrade yet, turn off session upload progress

    Set this in php.ini or the PHP-FPM pool, not with ini_set() or .user.ini, then restart all workers. This closes the main unauthenticated route but not every route.

    ; php.ini
    session.upload_progress.enabled = 0
    
    ; or in the PHP-FPM pool config
    php_admin_flag[session.upload_progress.enabled] = off
  3. Reduce what can reach the session

    Avoid storing large untrusted values in sessions. A session store that replaces records atomically (such as Redis) avoids this particular bug.

  4. Use WAF protection as an extra layer

    Cloudflare's managed rule “PHP Remote Code Execution Attack” covers this CVE and the PHP2Shell CVEs, and blocks by default. A WAF cannot see the deserialisation step itself, so it is not a substitute for upgrading.

Who is affected

  • Sessions are stored with the default file handler (session.save_handler = files). Redis, database and other session stores are not affected by this specific bug.
  • The attacker can influence data written to a session. Session upload progress (session.upload_progress.enabled, on by default before these releases) makes this possible with a single unauthenticated multipart request. An application that stores large user-supplied strings in the session is another route.
  • The write is interrupted, for example by the process being killed for running out of memory.
  • Turning the deserialised data into code execution needs a usable object chain. PHP says this must come from the application. The researchers (depthfirst) say they did it with a second, undisclosed bug in a built-in PHP class instead.

Affected versions

  • PHP 8.5

    Affected: Before 8.5.13

    Fixed in: 8.5.13

  • PHP 8.4

    Affected: Before 8.4.28

    Fixed in: 8.4.28

  • PHP 8.3

    Affected: Before 8.3.37

    Fixed in: 8.3.37

  • PHP 8.2

    Affected: Before 8.2.36

    Fixed in: 8.2.36

  • PHP 8.6

    Affected: Release candidates

    Fixed in: 8.6.0 (first release)

  • PHP 8.1 and older

    Affected: Unpatched builds

    Fixed in: No official release. Use a distro/LTS vendor build or upgrade

PHP 8.1 and older are end of life. According to depthfirst, builds that already include PHP's official PHP2Shell mitigation branches for 7.4, 8.0 and 8.1 are not affected, because those branches stop the upload-progress path early. Debian published fixed packages on 19 November (8.2.36-1~deb12u1 for Debian 12, 8.4.28-1~deb13u1 for Debian 13). Check your distribution's tracker for others.

Exploitation

  • No exploitation in the wild has been reported by PHP, the researchers or security vendors as of 23 November 2026. It is not in CISA KEV.
  • depthfirst published a harmless proof (creating a plain stdClass object) and a video of the full chain. It is withholding the code-execution details.
  • Exploitation needs several conditions, repeated attempts and precise timing, but the October PHP2Shell flaws were exploited within days of disclosure, so treat this as urgent.

How to check

Which PHP version serves your website?

Check the binary that serves web requests (PHP-FPM or Apache mod_php), not just the command-line PHP, because they can differ. The FPM binary name varies by distro (php-fpm8.3, php-fpm83 and so on).

php-fpm -v           # or php-fpm8.3 -v, etc.
php -v               # CLI only. May differ from FPM

Session handler and upload progress settings

This reads the CLI config. Confirm the same values in your FPM pool and any vhost overrides, or temporarily check phpinfo() on a protected page.

php -i | grep -E '^session\.(save_handler|upload_progress\.enabled)'

Container images

Check the PHP version inside each image you deploy.

docker run --rm --entrypoint php <image> -v

The same releases fixed further issues. These six are the ones Cloudflare rated critical. Upgrading fixes all of them.

  • CVE-2026-129289PHP-FPM request smuggling through an unread HTTP request body.
  • CVE-2026-115560Session serializer mismatch can lead to remote code execution.
  • CVE-2026-129496Timezone cache use-after-free can lead to remote code execution.
  • CVE-2026-129481Use-after-free after interrupted session shutdown. Cloudflare describes it as an incomplete fix for PHP2Shell’s CVE-2026-109619.
  • CVE-2026-129474Use-after-free in magic method backtraces can lead to remote code execution (PHP 8.5+).
  • CVE-2026-129182Use-after-free via repopulation of the last fatal error backtrace after shutdown (PHP 8.5+).

Updates

  1. PHP releases fixes

    PHP 8.2.36, 8.3.37, 8.4.28, 8.5.13 and 8.6.0 released with advisory GHSA-fm2m-fjf5-v3cp. depthfirst published its research the same day. Cloudflare extended its managed WAF rule to cover this CVE.

Notes on sources

  • Sources disagree on PHP 8.1 and older. Cycode says every 8.1-and-older release is affected with no fix planned. depthfirst, Field Effect and Astra say builds with PHP's official EOL mitigation branches are not affected. PHP's own advisory lists no versions below 8.2.
  • Sources count the issues fixed in this release differently (17 or 18 in total).

References

Need a hand with this?

Our engineers can check your exposure, apply fixes through your change process and confirm the result.