Skip to content
Security

phpAfterShell (CVE-2026-126714): PHP Session Flaw Explained

phpAfterShell, CVE-2026-126714, lets attackers plant objects in PHP session files. Affected and fixed PHP versions, how to protect your server, and what HostGrap did.

phpAfterShell PHP session vulnerability CVE-2026-126714, servers patched

phpAfterShell is a critical PHP vulnerability, tracked as CVE-2026-126714 and rated 9.2 out of 10 on the CVSS 4.0 scale. It lets an attacker plant data of their choosing in a PHP session file, and in the wrong conditions that can lead to code running on the server. PHP fixed it on 19 November 2026 in versions 8.2.36, 8.3.37, 8.4.28, 8.5.13 and 8.6.0. All HostGrap hosting servers are patched and we have switched off the PHP feature the attack uses, so shared, WordPress, business and reseller hosting customers don't need to do anything. If you have a VPS or VDS, you manage the software on it, so update PHP on your server yourself.

What is phpAfterShell?

Most PHP websites use sessions to remember a visitor between pages, for example who is logged in or what is in a shopping cart. By default, PHP keeps each session in a small file on the server. When PHP saves a session, it writes the new data over the old data in that file.

The researchers who found phpAfterShell showed that if the PHP process is stopped halfway through that write, the file can end up with the start of the new data and the end of the old data mixed together. By carefully choosing what they send, an attacker can make the leftover part read as a new piece of session data, including a PHP object. The next time the website opens that session, PHP loads the object.

On its own, a planted object is a problem, because it can change values the website trusts, such as who is logged in or what permissions they have. If the website or one of its libraries also contains code that can be misused when such an object loads, known as a gadget chain, the attacker may be able to run their own code on the server. That is why the flaw is rated critical.

How does the attack work in practice?

The path the researchers tested uses a PHP feature called session upload progress. When it is switched on, PHP records how far a file upload has got in the visitor's session. It does this before the website's own code runs, and on any page that uses sessions, so the website doesn't need an upload form for the attack to work.

The attacker also needs a way to stop the PHP process in the middle of the write, for example by making it run out of memory at the right moment. That takes timing and repeated attempts, so it is not a simple attack, but it is realistic enough that PHP's maintainers asked everyone to update.

phpAfterShell is a follow-up to PHP2Shell, which PHP fixed on 21 October 2026. The October fix blocked the first exploit but did not fix the way session files are written. Servers that were updated in October are still affected until they install the November releases.

Which PHP versions are affected?

Every supported PHP version before the November 2026 releases is affected when it stores sessions in files, which is PHP's default.

PHP branchAffectedFixed in
PHP 8.2Before 8.2.368.2.36
PHP 8.3Before 8.3.378.3.37
PHP 8.4Before 8.4.288.4.28
PHP 8.5Before 8.5.138.5.13
PHP 8.6No earlier release8.6.0

PHP 8.1, 8.0 and 7.4 are end-of-life, which means PHP itself no longer fixes them. Older builds of these versions are affected. Websites that store sessions in Redis, a database or another store that replaces the whole record in one step are not affected by this file-writing problem, although updating is still the recommended fix.

Some Linux distributions and hosting platforms add security fixes to their PHP packages without changing the version number. So on those systems, the version number alone does not tell you whether the server is fixed. Check your provider's security notices or package changelog.

What has HostGrap done?

We have installed the fixed PHP releases on all of our hosting servers, the ones that run our cPanel, WordPress, business and reseller hosting. We have also switched session upload progress off on every one of them, which closes the path the researchers used. This matches the new default in the fixed PHP versions, which now ship with the feature switched off.

Our servers also offer older PHP versions for websites that still need them. These are kept up to date with security fixes through TuxCare's extended lifecycle support, so they keep receiving fixes after PHP stops supporting them. Even so, we recommend moving your website to PHP 8.2 or newer when you can, because it is fully supported by PHP itself.

Very few websites rely on session upload progress. If yours shows an upload progress bar that stops working, message us and we will help you switch it back on for your account.

What should I do if I run my own server?

If you manage your own VPS, dedicated server or Docker containers, install the fixed PHP release for your branch as soon as you can. Then restart PHP so the new version is the one serving your website. On most servers that means restarting PHP-FPM or LiteSpeed, and with containers it means rebuilding your images and deploying them again.

To see which PHP version your website is actually using, look at the PHP version in your control panel, or create a temporary file with phpinfo() and open it in a browser, then delete it straight away. On the command line, this shows the version of the PHP command-line program, which can be different from the one serving your website:

php -v

If you can't update yet and your website doesn't use upload progress, switch the feature off in php.ini or your server's PHP settings, then restart PHP:

session.upload_progress.enabled = 0

This blocks the known attack path, but it is not a full fix. Websites that store data from visitors in sessions in other ways can still be affected, so install the update as well.

Do HostGrap customers need to do anything?

It depends on your service. If you have cPanel, WordPress, business or reseller hosting, you don't need to do anything: your hosting is already on patched PHP, and upload progress is switched off.

If you have a HostGrap VPS or VDS, you have full control of the server and the software on it, so PHP updates on that server are yours to install. Follow the steps in the section above for your own server: update PHP, restart it, and check the version your website uses. If you're not sure how, message us and we will help.

For every website, the best extra step is to keep your website's software up to date, because a gadget chain usually comes from old plugins, themes or libraries. Our WordPress security checklist explains how to keep a WordPress website safe, and our post on the cPanel & WHM reseller SSL vulnerability covers this week's other server update. If you have a question, message us on WhatsApp or open a support ticket, and HostGrap AI or our team will help.

Share this article

More from the blog

All posts