PHP Foundation Issues Critical Security Updates to Fix Remote Code Execution Vulnerabilities Including ‘phpAfterShell’

The PHP Foundation has officially rolled out urgent security updates designed to address a series of severe vulnerabilities affecting various supported branches of the widely used scripting language. Among the addressed security flaws is CVE-2026-115560, alongside other critical issues that, under specific conditions, could be leveraged by threat actors to achieve remote code execution on vulnerable web servers and backend deployments.

The deployment of these vital patches follows a prior advance notice issued by core project maintainers. In that preliminary alert, the development team warned users of multiple critical vulnerabilities impacting all supported versions of PHP, though noting that exploitation typically required specific conditions, such as non-default server configurations or uncommon environment setups.

From a high-level perspective, successfully exploiting these architectural and memory-handling defects could pave the way for a devastating array of security failures. Depending on the exact flaw and the environment configuration, malicious actors could potentially trigger remote code execution, session corruption, denial-of-service conditions, underlying memory corruption, or even local privilege escalation.

Among the most alarming discoveries is a critical flaw cataloged as CVE-2026-126714, which has been codenamed "phpAfterShell" by the security research firm Depthfirst. Researchers have described it as a high-severity vulnerability capable of granting remote attackers the ability to execute arbitrary code on targeted, unpatched servers running file-based sessions.

The mechanics of phpAfterShell involve intricate interactions between PHP’s session management lifecycle and filesystem operations. According to Depthfirst, if a pwrite() or ftruncate() system update is abruptly interrupted, PHP can inadvertently leave behind a malformed session file on disk. When this corrupted file is subsequently loaded by the session_start() function during standard application execution, it yields an unexpected and dangerous arbitrary deserialization primitive. When chained thoughtfully with other PHP-native deserialization-to-RCE findings discovered by the researchers, this behavior leads directly to remote code execution.

Put differently, the vulnerability cleverly converts an interrupted file write operation into a potential remote code execution vector by manipulating the precise manner in which PHP writes session data to persistent disk storage. This anomaly causes the application interpreter to misinterpret previously harmless data as executable object data upon subsequent reads.

PHP Fixes 7 Critical Flaws, Including Bugs That Could Allow Remote Code Execution

The flaw exploits an abnormal session state where a PHP worker process either dies unexpectedly while the file write process is actively underway—leaving behind a partially updated file—or dies immediately after the write finishes, but crucially before content from the previous session can be purged. Both distinct scenarios result in a hybrid file containing a mixture of two completely separate session states.

Security researcher Yuhang Wu elaborated on this behavior, noting that depending on the exact millisecond where the worker process interruption happens, a portion of the new session data may already have been successfully written to disk while persistent bytes from the previous session remain intact. The ultimate result is a corrupted session file containing the prefix of the newly serialized data combined seamlessly with the structural tail of the old session data.

By carefully and strategically choosing the length fields embedded within the new data prefix, an attacker can effectively trick PHP’s underlying session decoder into interpreting leftover bytes that were previously nothing more than ordinary string data as completely separate, valid session entries and serialized objects. A critical aspect of this attack vector is that absolutely nothing malicious needs to be deserialized during the upload-progress callback itself. The attacker only needs to leave the precise sequence of bytes on disk and patiently wait for the web application to invoke session_start(), at which point the PHP interpreter reads the modified session file and automatically deserializes those injected objects.

Once the prefix of one valid session is spliced together with the tail of a replacement session, any subsequent session handling treats this amalgamated, corrupted data as legitimate server-side state. This forces PHP to interpret the anomalous data as a distinct, valid session, which can then be manipulated to enable remote code execution by chaining it with existing memory-corruption vulnerabilities residing within native PHP classes.

This pervasive issue potentially threatens any web application running an affected version of PHP that relies on default file-based session handlers. Security experts emphasize that for administrators unable to apply the official software patches immediately, a viable interim mitigation is to explicitly turn off session upload progress features in their configuration settings to reduce the attack surface.

Official patches resolving these critical flaws have been made available by the PHP Foundation through their standard release channels and changelogs. Administrators and infrastructure teams operating existing 8.2.x, 8.3.x, 8.4.x, and 8.5.x production branches of PHP are strongly advised to update their installations to the latest secure versions as soon as possible to ensure optimal protection against potential exploitation in the wild.