A critical PHP bug lets a corrupted session file run attacker code
CVE-2026-126714 hits the file-based session handler PHP uses by default. An interrupted write can leave a session file half old, half new, and deserialise into a gadget chain.
PHP has patched a critical bug in its default file-based session handler, tracked as CVE-2026-126714 and rated 9.2 on CVSS 4.0. The function that writes session files, ps_files_write(), didn’t truncate the file before writing replacement data. If a write got interrupted partway, the file could end up holding the start of the new session followed by the tail end of the old one.
PHP’s session decoder reads that hybrid file as if it were one consistent session. Mixed content can turn ordinary strings into something PHP deserialises as an object, and with a gadget chain available in the application, that runs attacker code. The advisory names session upload-progress handling, large user-controlled strings stored in sessions, and interrupted writes on memory-constrained or threaded builds as the realistic ways a write gets cut short. Reported by zplinn, fixed on 19 November in PHP 8.2.36, 8.3.37, 8.4.28, 8.5.13 and 8.6.0.
Why it matters: this only affects the files session handler, PHP’s default, so almost any PHP app that hasn’t switched to Redis, Memcached or a database for sessions is in scope. No exploitation has been reported yet, but the bar to trigger it is low: you don’t need an unusual configuration, just the handler everyone starts with.
The caveat: disabling session.upload_progress.enabled closes one path in, not the bug itself. Patching is the only real fix.