Skip to content
CVE-2026-126714

CVE-2026-126714

github.com • November 19, 2026

PHP's file-based session handler can leave a session file containing parts of two different serialized sessions if a write is interrupted. An attacker who can influence the session contents and interrupt a replacement write may be able to make PHP deserialize attacker-controlled objects when the session is opened. A suitable object gadget chain in the application can turn this into remote code execution.

This affects the files session save handler, which is PHP's default. The issue is not limited to session upload progress or PHP 8.6.

When updating a session, ps_files_write() writes the new serialized data into the existing file. The vulnerable implementation does not clear the existing contents before every write. If the operation stops after replacing only part of the file, the result can contain a prefix of the new session followed by a suffix of the old one. The file lock prevents competing session operations from accessing the file during the write, but does not make an interrupted write atomic.

PHP's session decoders use its unserialization machinery to restore session values. Carefully arranged old and new data can cause the combined file to be interpreted differently from either original session. Bytes that were previously part of an ordinary string can become serialized object data. A later session_start() or another session-reading operation can then create those objects and invoke their deserialization behavior.

Session upload progress provides one way for a remote client to influence stored session data through multipart uploads. The same underlying problem can arise when an application stores large user-controlled strings in a session. In threaded PHP builds, a hard memory-limit failure in another thread can terminate the process while the session write is in progress. This provides a way to influence where the write stops.

The fix truncates the session file to zero before writing the replacement data and aborts the write if truncation fails. An interrupted write can still lose session data, but it can no longer retain the old suffix that enables this attack.

Successful exploitation can execute code with the privileges of the PHP worker. It requires attacker influence over the session data, an interruption at a useful point in the write, and an application with a suitable deserialization gadget chain. The issue can also corrupt session state. Authentication requirements depend on how the application exposes the affected session operations.

Other session storage implementations are not affected by this specific file-write defect, although their own handling of interrupted updates must be considered separately.

Upgrade to the fixed release for your PHP branch when it becomes available. As a temporary measure, disable session.upload_progress.enabled administratively if the feature is not needed, and limit the amount of untrusted data stored in sessions. Disabling upload progress removes that input path but does not fix applications that independently store attacker-controlled session data.

A session storage backend that replaces records atomically can avoid this file-write defect. The PHP update remains the recommended fix for applications using the built-in files handler.

Extracted Entities

Attack Types (1)

Platforms (1)