Vulnerability DatabaseCVE-2026-126714

CVE-2026-126714: 
PHP vulnerability analysis and mitigation

Overview

CVE-2026-126714 is a critical remote code execution vulnerability in PHP's default file-based session handler, informally tracked under the name "PHPAfterShell." The flaw arises because the ps_files_write() function overwrites session files in-place without first truncating them, allowing a partially written file to contain a mix of old and new session data that can be deserialized as attacker-controlled objects. Affected versions include PHP 8.2.x before 8.2.36, 8.3.x before 8.3.37, 8.4.x before 8.4.28, and 8.5.x before 8.5.13. It was disclosed on November 19, 2026, with a CVSS v4.0 base score of 9.2 (Critical) (GitHub Advisory).

Technical details

The root cause is a Time-of-Check Time-of-Use (TOCTOU) race condition combined with improper synchronization (CWE-367, CWE-662) in PHP's ext-session files save handler. When a session write is interrupted mid-operation — for example, via a hard memory-limit failure in a threaded PHP build or by timing a multipart upload via session upload progress — the session file can contain a prefix of the new session data followed by a suffix of the old session data. PHP's session decoder then deserializes this hybrid file, and bytes that were originally part of an ordinary string in the old session can be reinterpreted as serialized object data. If the application contains a suitable gadget chain (e.g., Guzzle, Monolog), this deserialization of attacker-controlled objects can lead to arbitrary code execution. The file lock used during writes prevents concurrent access but does not guarantee atomicity of the write itself (GitHub Advisory).

Impact

Successful exploitation allows an unauthenticated remote attacker to execute arbitrary PHP code with the privileges of the PHP worker process, resulting in full confidentiality, integrity, and availability compromise of the affected system. An attacker can read sensitive data, modify application files, deploy web shells, or pivot laterally within the network. Session data corruption is also possible even without a gadget chain, potentially disrupting application availability. The scope of impact depends on the PHP worker's privileges and the presence of a suitable deserialization gadget chain in the application (GitHub Advisory).

Exploitability

As of the disclosure date (November 19, 2026), no public proof-of-concept exploit code has been confirmed, and there is no evidence of active in-the-wild exploitation (GitHub Advisory). The EPSS score is reported at 0.0, reflecting the early stage of public awareness. The vulnerability is not currently listed in the CISA Known Exploited Vulnerabilities (KEV) catalog. Exploitation requires specific preconditions: attacker influence over session data, the ability to interrupt a session write at a precise moment, and the presence of a deserialization gadget chain in the target application, making opportunistic mass exploitation less trivial than a straightforward injection flaw.

Exploitation steps

  1. Reconnaissance: Identify PHP applications using the default files session save handler (the PHP default) on versions 8.2.x < 8.2.36, 8.3.x < 8.3.37, 8.4.x < 8.4.28, or 8.5.x < 8.5.13. Confirm that session upload progress is enabled (session.upload_progress.enabled = 1, which is the default).
  2. Gadget chain identification: Analyze the target application's dependencies (e.g., Composer vendor/ directory) for known PHP deserialization gadget chains such as those in Guzzle or Monolog that can trigger code execution upon object instantiation.
  3. Craft malicious session payload: Construct a serialized PHP object payload representing the gadget chain's entry point. The payload must be formatted so that, when appended to a partial new session prefix, it forms a valid serialized object sequence.
  4. Influence session data: Initiate a multipart file upload to the target application. PHP's session upload progress feature writes attacker-controlled data (the upload key name) into the session file during the upload. Alternatively, store a large attacker-controlled string in the session through any application input that persists data to the session.
  5. Interrupt the session write: In a threaded PHP-FPM environment, trigger a memory-limit exhaustion in a concurrent thread to cause the session write to be interrupted mid-operation. Timing the interruption requires repeated attempts to land at a point where the old session suffix containing the crafted object data remains in the file.
  6. Trigger deserialization: Send a new request that calls session_start() on the corrupted session file. PHP deserializes the hybrid file, reconstructing the attacker-controlled object and invoking its __wakeup() or __destruct() method via the gadget chain.
  7. Achieve code execution: The gadget chain executes arbitrary PHP code (e.g., spawning a reverse shell, writing a web shell, or exfiltrating data) with the privileges of the PHP worker process (GitHub Advisory).

