Zero Day Room
Live
Vulnerabilities

PHP fixes critical phpAfterShell session handler vulnerability

A critical vulnerability in PHP's default file-based session storage, tracked as CVE-2026-126714, allows remote code execution.

A critical vulnerability in PHP's default file-based session storage, tracked as CVE-2026-126714, allows remote code...

Security firm Depthfirst identified a critical flaw in PHP's default file-based session handler, dubbed phpAfterShell. The vulnerability, tracked as CVE-2026-126714 and rated 9.2 on the CVSS 4.0 scale, allows attackers to execute arbitrary code. PHP's maintainers have released patches, and no active exploitation has been reported.

This phpAfterShell vulnerability affects all supported PHP versions using the default file-based session storage. It can be exploited via the upload progress feature to load attacker-chosen objects from corrupted session files. The same technique can also replace critical session values, such as user permissions or CSRF tokens. Depthfirst reported the flaw to the maintainers, who confirmed the fix.

Technical details of the flaw

The vulnerability stems from incomplete session writes. A PHP session file stores data with length fields but no marker for a completed write. If a PHP worker process dies during a write, the file can retain a mix of old and new data. An attacker can manipulate upload progress to interrupt a write, crafting the new data so that leftover text from the old session is read as a separate record containing a serialized object.

The next request that calls session_start() loads that record and creates the object. A second weakness, such as a gadget chain present in the application's code, is then needed to achieve code execution on the server. Depthfirst's researchers said, "The attack depends on stopping the write at the right moment." The flaw is specific to the file-based handler; sessions stored in Redis, a database, or other stores are not affected, though each store's handling of interrupted updates requires separate scrutiny.

Affected versions and remediation

The following PHP versions are vulnerable and require immediate updating. The fixes were released on November 19, 2026.

PHP BranchFixed Version
8.28.2.36
8.38.3.37
8.48.4.28
8.58.5.13
8.68.6.0

PHP 8.1 and older are end-of-life and do not receive official fixes, though unpatched builds of those versions are vulnerable. Servers updated on October 21 to address the earlier PHP2Shell flaws remain affected and must install the November 19 updates. Linux distribution packages may include the fix without changing the PHP version number, so the version number alone may not confirm a patch is applied.

Immediate mitigation steps

For users unable to update immediately, disabling the upload progress feature is a key workaround. This is done by setting session.upload_progress.enabled = 0 in php.ini or the server's PHP settings and then restarting the PHP workers. This setting was also listed as a temporary measure for the PHP2Shell flaws on October 21; servers that kept it off since then still require the new update.

Switching the feature off is not a complete fix. It closes the upload path, but applications that store attacker-controlled data in sessions through other means remain vulnerable. Administrators should also limit the amount of untrusted data their applications store in sessions. Moving sessions to a storage backend that replaces records in a single atomic operation, like Redis or a database, also avoids this specific defect, though the update remains the recommended fix for sites using the files handler.

The patched releases implement a more robust write process. They empty the session file before each write and stop the write if that step fails. A cut-off write can still lose session data, but it can no longer leave old data behind for an attacker to use. The updates also switch upload progress off by default, though the release notes do not mention this change. A php.ini file, distribution package, or hosting panel that explicitly switches the setting on will keep it on. Where nothing else sets it, applications that rely on upload progress will need to switch it back on after updating.

Depthfirst noted that the October 21 PHP2Shell fixes addressed an earlier attack via the same mechanism. "The original exploit stopped working, but the underlying problem was still there," the company said. The new patches resolve the underlying session write vulnerability. Servers must install PHP 8.6.0 or the November 19 updates for their branch to be fully secured.

Related coverage

More from Vulnerabilities