Key facts
- PHP released fixed versions on November 19, 2026: PHP 8.2.36, 8.3.37, 8.4.28, 8.5.13 and 8.6.0.
- If patching cannot happen right away and the application does not use upload progress, change session.upload_progress.enabled to 0 in php.ini or server configuration, then restart PHP workers.
- An interrupted session write can make PHP's default file-based storage return attacker-chosen objects.
- Researchers say combining the flaw with a suitable gadget chain can enable remote code execution on the server.
PHP released fixed versions on November 19, 2026 for CVE-2026-126714, named phpAfterShell, a flaw in the default file-based session handler that can return attacker-chosen objects after an interrupted session write.
Patched versions clear the session file before every write and halt the write if that step does not succeed. An interrupted write may still lose session data, but attackers can no longer use old data left behind. The updates switch upload progress off by default. The built-in setting is on in PHP 8.2.35, 8.3.36, 8.4.27 and 8.5.12, and off in PHP 8.2.36, 8.3.37, 8.4.28, 8.5.13 and 8.6.0.
Affected versions include PHP 8.2 below 8.2.36, PHP 8.3 below 8.3.37, PHP 8.4 below 8.4.28 and PHP 8.5 below 8.5.13. Older unpatched builds of PHP 7.4, 8.0 and 8.1 are affected, according to Depthfirst. PHP 8.1 and older are end-of-life, and PHP 8.2 reaches end of life on December 31, 2026. PHP 8.6.0, released the same day, includes the fix.
Depthfirst, a security company, discovered the flaw and notified PHP maintainers, and researchers say combining the flaw with a suitable gadget chain (a series of existing code snippets an attacker chains together to run arbitrary code) can enable remote code execution on the server. Depthfirst says the tested attack path uses upload progress, which records file upload progress in the user’s session. With upload progress enabled, a multipart form upload carrying its field triggers a session write before the application’s own code executes. The application does not require an upload page; a later page that starts the session is enough.
In a PHP session file, each value appears as a name followed by serialized data. Length fields show where each string ends, and the file contains no mark showing a write finished. PHP locks the file while writing but cannot reverse a write that stops partway through. A worker death partway through can leave the file holding the beginning of new data plus the end of old data, and choosing length values in the new data can cause harmless old text to parse as a separate session record, such as a serialized object.
Depthfirst’s public proof uses the harmless built-in object stdClass, and in a fresh run the planted object showed up on attempt 11, a figure that reflects achieving the desired file condition rather than the frequency of successful code execution. Depthfirst’s Linux tests showed the execution timeout triggered only once writing completed, so the team stopped the worker mid-write using an out-of-memory kill. Depthfirst researchers said, “The original exploit stopped working, but the underlying problem was still there”. Depthfirst’s own chain needed no app gadget; it used a second bug, memory corruption in one of PHP’s built-in classes, and the company is holding back details for coordinated disclosure without saying whether that bug is fixed in current releases.
The technique may also swap typical session values—for example login status, permissions or a CSRF token—before the application verifies them. The flaw does not affect sessions stored in Redis, a database or another storage system. Every storage system handles an interrupted update differently, so each one requires a separate check. The application’s exposure of session handling determines if an attacker must log in, and Wiz says phpAfterShell needs file-based sessions and depends on locating an exploitable gadget chain inside the application’s own code to run arbitrary code.
Linux distribution packages may include the fix without changing the PHP version number, so the version number alone may not show whether a server is fixed. The October 21, 2026 PHP releases that fixed PHP2Shell do not contain this fix, and servers updated on October 21 remain affected until installing current releases.
Seven flaws in the November release are critical with CVSS 9.2. PHP maintainers rate the flaw 9.2 out of 10 on CVSS 4.0. Infosecurity Magazine says the PHP Foundation released security patches for 18 vulnerabilities, seven marked critical. Wiz reports that the PHP group issued security updates covering 17 vulnerabilities in actively supported branches.
On November 18, 2026, the PHP security team warned that upcoming updates would fix vulnerabilities in every supported PHP version, rated critical as the highest severity. CVE-2026-115560 was disclosed on October 23 and concerns session data handling under specific configurations, with potential remote code execution. Neither PHP maintainers nor Depthfirst reports attacks using phpAfterShell. Wiz reports that it has not seen exploitation in the wild, and public reporting mentions none either.
Cloudflare’s radar noted none of the 17 flaws in the batch appear in CISA’s exploited vulnerabilities catalog as of November 19, 2026.
The release notes neither mention nor explain the change. Commented-out lines in sample php.ini files continue to display the previous setting. A setting switched on in a php.ini file, a distribution package, or a hosting panel remains on after the update. Apps relying on upload progress need it switched back on after the update where nothing else sets it.
PHP advised turning off session upload progress through session.upload_progress.enabled=0 and restarting workers as a short-term mitigation. If patching cannot happen right away and the application does not use upload progress, the maintainers say to change session.upload_progress.enabled to 0 in php.ini or server configuration and restart PHP workers. Switching upload progress off closes the upload path but is not a full fix; apps storing attacker-controlled session data other ways remain affected, and untrusted data stored in sessions should also be limited. Using a storage system that replaces records in a single operation avoids the defect, though updating is still advised for sites that keep the file-based handler, and the maintainers listed session.upload_progress.enabled = 0 on October 21 as a temporary measure for one PHP2Shell flaw; servers keeping it off since then still need the update.
Ondrej Surý, a third-party maintainer, issued patched packages for unsupported PHP versions going back to PHP 5.6. Aikido released hardened PHP container images with backported fixes for unsupported versions including PHP 5.6, 7.0, 7.1, 7.2, 7.4 and 8.1. Aikido recommends blocking direct access from untrusted networks to PHP-FPM (PHP FastCGI Process Manager) and LSAPI (LiteSpeed Server API) listeners, since the mitigations do not cover every vulnerability fixed in November.

Join the discussion