Software Engineering

PHP releases critical security updates to fix phpAfterShell RCE vulnerability

Key Takeaway

A critical vulnerability in PHP's file-based session handler allows remote code execution via interrupted session writes.

Summary

The PHP project has released urgent security updates to address several critical vulnerabilities, most notably 'phpAfterShell' (CVE-2026-126714). This flaw, which carries a CVSS 4.0 score of 9.2, resides in the default file-based session handler and can lead to remote code execution (RCE) if a session file write is interrupted. The vulnerability allows attackers to manipulate session data through features like session upload progress or large user-controlled strings.

In addition to phpAfterShell, the updates address 16 other security flaws, including request smuggling in PHP-FPM and vulnerabilities in the SOAP extension. Cloudflare has deployed Web Application Firewall (WAF) rules to block known attack patterns for these flaws. However, security experts emphasize that WAF protection is not a substitute for patching, as certain exploits depend on specific server configurations or internal paths that bypass edge security.

Technical breakdown of phpAfterShell and related flaws

  • Session Deserialization Flaw: phpAfterShell occurs when a session file write is interrupted, leaving a file containing a mix of new and old session data; subsequent calls to session_start() deserialize this corrupted content, allowing for object injection.
  • Attack Vectors: Exploitation typically involves using the 'Session upload progress' feature or injecting large user-controlled strings into the session to shape the data stored in the file.
  • PHP-FPM Request Smuggling: CVE-2026-129289 allows unauthenticated attackers to smuggle FastCGI requests into PHP-FPM, potentially executing code as a worker when front-ends like Nginx or HAProxy reuse backend connections.
  • Memory Corruption and Use-After-Free: The update addresses multiple use-after-free vulnerabilities in the timezone cache, session shutdown, and fatal error backtraces, some of which have demonstrated local code execution capabilities.
  • SOAP and Serializer Issues: New rules and patches address flaws in the PHP SOAP extension and object injection risks caused by mismatches between different session serializers.

Why it matters

System administrators and DevOps engineers must prioritize upgrading PHP to versions 8.2.36, 8.3.37, 8.4.28, 8.5.13, or 8.6.0 and restarting all worker processes. Because Linux distributions often backport security fixes, users should verify their specific package versions against distribution-specific security advisories.

What to do

  • Upgrade PHP to versions 8.2.36, 8.3.37, 8.4.28, 8.5.13, or 8.6.0.
  • Restart every worker after upgrading.

Original reference: blog.cloudflare.com →