Skip to main content
CybersecurityVulnerability Management

PHP Foundation Patches Flaws That Expose Servers to Remote Code Execution

Rows of computer servers and networking equipment in a brightly-lit data center with technicians in the background.

"If a pwrite()/ftruncate() update is interrupted, PHP may leave behind a malformed session file that is later loaded by session_start(), yielding an arbitrary deserialization primitive," Depthfirst said.

The seven CVEs and what they enable

The PHP Foundation released security updates addressing seven critical vulnerabilities — several rated CVSS 9.2 — that can in specific configurations lead to remote code execution, memory corruption, session corruption, denial-of-service, or local privilege escalation. The vulnerabilities named in the advisory are:

  • CVE-2026-115560 (CVSS 9.2) — improper input validation; could allow remote code execution, file modification, session corruption, or denial-of-service. (Fixed in PHP 8.2.36, 8.3.37, 8.4.28, 8.5.13, 8.6.0)
  • CVE-2026-129182 (CVSS 9.2) — use-after-free; may result in memory corruption and possible full remote code execution. (Fixed in PHP 8.5.13, 8.6.0)
  • CVE-2026-126714 (CVSS 9.2) — a Time-of-check Time-of-use (TOCTOU) vulnerability that can enable arbitrary code execution by manipulating session data. (Fixed in PHP 8.2.36, 8.3.37, 8.4.28, 8.5.13, 8.6.0)
  • CVE-2026-129289 (CVSS 9.2) — inconsistent interpretation of HTTP requests; could lead to execution of attacker-controlled PHP code on the worker without another user’s interaction or a non-default PHP configuration. (Fixed in PHP 8.2.36, 8.3.37, 8.4.28, 8.5.13, 8.6.0)
  • CVE-2026-129474 (CVSS 9.2) — use-after-free on PHP 8.5 and later; exploitation requires application-specific conditions. (Fixed in PHP 8.5.13, 8.6.0)
  • CVE-2026-129481 (CVSS 9.2) — use-after-free that could break session cleanup and potentially corrupt memory or crash reused PHP workers. (Fixed in PHP 8.3.37, 8.4.28, 8.5.13, 8.6.0)
  • CVE-2026-129496 (CVSS 9.2) — use-after-free allowing unauthenticated remote attacker to crash PHP workers or execute arbitrary code. (Fixed in PHP 8.2.36, 8.3.37, 8.4.28, 8.5.13, 8.6.0)
  • CVE-2026-129291 (CVSS 8.8) — use-after-free that could result in local privilege escalation; successful exploitation requires local code execution in an FPM worker plus several FPM-specific settings. (Fixed in PHP 8.2.36, 8.3.37, 8.4.28, 8.5.13, 8.6.0)

phpAfterShell (CVE-2026-126714): how interrupted session writes become RCE

Security researcher group Depthfirst has codenamed CVE-2026-126714 "phpAfterShell" and described it as a critical flaw that can allow remote arbitrary code execution on affected servers. Depthfirst explained the mechanics: when a pwrite()/ftruncate() update is interrupted, PHP can leave a malformed session file that session_start() later loads, producing "an arbitrary deserialization primitive."

Security researcher Yuhang Wu provided a concise technical picture: "Depending on where the interruption happens, part of the new Session may already have been written while bytes from the previous Session remain on disk," creating a file containing "the prefix of the new serialized data and the tail of the old one." By choosing length fields in the new prefix, an attacker can make PHP’s Session decoder interpret leftover bytes as serialized objects; when those objects are deserialized later, they can be chained with an existing PHP-native memory corruption finding to produce remote code execution.

Configurations and front ends that raise exposure

The advisory makes clear that several of the defects require non-default or uncommon setups to be exploitable, but names concrete front ends and options that do raise risk. CVE-2026-129289, for example, needs a front end that enables persistent backend connections and an application path that opens "php://input" without reading it fully. The advisory lists specific combinations where that condition exists: nginx with fastcgi_keep_conn on; Apache mod_proxy_fcgi with enablereuse=on; HAProxy FastCGI applications that retain backend connections; and LSAPI.

Other vulnerabilities depend on application behavior or combinations of PHP worker settings — for example, CVE-2026-129291’s local privilege escalation requires an affected FPM pool with catch_workers_output enabled, the epoll event backend, and the ability to manipulate worker lifetimes while retaining inherited pipe descriptors.

Fixed releases and immediate actions for operators

Patches are available in the following PHP releases: 8.2.36, 8.3.37, 8.4.28, 8.5.13, and 8.6.0. The PHP Foundation advised users running existing 8.2.x, 8.3.x, 8.4.x, and 8.5.x branches to update to the latest version for optimal protection.

For operators who cannot patch immediately, the advisory highlights a specific workaround for phpAfterShell: any application that runs an affected PHP version with file-based sessions is at risk, and it is recommended to turn off session upload progress if immediate patching is not possible.

What this means for technologists, hosting providers, and application developers

  • Technologists and security teams: prioritize upgrading to PHP 8.2.36, 8.3.37, 8.4.28, 8.5.13, or 8.6.0; audit configurations that enable persistent backend connections or non-default FPM settings.
  • Shared and managed hosting providers: review pools and defaults such as catch_workers_output, event backends, and persistent connection settings across tenant environments, since several vulnerabilities depend on those settings.
  • Application developers using file-based sessions or upload-progress features: consider turning off session upload progress until patches are deployed and inspect code paths that open php://input without fully reading it.

The vulnerabilities combine a mix of classic web-server misinterpretation, deserialization primitives, and use-after-free conditions — a reminder that small deviations from default behavior can produce outsized risk. Patches are available now; the narrow, specific mitigations listed in the advisory offer stopgaps, but the most direct path to protection is upgrading to one of the patched PHP releases.

Original story