Back to all lessons
Awareness Lessons
2 weeks ago

PHP Session Race Condition Enables Remote Code Execution Without Patches

Written by AI from the linked story. Not reviewed by an editor. How this works

A critical flaw (CVE-2026-126714, CVSS 9.2) in PHP's default file-based session storage allows attackers to inject malicious objects by interrupting a session write at precisely the right moment, which — when a usable gadget chain exists in the application — leads to remote code execution. The vulnerability is worsened by PHP's default configuration enabling upload progress tracking, which creates the write-interrupt window that attackers exploit. Patches are available across all supported PHP branches, and interim mitigations (disabling upload progress, switching session handlers) can close the attack surface without upgrading. This incident illustrates how insecure defaults compounded with delayed patching can elevate a subtle language-level quirk into a full system compromise.

Tactical Insight

Immediate actions

  • Apply PHP patches 8.2.36, 8.3.37, 8.4.28, 8.5.13, or 8.6.0 to all PHP runtime environments immediately.
  • Disable PHP's upload progress feature (`session.upload_progress.enabled = Off`) as a short-term mitigation on systems that cannot be patched right away.
  • Replace file-based session storage with a memory-backed alternative (e.g., Redis or Memcached) to eliminate the vulnerable write-interrupt window.

Long-term improvements

  • Maintain a complete, up-to-date inventory of all PHP versions in use across every application environment to enable rapid targeted patching.
  • Establish a formal patch SLA for critical (CVSS ≥ 9.0) vulnerabilities that mandates remediation within 24–72 hours of patch availability.
  • Audit application dependencies for exploitable gadget chains (using tools such as phpggc) to understand true exploitability risk before patches are deployed.

Detection measures

  • Deploy runtime application self-protection (RASP) or a web application firewall rule to flag anomalous session file manipulation patterns.
  • Monitor PHP error logs and file-system activity on session storage directories for unexpected write interruptions or unusual object serialization events.
  • Integrate continuous vulnerability scanning into CI/CD pipelines to detect newly disclosed CVEs against the PHP version in use before they reach production.

Back this up with a control

All controls and vendors

Training helps people spot this. These controls make the attack fail even on the day someone does not.