Indicators of compromise

  • Network: Repeated multipart POST requests to the same endpoint with varying upload key names; unusually large or malformed Content-Type: multipart/form-data requests; outbound connections from the web server to unexpected external IPs or ports following session activity.
  • File System: Session files in /tmp/ or the configured session.save_path with anomalous sizes (larger than expected or containing binary/non-printable data); unexpected web shells or PHP files created in the web root or upload directories; new cron jobs or scheduled tasks owned by the web server user.
  • Logs: PHP error logs showing deserialization errors or unexpected class instantiation warnings; access logs with high-frequency requests to the same endpoint with PHPSESSID cookies; PHP-FPM logs showing worker crashes or memory limit errors coinciding with session write activity.
  • Process: Unusual child processes spawned by the PHP-FPM worker (e.g., bash, curl, wget, python, nc); network connections initiated by the PHP worker process to non-standard destinations (GitHub Advisory).

Mitigation and workarounds

Upgrade PHP to the patched versions: 8.2.36, 8.3.37, 8.4.28, or 8.5.13, which fix the issue by truncating the session file to zero before writing replacement data. After upgrading, restart PHP-FPM, Apache, or the process running PHP. As a temporary workaround prior to upgrading, disable session upload progress by setting session.upload_progress.enabled = 0 in php.ini and in every PHP-FPM pool configuration file (not via ini_set() in application code), then restart workers — note this closes one input path but does not protect applications that independently store attacker-controlled data in sessions. Additionally, consider using an atomic session storage backend (e.g., Redis, Memcached, or a database) as an alternative to the default files handler, and audit application code to minimize untrusted data stored in sessions (GitHub Advisory).

Community reactions

The vulnerability received significant media coverage upon disclosure, with outlets including The Hacker News, BleepingComputer, SecurityWeek, and Infosecurity Magazine reporting on the PHP November 2026 security release that addressed this and other critical flaws. Security researchers and community members on X (Twitter) and Mastodon highlighted the severity of the session handler flaw, with accounts such as @IntCyberDigest and @DarkWebInformer amplifying the disclosure. Cloudflare Radar published a Zero Wire post specifically covering the "PHPAfterShell" nickname for this vulnerability. Checkmarx noted the complexity of exploitation while cautioning organizations to patch promptly. The Roots.io and Patchstack communities specifically addressed implications for WordPress and Joomla deployments running on PHP. Ox Security and DepthFirst published dedicated research posts analyzing the gadget chain exploitation potential (GitHub Advisory).

Additional resources

Linux Distribution fix status

Fix availability across major Linux distributions and their releases.

Debian

Fixed

bookworm

php8.2: 8.2.36-1~deb12u1

Fixed

sid

php8.4: 8.4.28-2

Fixed

trixie

php8.4: 8.4.28-1~deb13u1

Fixed

Ubuntu

Fixed

bionic (esm-infra)

php7.2: 7.2.24-0ubuntu0.18.04.17+esm15

Fixed

devel

php8.5

Affected

focal (esm-infra)

php7.4: 7.4.3-4ubuntu2.29+esm6

Fixed

jammy

php8.1: 8.1.2-1ubuntu2.29

Fixed

noble

php8.3: 8.3.6-0ubuntu0.24.04.14

Fixed

resolute

php8.5: 8.5.4-0ubuntu1.6

Fixed

trusty (esm-infra-legacy)

php5: 5.5.9+dfsg-1ubuntu4.29+esm19

Fixed

xenial (esm-infra-legacy)

php7.0: 7.0.33-0ubuntu0.16.04.16+esm23

Fixed

RHEL / CentOS

Fixed

RHEL 8

:appstream:php-0:7.4-8100020261119125714.f7998665.src

Fixed

RHEL 9

:appstream:php-0:8.2-9080020261120141350.9.src

Fixed

RHEL 10

php8.4-0:8.4.28-1.el10_2.src

Fixed

Alpine

Fixed

edge

php83: 8.3.37-r0, 8.5.13-r0

Fixed

Source: This report was generated using AI

Related PHP vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

GHSA-r66h-vhqv-h27fHIGH8.3
  • PHP logoPHP
  • bubka/2fauth
NoYesNov 23, 2026
GHSA-qjrw-7726-v758HIGH7.1
  • PHP logoPHP
  • code16/sharp
NoYesNov 23, 2026
GHSA-835v-w4x6-rh9jMEDIUM6.5
  • PHP logoPHP
  • bubka/2fauth
NoYesNov 23, 2026
GHSA-c4w6-v59v-38v5LOWN/A
  • PHP logoPHP
  • yiisoft/validator
NoYesNov 23, 2026
GHSA-2gm6-xjf3-cqmmHIGHN/A
  • PHP logoPHP
  • exceedone/exment
NoYesNov 23, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Additional Wiz resources

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management