Security alerts · November 19, 2026

Critical PHP session flaw could let attackers run code on web servers

On November 19, 2026, PHP fixed phpAfterShell (CVE-2026-126714), a flaw in its default file-based session storage that can lead to code execution under certain conditions. No attacks have been reported. Update to 8.2.36, 8.3.37, 8.4.28 or 8.5.13.

What happened

On November 19, 2026, the PHP developers published a security advisory for a critical flaw, CVE-2026-126714. The flaw is called phpAfterShell. Security company Depthfirst says its researchers found it and reported it to the developers. The bug sits in the way PHP stores sessions as files on disk, which is PHP’s default setting.

A session is where a website remembers things about a visitor between clicks, such as whether they are logged in or what is in their cart. If a session write is cut off at the wrong moment, the file can end up holding a mix of new and old data. An attacker who can influence what goes into the session could use this to slip their own data into the application and, under further conditions, run code on the server.

Note that the PHP releases of October 21, 2026, which fixed the flaws known as PHP2Shell, do not include this fix. A server updated in October stays vulnerable until you install the November releases.

According to The Hacker News, neither the PHP developers nor Depthfirst report any attacks using phpAfterShell. The flaw is not in the CISA KEV catalog, and the EU vulnerability database EUVD (entry EUVD-2026-130158) does not list it as exploited either.

Why it is dangerous

This is a race condition in file handling (CWE-367). When PHP updates a session, it writes the new data into the existing file without emptying it first. Picture someone writing new text over old text on a whiteboard without wiping it, and getting interrupted halfway. The tail of the old text stays put, and the whole thing can suddenly mean something else.

The next time the session is opened, PHP reads the file and rebuilds the stored values, including objects (deserialization). Text that used to be harmless can turn into an object chosen by the attacker. If the application contains a suitable chain of existing code (a gadget chain), the PHP developers say this can lead to code execution with the privileges of the PHP process. The attacker could then read and change data that PHP has access to.

The PHP developers say three conditions must all be met for a successful attack:

  • The attacker can influence the session contents, for example through the upload progress feature, or because the application stores long user-supplied strings in the session.
  • The write is interrupted at a useful point, for instance by a hard memory-limit failure in another thread of a threaded PHP build.
  • The application contains a suitable code chain that turns the planted object into code execution.

According to The Hacker News, the Depthfirst researchers say their own chain did not need code from the application and used a separate bug in a built-in PHP class instead, which they have not yet detailed. They add that ordinary session values, such as who is logged in, can be swapped too.

The attack works over the network and, per the rating, needs no login or user interaction. In practice, whether an account is needed depends on the application. The PHP developers scored the flaw 9.2 out of 10 on CVSS 4.0, which is critical. CVSS measures severity, not real-world attacks. Those are tracked by the CISA KEV catalog, which does not list this flaw.

Who is affected

The following PHP versions are affected:

  • all versions before 8.2.36
  • the 8.3 branch before 8.3.37
  • the 8.4 branch before 8.4.28
  • the 8.5 branch before 8.5.13
  • unpatched builds of PHP 8.1 and older (Depthfirst says the official end-of-life security branches for 7.4, 8.0 and 8.1 are not affected)

The PHP developers say the faulty code has been in PHP since version 4.1.0. The flaw affects any server that stores sessions as files (session.save_handler = files), which is the default. Typical examples are web hosting, company websites, online shops, intranets and PHP-based content management systems.

If your sessions live in Redis, a database or another store, this specific defect does not affect you. The PHP developers still recommend checking separately how that store handles an interrupted update.

Ubuntu has released fixed packages for 16.04 (php7.0) and 18.04 (php7.2) through Ubuntu Pro. For other releases, such as 22.04, 24.04 and 26.04, the status on publication day was “Needs evaluation”.

How to check if you are affected

On shared hosting, you will find the PHP version in the control panel (for example cPanel, Plesk or DirectAdmin) under the PHP settings. WordPress shows it under Tools > Site Health > Info, in the Server section. On your own server, check the version like this:

php -v

The command-line version can differ from the one serving your website. These commands show the running PHP-FPM master processes and the version of each installed PHP-FPM binary:

ps -eo pid,args | grep '[p]hp-fpm: master'
for f in /usr/sbin/php-fpm*; do echo "$f"; "$f" -v | head -n 1; done

The first command shows whether sessions are stored as files and whether upload progress is enabled, but only for the command line. The second finds these settings in the PHP and PHP-FPM configuration that applies to your website. Lines starting with a semicolon are just comments.

php -i | grep -E 'session.save_handler|session.upload_progress.enabled'
grep -rnE 'session\.(save_handler|upload_progress\.enabled)' /etc/php /etc/php.ini /etc/php.d /etc/php-fpm.d 2>/dev/null

Depthfirst warns that Linux distributions may ship the fix without changing the version number. So also check the changelog of the installed package. The first command is for Debian and Ubuntu, the second for RHEL, AlmaLinux and Rocky Linux. If they print nothing, the package probably lacks the fix, or the distribution does not list it under this CVE.

zgrep -l CVE-2026-126714 /usr/share/doc/php*/changelog.Debian.gz
rpm -q --changelog php-common | grep CVE-2026-126714

How to fix it

The fixed versions are 8.2.36, 8.3.37, 8.4.28 and 8.5.13. The new PHP 8.6.0 also includes the fix. Depthfirst recommends these steps:

  • Install the fixed release for your branch. On shared hosting, switch the version in the control panel or contact your provider. On your own server, use your distribution’s package updates.
  • If you run PHP 8.1 or older, move to a supported branch.
  • Rebuild container images (Docker, for example) and redeploy them.
  • Restart the PHP workers and confirm that the new version is serving your website.

If you cannot update right away and your application does not use upload progress, set session.upload_progress.enabled = 0 in php.ini or in your hosting PHP settings, then restart the PHP workers. Also limit the untrusted data your application stores in sessions. The PHP developers stress this is not a full fix: applications that put attacker-controlled data into sessions in other ways remain vulnerable. If you already turned this setting off in October because of PHP2Shell, you still need the update.

Moving sessions to a store that replaces records in one step also avoids this defect. For sites using the default file storage, the PHP developers still recommend the update.

According to a comparison by The Hacker News, the new releases switch upload progress off by default. If php.ini, a distribution package or a hosting panel turns it on, it stays on. Where nothing else turns it on, applications that rely on upload progress will need it switched back on after the update.

Start with internet-facing servers, especially those with public forms and logins, and handle internal applications afterwards.

What if you may already be compromised

Neither the PHP developers’ advisory nor The Hacker News lists indicators of compromise, and no attacks have been reported. Still, if a server ran a vulnerable version and is reachable from the internet, a basic check is worthwhile:

  • Look through system and PHP logs for repeated PHP worker crashes and out-of-memory errors, especially alongside unusual file upload requests.
  • Check for new or modified PHP files in the web directory that you did not upload, for example with find /var/www -name '*.php' -mtime -30.
  • Review admin accounts in your application and any unexpected permission changes. According to Depthfirst, the flaw can also be used to swap who is logged in.
  • Look for unknown processes, scheduled tasks (cron) and outbound connections from the server.

If you find anything suspicious, disconnect the server from the internet, do not delete anything and bring in an incident response specialist. After cleanup, change the passwords and keys the application could access, such as database or API credentials.

Sources

Articles are put together by an AI agent from public sources (vendors, CISA, ENISA, NVD, SK-CERT, NÚKIB), and version numbers and CVEs are checked against them automatically. Always confirm the steps in the vendor advisory before touching production.

← All alerts · RSS

Need help patching or checking your systems?

I can help you find out which systems are affected, update them safely and check whether an attacker already got in. Let us start with an initial consultation, which is deducted from the project price if we work together.