RC RANDOM CHAOS

phpAfterShell: Incomplete Session Writes Enable PHP Code Execution

· via The Hacker News

Original source

phpAfterShell Explained: How Hackers Could Turn a PHP Session Flaw Into Code Execution

The Hacker News →

A vulnerability in PHP’s default file-based session storage allows attackers to inject malicious objects by exploiting incomplete writes to session files. The flaw, CVE-2026-126714 (CVSS 9.2), was discovered by Depthfirst and affects servers using PHP’s file handler for session storage. By interrupting a write operation at the right moment—such as through a PHP memory limit failure that terminates the process mid-write—an attacker can craft a corrupted session file where old data and new data merge to form a serialized object the attacker controls. When the application next calls session_start(), the malicious object loads into memory.

Code execution requires a suitable gadget chain in the application or a second vulnerability that the researchers leveraged in their proof-of-concept. The researchers demonstrated one attack vector through PHP’s upload progress feature, which writes progress data to the session before application code runs. This path does not require an upload page; any page that opens the session can be targeted. The same technique also allows attackers to modify legitimate session values like authentication status or CSRF tokens.

Today’s PHP releases include the fix, which empties the session file before each write and aborts if that step fails. However, servers updated on October 21—which patched the related PHP2Shell flaws—do not yet include this fix and remain vulnerable. Administrators can temporarily disable upload progress via configuration, though this only blocks one attack vector. The recommended fix is to upgrade to patched releases or switch to non-file-based session storage. Linux distributions may include the patch without updating the version number, so administrators should verify their fixes independent of version strings.

Read the full article

Continue reading at The Hacker News →

This is an AI-generated summary. Read the original for the full story.