Inside the Non-Atomic Session Write Behind CVE-2026-126714

2026-11-20来源 dev.toEnglish

Inside the Non-Atomic Session Write Behind CVE-2026-126714

Vulnerability overview

The important detail in CVE-2026-126714 is not simply that PHP sessions can be corrupted. It is how the corruption occurs. PHP's default file-based session handler updates an existing file in place, and an interrupted replacement can leave a combination of two serialized sessions. The PHP project rates the issue 9.2 under CVSS v4.0.

That sequence turns a storage durability problem into a deserialization problem. Understanding the file lifecycle helps teams decide which applications need immediate analysis.

Mechanism and exploitation conditions

When PHP writes session data through ps_files_write(), the existing file is not cleared before every write. If the process stops after replacing only part of the file, the new data may be followed by an old suffix. The file lock prevents another session operation from entering during the write, but it cannot make an interrupted replacement atomic.

On the next read, PHP's session decoder processes the combined file. The advisory explains that careful arrangement of old and new values can alter parse boundaries and cause ordinary string bytes to be treated as serialized object data. That can invoke deserialization behavior and create objects.

The attacker therefore needs influence over session contents and a way to interrupt the write at a useful point. A remote client can use session upload progress to place controlled data in the session. Applications that keep large user-controlled strings in sessions may expose another path. Even when the attacker can cause the malformed file, code execution still depends on a suitable object gadget chain in the application.

Impact

A successful chain can execute code with the PHP worker's permissions. It can also leave session data inconsistent, which creates a separate denial-of-service or account-handling problem. The advisory records high impact across confidentiality, integrity, and availability for the vulnerable system.

The worker context is the practical boundary. A service running as a low-privilege account may limit file access but can still expose application data and outbound network paths. A worker with broad filesystem or database access raises the containment burden.

Affected products and scope

The fixed releases are PHP 8.2.36, 8.3.37, 8.4.28, and 8.5.13. Affected ranges are below 8.2.36, 8.3.0 through 8.3.36, 8.4.0 through 8.4.27, and 8.5.0 through 8.5.12.

The defect concerns the built-in files save handler. It is present in code reaching back to PHP 4.1.0, but deployment relevance still depends on the selected handler. A newer application container can embed an older PHP build, and a patched base image may coexist with unpatched application images. Inventory by image digest and runtime package, not only by the host operating system.

Exposure context

ZoomEye Search app="PHP" returned 111,201,123 matches. The CVE Filter returned 0. The Search result indicates a large PHP product footprint, not a count of vulnerable session files or exploitable applications.

For this flaw, version evidence and configuration evidence carry more weight than a generic product match. Query results can identify where to ask questions. They cannot answer whether a file session was interrupted or which application classes contain dangerous deserialization paths.

Remediation and mitigations

Apply the fixed release for each supported branch. The patch truncates the session file to zero before writing the new serialized data and aborts when truncation fails. An interrupted write can still lose a session, but it cannot expose the old suffix that makes the deserialization primitive possible.

During an emergency window, disable upload progress if the application does not use it and reduce untrusted data held in sessions. An atomic session store can avoid this specific write defect. Those options do not replace the vendor fix.

Validation should include the actual runtime and the session handler in use. Restart or replace old workers so they cannot continue serving with vulnerable code. Sample package metadata, inspect the effective session.save_handler, and test an upload-progress request only in an authorized environment.

References

原文:https://www.a8q9.cn/en/article/inside-the-non-atomic-session-write-behind-cve-2026-126714-c669a5.html

相关文章