PHP Session File Partial Overwrite Leads to RCE (CVE-2026-126714)
PHP's default files session save handler can leave stale data in session files after interrupted writes, allowing object injection and potential RCE. Fixed in 8.2.36, 8.3.37, 8.4.28, and 8.5.13.
CVE-2026-126714 affects PHP's files session save handler (the default). When updated session data is written, the existing session file is not cleared first. If the write is interrupted, the file can contain the beginning of the new session followed by the end of the old one. Bytes of an ordinary string can later be unserialized as objects. An attacker who can influence session data (for example, via session upload progress) and interrupt a write at a suitable point may inject objects, which can lead to code execution when the application contains a suitable gadget chain. Session data can also be corrupted.
Affected versions: PHP 8.2. before 8.2.36, 8.3. before 8.3.37, 8.4. before 8.4.28, and 8.5. before 8.5.13.
Sources: - NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-126714 - PHP advisory: https://github.com/php/php-src/security/advisories/GHSA-fm2m-fjf5-v3cp
What to do 1. Identify PHP versions in use across all environments and compare against the affected ranges. 2. Upgrade PHP to a fixed release: 8.2.36, 8.3.37, 8.4.28, or 8.5.13 (or later) as appropriate for your deployment. 3. If an immediate upgrade is not possible, review the vendor advisory and consider interim mitigations such as disabling session.upload_progress if it is not required. Verify the advisory before changing production. 4. Audit applications for unserialize gadget chains and restrict any user-influenced session data that could be leveraged for object injection. 5. Monitor session files and application logs for signs of corruption or exploitation attempts, and re-check the vendor advisory for any additional guidance.