Skip to main content

Partially overwritten session files can lead to remote code execution

Publication Date 2026-11-19
Severity High
Type Remote Code Execution
Affected PHP Versions
  • 7.2.0-7.2.34
  • 7.3.0-7.3.33
  • 7.4.0-7.4.33
  • 8.1.0-8.1.34
  • 8.2.0-8.2.35
  • 8.3.0-8.3.36
  • 8.4.0-8.4.27
  • 8.5.0-8.5.12
Fixed Product Versions
  • ZendPHP 7.2
  • ZendPHP 7.3
  • ZendPHP 7.4
  • ZendPHP 8.1
  • ZendPHP 8.2
  • ZendPHP 8.3
  • ZendPHP 8.4
  • ZendPHP 8.5
  • ZendServer 2021.4.10

CVE Details

PHP's default file-based session handler can leave a session file with a mix of new and old data if a write is interrupted, so an attacker who can influence session data may inject objects and, if the application contains a suitable session serialization chain, run code on the server. An attacker who can influence the session data, for example through 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 session serialization chain. Session data can also be corrupted.

Recommendations

Switch to a non-file-based session handler (such as Redis or memcached), or use a userland session handler that does not rely on the filesystem (such as psr7-sessions/storageless, mezzio/mezzio-session with the mezzio/mezzio-session-cache backend, tedivm/stash-bundle for Symfony, etc). Update to a patched PHP version if possible.