ShieldPack SHIELD PACK
From 1401 onwards.

Where would you like to start?

Services, updates, and ways to contact us, all in one place

Pricing and orders →

Use the bot or chat with us—whichever you prefer

ShieldPack posts

PHP Fixes 7 Critical Flaws, Including Bugs That Could Allow Remote Code Execution

About 4 min read

The PHP Foundation has issued a set of security updates that close seven critical vulnerabilities, including at least one flaw that could let an attacker execute arbitrary code on a server running PHP. The most serious of these bugs, identified as CVE‑2026‑126714 and nicknamed “phpAfterShell,” can be triggered when a session file is only partially written, creating a malformed session that PHP later deserialises and runs as code. The new patches are now available for all actively supported PHP branches – 8.2, 8.3, 8.4 and 8.5 – and users are urged to upgrade immediately.
The vulnerabilities were first disclosed in an advance notice from the PHP project maintainers, who warned that the issues affect every supported PHP version when certain non‑default configurations or uncommon deployment patterns are in use. The notice explained that exploitation could lead to a range of severe outcomes: remote code execution (RCE), session corruption, denial‑of‑service (DoS), memory corruption and local privilege escalation. Because the bugs are tied to how PHP handles file‑based sessions, any application that relies on the default session storage mechanism is potentially at risk.
The core of the most critical flaw, CVE‑2026‑126714, revolves around the interaction between PHP’s session handling functions and low‑level file operations such as pwrite() and ftruncate(). When a write to a session file is interrupted – either because the PHP worker process crashes during the write or because it terminates after the write but before the old session data is fully removed – the resulting file can contain a mixture of the new session’s serialized prefix and the tail of the previous session’s data. Security researcher Yuhang Wu described the situation as a “spliced” session file where the new length fields can be crafted to make PHP’s session decoder treat leftover bytes as distinct session entries and serialized objects. No code needs to be executed during the upload‑progress callback; the attacker simply leaves the crafted bytes on disk and waits for the application to invoke session_start(), at which point PHP reads the corrupted session and deserialises the malicious objects.
When the malformed session is later processed, PHP may interpret the injected data as a valid object belonging to a PHP‑native class. By chaining this deserialization primitive with another memory‑corruption vulnerability already present in the same class, an attacker can achieve full remote code execution on the affected server. The exploit works specifically with file‑based session storage; environments that use alternative session handlers (such as Redis or Memcached) are not directly vulnerable to this particular vector.
PHP Fixes 7 Critical Flaws, Including Bugs That Could Allow Remote Code Execution
The impact of the flaw is broad because file‑based sessions are the default in most PHP installations. Any web application that stores session data on the local filesystem – from small personal blogs to large e‑commerce platforms – could be compromised if an attacker can trigger the write interruption and then supply a crafted session payload. The PHP Foundation recommends that administrators who cannot apply the patches immediately disable the session upload‑progress feature, which reduces the attack surface by preventing the specific write‑interruption scenario.
In response to the disclosures, the PHP Foundation has released patched versions for all current branches. Users of PHP 8.2.x, 8.3.x, 8.4.x and 8.5.x should download and install the latest releases, which incorporate fixes for the seven identified vulnerabilities. The updates modify the session handling code to ensure that partially written session files are either safely discarded or correctly validated before deserialization, eliminating the opportunity for an attacker to inject malicious serialized objects.
For developers and system administrators reading this report, the practical steps are clear: verify the exact PHP version running on each server, apply the new releases without delay, and audit any custom session handling logic that might bypass the default safeguards. If an immediate upgrade is not feasible, disabling session upload progress in php.ini (setting session.upload_progress.enabled to 0) provides a temporary mitigation. Organizations should also review their monitoring and logging to detect any unexpected session file modifications, as such activity could indicate an attempted exploitation.
The broader significance of these patches extends beyond the immediate PHP ecosystem. The vulnerabilities illustrate how seemingly innocuous features – like session upload progress – can become attack vectors when combined with low‑level file‑system operations. They also underscore the importance of keeping server‑side runtimes up to date, especially for widely deployed languages such as PHP that power a large fraction of the web. By addressing the flaws promptly, the PHP Foundation helps protect the integrity of countless web applications and reinforces the security posture of the open‑source software supply chain.

Source: The Hacker News · Cybersecurity

ShieldPack media