DEV Community

Danila Vershinin for GetPageSpeed

Posted on Originally published at getpagespeed.com AI-assisted

phpAfterShell on CentOS 7: the fix for PHP 5.4 to 8.5

On 2026-11-19 the PHP project disclosed CVE-2026-126714, named "phpAfterShell" by the security firm depthfirst. PHP's default files session handler wrote session data non-atomically. An interrupted write can leave attacker-supplied bytes in the session file, and PHP deserializes them on the next session_start().

The fix is in PHP 8.2.36, 8.3.37, 8.4.28 and 8.5.13 only. PHP 8.1 and older got no upstream release. CentOS 7 never gets those versions from its usual repositories, so this post is about getting the fix there.

I maintain these packages at GetPageSpeed. They are free to install; running them for a business needs a subscription. They are drop-in compatible with Remi packages: same package names and configuration files, so a normal upgrade swaps them in place.

Fix it

For base-name packages (php-common, php-fpm), enable the channel for your PHP version only for the transaction. This example is PHP 7.4:

yum -y install https://extras.getpagespeed.com/release-latest.rpm
yum --enablerepo=getpagespeed-extras-php74 upgrade 'php-*'
systemctl restart php-fpm
Enter fullscreen mode Exit fullscreen mode

Replace php74 with your version, php54 to php85. The restart matters: running workers keep the old code in memory until they restart.

Check that the fix landed:

rpm -q --changelog php-common | grep CVE-2026-126714
Enter fullscreen mode Exit fullscreen mode

One line of output means you have the fix. No output means you do not. Do not rely on php -v: a backported fix keeps the old version number.

Software collections (php74-php-*) and the stock CentOS 7 PHP 5.4 have their own commands, listed in the full guide linked at the bottom.

A PHP2Shell patch is not enough

If you patched PHP2Shell (CVE-2026-109618 and CVE-2026-109619) in October, you are not done. phpAfterShell is a separate flaw that the October fix did not address, and it is a different fix. A server can be fully patched for one and open to the other.

The GetPageSpeed checker reads pasted rpm, dpkg, apk or php -v output, knows distro backports, and tells a PHP2Shell-only build from one that has both fixes: https://www.getpagespeed.com/phpaftershell

If you cannot upgrade today

Set this in php.ini or the FPM pool configuration, then restart PHP:

session.upload_progress.enabled = 0
Enter fullscreen mode Exit fullscreen mode

It closes only the easiest route. Calling ini_set() from the application is too late, because the setting is read before your code runs.

Sessions stored in Redis or a database are not affected by the file-write defect. Moving them is a bigger change than the upgrade, but it removes the whole class for your application.

What is known

  • No exploitation had been reported as of 2026-11-21.
  • The PHP project says a usable gadget chain in the application is needed. depthfirst reports a chain that needs none. Plan for the worse case.

The commercial part

The packages are free to install. Personal, development and evaluation use is free. Running them for a business needs a subscription.

Besides CentOS 7, the fix is published for CentOS 6, Amazon Linux 2, the EL8 and EL9 php56, php70 and php71 collections, Ubuntu 18.04 and 20.04, and Debian 10, covering PHP 5.3 to 8.5.

Full guide, with the collection commands and a table of the first fixed build per PHP version: https://www.getpagespeed.com/server-setup/php/phpaftershell-on-centos-7

Release overview: https://www.getpagespeed.com/server-setup/php/php-security-release-november-2026

Top comments (0)