A two-step file write in PHP’s default session handler can leave a corrupted session behind, and PHP rates the resulting bug 9.2 out of 10.
Key takeaways
- phpAfterShell (CVE-2026-126714) is a critical flaw in PHP’s default file-based session handler, rated 9.2 on CVSS v4.0.
- Fixed versions are PHP 8.2.36, 8.3.37, 8.4.28, 8.5.13 and 8.6.0, all released on 19 November 2026.
- Servers patched for last month’s PHP2Shell bugs are still exposed, because the root cause was left untouched.
- No exploitation in the wild had been reported as of 19 and 20 November, but the same release fixes six other critical bugs.
- Indian hosting firms, agencies and businesses running PHP apps should update and restart PHP workers today.
What is phpAfterShell and should I worry? phpAfterShell (CVE-2026-126714) is a critical vulnerability in how PHP saves session data to files, which is the default setup on most servers. Under the right conditions an attacker can corrupt a session file and push PHP into loading attacker-controlled data. If your site runs PHP 8.2 to 8.5, update to the fixed release now.
What exactly is broken in PHP?
When PHP saves a session using its default “files” handler, it does two separate things. First it overwrites the existing session file from the start. Then it trims off any leftover bytes at the end. These two steps are not atomic, which means they do not happen as one locked action.
If the PHP process is killed between those two steps, for example because it runs out of memory, the session file ends up holding the new data followed by old leftover bytes. On the next request, PHP reads and unserialises that mixed file. An attacker who can control what goes into the session can use this to slip in crafted data. SOCRadar reports that the underlying behaviour dates back to PHP 4.1.0.
The bug was found and named by security firm depthfirst.
Which PHP versions are affected and which are fixed?
The PHP project shipped fixes for every supported branch on 19 November 2026, as listed on php.net.
| Branch | Vulnerable | Fixed version |
|---|---|---|
| PHP 8.2 | Older than 8.2.36 | 8.2.36 |
| PHP 8.3 | Older than 8.3.37 | 8.3.37 |
| PHP 8.4 | Older than 8.4.28 | 8.4.28 |
| PHP 8.5 | Older than 8.5.13 | 8.5.13 |
| PHP 8.6 | Pre-release builds | 8.6.0 |
PHP 8.1 and older are end of life and do not get these updates. Sources disagree on whether those old branches are affected at all, so the safe move is to treat them as at risk and plan an upgrade.
How easy is it to exploit?
It is not a one-click attack. Security write-ups from Cycode, Astra and SOCRadar list several conditions:
- The site must use PHP’s default file-based session storage.
- The attacker must be able to put their own data into a session. The easiest known route is PHP’s session upload progress feature.
- The write must be interrupted, for example by a memory limit crash.
- A later request must load that session.
- The attacker needs a way to turn the injected data into code execution.
That last step is disputed. PHP’s advisory says an attacker needs a suitable chain inside the application. depthfirst says its own chain did not need application code and instead used a second, undisclosed bug in PHP itself. Until that is cleared up, it is wise to assume a determined attacker can get code running.
How is this linked to PHP2Shell?
On 21 October 2026, PHP fixed two bugs known together as PHP2Shell (CVE-2026-109618 and CVE-2026-109619). Attacks began even before the fix, and the US agency CISA added both to its list of known exploited bugs on 26 October.
That October fix blocked one way of abusing the upload progress feature, but it did not change how session files are written. phpAfterShell is the path that remained. So a server that was patched in October is still vulnerable until it moves to the 19 November releases.
What else was fixed in the same release?
The 19 November update is a big one. Security firms list seven critical bugs in total, each rated 9.2, including:
- CVE-2026-129289: request smuggling in PHP-FPM through reused FastCGI connections, which Phoenix Security ranks as the top item to patch.
- CVE-2026-115560: a session serialiser mismatch in specific setups with upload progress enabled.
- Four use-after-free bugs (CVE-2026-129496, CVE-2026-129481, CVE-2026-129474 and CVE-2026-129182), two of which affect only PHP 8.5.
Cloudflare says the release fixes 16 other vulnerabilities alongside phpAfterShell. It has also pushed managed WAF rules covering phpAfterShell and the PHP2Shell bugs, which are on by default in both its free and paid rulesets.
What does this mean for India?
PHP powers a large share of the web, including many Indian small business sites, ecommerce stores and portals built by local agencies. Many of these sit on shared hosting or on VPS servers that are rarely touched after launch. That is the exact setup where file-based sessions are the default and updates lag.
WordPress core does not rely on PHP’s built-in sessions, but plenty of plugins, themes, custom PHP apps and frameworks do. The only reliable answer is to check the PHP version your web server actually runs.
If you are hit, Indian organisations are required to report cyber incidents to CERT-In, so keep logs and act quickly.
What should you do right now?
- Check your real PHP version. Look at what serves web traffic, for example with a phpinfo page you remove afterwards or your hosting panel, not just
php -von the command line. - Update to 8.2.36, 8.3.37, 8.4.28, 8.5.13 or 8.6.0. On managed or shared hosting, ask your provider for the date they will roll it out.
- Restart PHP-FPM or Apache so every worker loads the new binary. Rebuild Docker images with a fresh base image.
- Turn off upload progress if you do not need it: set
session.upload_progress.enabled = 0in php.ini or the FPM pool, then restart. Do not rely onini_set()or.user.inifor this. - Consider a different session store, such as Redis or a database, which writes each session in one step.
- For PHP-FPM, review FastCGI connection reuse settings, since the smuggling bug abuses reused connections.
- Use a WAF if you have one, but treat it as a backup, not a fix.
- Plan an upgrade off PHP 8.1 or older.
FAQs
What is CVE-2026-126714?
It is the ID for phpAfterShell, a critical flaw in PHP’s default file-based session handler. PHP rates it 9.2 on CVSS v4.0.
Which PHP versions fix phpAfterShell?
PHP 8.2.36, 8.3.37, 8.4.28, 8.5.13 and 8.6.0, all released on 19 November 2026. Older 8.x releases on those branches are vulnerable.
Is phpAfterShell being exploited?
No exploitation in the wild had been reported as of 19 and 20 November 2026. The related PHP2Shell bugs were exploited in October, so attackers are clearly watching this area.
I patched PHP2Shell in October. Am I safe?
No. The October fix did not change how session files are written, so you still need the 19 November release.
Does this affect WordPress sites?
WordPress core does not use PHP’s native sessions, but many plugins, themes and custom code do. Updating PHP removes the risk regardless of which software you run.
Can I just disable upload progress instead of updating?
It closes the easiest known route, but sources say it is not the only one. Treat it as a stopgap and update PHP as soon as you can.
Sources
- PHP: official release announcements, 19 November 2026
- Cloudflare: phpAfterShell WAF protection
- Cycode: PHPAfterShell (CVE-2026-126714)
- Astra Security: CVE-2026-126714 advisory
- SOCRadar: phpAfterShell slips past PHP2Shell patch
- Phoenix Security: phpAfterShell, patch first
