SecurityZines.com Join

PHP Session RCE

CVE-2026-126714

Web SecurityFlyer

PHP Session RCE (CVE-2026-126714): hand-drawn explainer poster

CVE-2026-126714: PHP session file overwrite to object injection

What is CVE-2026-126714? PHP stores each session in one flat file on disk, written by the built-in files save handler. The bug: when the handler saves updated session data it writes the new bytes over the existing file without clearing it first. If the new value is shorter than what was there, or the write is interrupted part way, the file is left holding a mix of new and stale bytes. It affects the default ext-session and is rated CVSS 9.2 Critical (CWE-367, a time-of-check/time-of-use race).

How it breaks: Session data is serialized as name|value pairs. A leftover tail from an older, larger value can be re-read as a serialized PHP object on the next request, for example a trailing O:4:"Evil":1:{...}. That is classic PHP object injection: when the page calls unserialize on the session, it builds an attacker-shaped object. The practical trigger is session.upload_progress - on by default - which lets an attacker seed a large value into their own session during a file upload, then abort the request at the right moment to leave the crafted tail behind.

Is it actually exploitable? Critical on paper, conditional in real life. Reaching code execution needs two things to line up: a usable POP gadget chain in the application or its framework (so the injected object does something dangerous when destroyed or used), and winning the race to interrupt the write at the exact byte. With no gadget chain the result is session data corruption, not a shell. CISA's assessment marks it automatable with total technical impact, but no in-the-wild exploitation at disclosure. Treat it as a serious patch-now bug whose worst case depends on what else is in your stack.

How to stop it: Update PHP to 8.2.36, 8.3.37, 8.4.28 or 8.5.13 - the fix truncates the session file before every write, so no stale bytes survive. If you cannot patch immediately, disable session.upload_progress and prefer a non-file session backend such as Redis or Memcached, which do not have this partial-overwrite behaviour. As defence in depth, keep untrusted data out of unserialize and audit your dependencies for object-injection gadget chains.

CVE-2026-126714 is a reminder that a sloppy write - saving over a file instead of replacing it - can become remote code execution once a serialization format and a gadget chain are in reach. Patch the handler, kill upload progress, move sessions off the local disk.

More on Web Security

All 36

Get the next one by email

New posters land in the Security Zines newsletter on Substack. Free, no spam.