Phpaftershell Cve 2026 126714 Php Session Rce

phpAfterShell CVE-2026-126714: PHP Session RCE and Fix

phpAfterShell CVE-2026-126714: PHP Session RCE and Fix

CYBERSECURITY | VULNERABILITY ANALYSIS | TECHOWL SHIELD

A controlled lab reproduction of interrupted session writes, object deserialization and the November 2026 PHP security fix

By TechOwl Shield Threat Intelligence Team | Published: 25 November 2026 | Version 1.1 | TLP:CLEAR | 8–10 min read

A critical PHP session-handler flaw disclosed on 19 November 2026 (CVSS 4.0: 9.2) can leave a session file containing bytes from two different writes. If an attacker can influence session data and interrupt a write at a useful point, PHP may later deserialize attacker-influenced objects. The discoverer chained this into remote code execution (RCE) in the PHP worker context. A third-party proof-of-concept claiming a remote exploit was published on 21 November 2026.

TechOwl Shield reproduced the underlying file-corruption condition in an isolated Docker lab using vulnerable PHP 8.2.35 and the fixed PHP 8.2.36 build. The demonstrations below are controlled fault-injection tests using an inert object; they validate the deserialization path, not a weaponized RCE exploit.

Key judgments

  • Vulnerability: CVE-2026-126714 (GHSA-fm2m-fjf5-v3cp) affects PHP’s default file-based session handler and is rated Critical (CVSS 4.0: 9.2). It was discovered and reported by depthfirst. Confidence: high (PHP advisory and multiple vendors).

  • Mechanism: an interrupted replacement write can leave a new-data prefix and an old-data suffix in one session file, which PHP later decodes. Confidence: high.

  • Exposure: PHP branches before 8.2.36, 8.3.37, 8.4.28 and 8.5.13 are affected. The end-of-life 5.6 to 8.1 lines contain the same defect and have no upstream fix. Verify vendor backports for packaged builds. Confidence: high.

  • Exploitability: the discoverer reports an unauthenticated path using session.upload_progress chained to memory corruption in a PHP-native class, while other vendor analyses describe a dependency on application gadget chains. Treat internet-facing PHP as exploitable until patched. Confidence: medium (sources differ).

  • Exploitation status: no in-the-wild exploitation had been reported and the CVE was not listed in CISA’s KEV catalog in the sources reviewed (latest dated 20 to 21 November 2026), but a third-party public proof-of-concept appeared on 21 November 2026. Confidence: medium (time-sensitive; reflects sources reviewed up to 21 November 2026).

  • Fix: upgrade to the fixed release for your branch, restart long-running PHP processes and invalidate sessions where compromise is suspected. Confidence: high.

What is CVE-2026-126714?

The PHP advisory describes a flaw in the file-based session save handler (session.save_handler = files, the PHP default). During a session update, the vulnerable implementation writes the new serialized data into the existing file and clears the old contents only when the new data is shorter. If the write stops part-way, the file can hold a prefix of the new session followed by a suffix of the old one. The file lock keeps other session operations away during the write but does not make an interrupted write atomic.

PHP’s session decoding machinery may interpret the combined data in an unexpected way.

The advisory rates the issue Critical with CVSS 4.0 9.2. Exploitation requires attacker influence over session contents and an interruption at a useful point in the write. Sources differ on what turns this into code execution: the discoverer (depthfirst) chained the primitive with memory corruption in a PHP-native class, while other vendor analyses describe a dependency on a suitable application gadget chain. Defenders should plan for either case. The weakness is classified as CWE-502 (deserialization of untrusted data) by some sources and as CWE-367 (time-of-check to time-of-use race condition) by others.

The exact route to influence and interrupt a write depends on the deployment. The path researched by depthfirst uses session.upload_progress during an unauthenticated multipart upload request, and it is the primary known path. The PHP advisory describes upload progress as one way to influence session contents, so disabling it should not be treated as a complete fix.

Exploitation status and intelligence gaps

  • Public proof-of-concept: a third-party repository published on 21 November 2026 claims an unauthenticated remote exploit against vulnerable PHP 8.4.27 test targets. TechOwl Shield has not tested it and does not link to it. Its existence raises the likelihood of opportunistic scanning.

  • In-the-wild exploitation: Wiz (19 November) and NetSPI (20 November) reported no exploitation in the wild, and CISA’s KEV catalog did not list the CVE as of 20 November 2026. No later change was found in the sources reviewed.

  • Related PHP issues: the same 19 November release fixed 17 CVEs, seven of them rated Critical, among them CVE-2026-115560 (session serializer mismatch) and CVE-2026-129481 (use-after-free on interrupted session shutdown, described by Wiz as an incomplete fix for October’s PHP2Shell). Upgrading to the fixed releases addresses all of them.

  • Precedent: PHP2Shell (CVE-2026-109618 and CVE-2026-109619) was added to CISA’s Known Exploited Vulnerabilities catalog in October 2026 after in-the-wild exploitation, which shows that attackers are actively targeting PHP session and upload handling.

  • Attribution: no threat actor was linked to exploitation of CVE-2026-126714 in the sources reviewed.

  • Open questions: whether an application gadget chain is required in practice, how many internet-facing deployments run the default configuration, and whether in-the-wild exploitation has begun.

Affected and fixed PHP versions

PHP branchAffected versionsFixed release
8.2 8.2.0–8.2.35 8.2.36
8.3 8.3.0–8.3.36 8.3.37
8.4 8.4.0–8.4.27 8.4.28
8.5 8.5.0–8.5.12 8.5.13
5.6 to 8.1 (end of life) Same defect present in the final releases; no upstream fix No upstream fix: migrate to a supported branch or obtain a vendor backport

PHP published the fixed 8.2, 8.3, 8.4 and 8.5 releases on 19 November 2026, and PHP 8.6.0 was released the same day with the same security fixes. Package versions vary by vendor: for example, Amazon Linux 2023 shipped fixed php8.4 and php8.5 packages on the same date, while the Amazon Linux 2 core php package is listed as “No Fix Planned”. Consult your vendor advisory rather than assuming every package follows the upstream version numbers.

How the flaw works

  1. An application stores session data using PHP’s files handler.

  2. An update begins writing replacement serialized data into an existing session file.

  3. The process or write is interrupted before the old tail is removed.

  4. The resulting file contains a mixture of new and old bytes.

  5. On a later request, PHP reads and decodes the hybrid session file.

  6. If the combined bytes form attacker-influenced serialized data, PHP may instantiate objects. Depending on the classes available (an application gadget chain or, according to the discoverer, a memory-corruption primitive in a PHP-native class), this can lead to code execution.

TechOwl Shield lab: setup and validation

We used a deliberately isolated Docker Compose environment with two side-by-side Apache/PHP containers. The vulnerable stack used PHP 8.2.35 and the patched stack used PHP 8.2.36.

Both were configured with the files session handler and PHP serialization handler; the lab used localhost-bound ports and an internal Docker network. The environment was intended for controlled reproduction, not exposure to the internet.

ComponentVulnerable stackPatched stack
PHP image php:8.2.35-apache php:8.2.36-apache
Container phpaftershell-vulnerable phpaftershell-patched
Host port 127.0.0.1:8081 127.0.0.1:8082
Session handler files files
Serialization handler php php
Network Internal lab network Internal lab network

Figure 1. Diagnostics output confirming the vulnerable stack (PHP 8.2.35, files session handler).

Proof-of-concept results

1. Session file format inspection

The first demonstration inspected the on-disk PHP session representation. It confirmed that session entries are stored as key/value segments without a whole-file integrity envelope or checksum. This matters because a reader has no cryptographic or structural marker proving that all bytes originated from one completed write.

Figure 2. PoC-1: session-file format and byte-level segmentation.

2. Controlled interrupted-write reproduction

The second demonstration created a legitimate baseline session file, wrote only a short prefix of replacement data and intentionally omitted the final truncation step. The resulting file retained trailing bytes from the original content. This is a deterministic model of the interrupted-write state; it does not claim to reproduce every operating-system scheduling or memory-pressure condition.

Figure 3. PoC-2: interrupted write leaves a hybrid 44-byte session file.

3. Deserialization demonstration

The third demonstration placed a harmless demonstration object in the test session data and observed PHP’s decoding behaviour when the hybrid file was loaded. The object was inert: the test did not execute a command, deploy a web shell, establish persistence or demonstrate a working gadget chain.

The result confirms the relevant deserialization behaviour under the lab conditions. A working exploit would additionally depend on the exploit chain described in the exploitation status section above.

Figure 4. PoC-3: inert test object and session_decode() result for this run.

What the lab proves—and what it does not

Validated in this labNot demonstrated by this lab
Session file format and absence of whole-file integrity protection A weaponized exploit against a real application
A controlled hybrid file created by partial overwrite simulation Reliable remote triggering across arbitrary PHP deployments
Deserialization of an inert demonstration object in the test case Execution of OS commands, persistence or a live gadget chain
A side-by-side version comparison using PHP 8.2.35 and 8.2.36 A universal claim that all PHP configurations are exploitable

The upstream advisory describes the fix as truncating the session file to zero before writing the replacement and stopping the write if truncation fails. A cut-off write can still lose session data, but it can no longer leave old data behind. This lab used a deterministic simulation of the interrupted write; third-party research reports interrupting the write through memory pressure, which this lab did not reproduce.

MITRE ATT&CK mapping

Analyst mapping based on the described attack chain; no technique has been observed in a confirmed campaign.

  • T1190 Exploit Public-Facing Application: crafted multipart requests to a vulnerable PHP application.

  • T1505.003 Server Software Component: Web Shell: a likely post-exploitation step.

  • T1059.004 Command and Scripting Interpreter: Unix Shell: a PHP worker spawning a shell.

Detection and threat hunting

Treat the following as investigation leads, not standalone proof of exploitation. Tune them against normal upload and session activity before deploying them in production.

  • Review unusual multipart POST bursts containing the PHP_SESSION_UPLOAD_PROGRESS field, especially when correlated with one session identifier and abnormal request volume. Standard web access logs do not record multipart field names, so this requires WAF, reverse-proxy or full-request inspection.

  • Correlate PHP worker termination, OOM-killer events and process crashes with session anomalies and web access logs.

  • Look for PHP worker processes spawning shells or unexpected interpreters, unusual outbound connections, new PHP files in web roots, and unexpected writes in upload/cache directories.

  • Review PHP logs for session_decode() failures, “Failed to decode session object” warnings, unserialize() warnings and unexpected class-instantiation behaviour.

  • Compare session-file sizes and decoded keys against application baselines; preserve suspicious files before cleanup.

Example hunting queries

Verify PHP runtime and session settings (Linux)

php -v
php -i | grep -E "session.save_handler|session.serialize_handler|session.upload_progress.enabled"

Correlate OOM events with PHP worker activity (Linux)

journalctl -k --since "24 hours ago" | grep -Ei "out of memory|killed process|php-fpm|apache"

Splunk-style query (tune fields and thresholds)

sourcetype=web_access method=POST "PHP_SESSION_UPLOAD_PROGRESS"
| stats count by src_ip, session_cookie
| where count > 20

The query assumes request-body or WAF logging that records the field name, and the threshold is illustrative only. Tune it against normal upload activity before alerting. The Sigma rule below is experimental and should not be labelled production-ready without testing against representative logs.

Example Sigma-style rule (experimental)

This generic rule flags a web server or PHP-FPM process starting a shell, a common post-exploitation signal. It is a starting point: validate it against representative logs, exclude known-good applications and tune the level before alerting on it in production.

title: Web Server or PHP-FPM Worker Spawning a Shell
id: cac67c07-2fa6-4315-9bbe-129f41a1a976
status: experimental
description: Hunting lead for post-exploitation of PHP applications (not specific to CVE-2026-126714)
references:
- https://github.com/php/php-src/security/advisories/GHSA-fm2m-fjf5-v3cp
author: TechOwl Shield Threat Intelligence Team
date: 2026/11/25
logsource:
category: process_creation
product: linux
detection:
selection_parent:
ParentImage|contains:
- php-fpm
- apache2
- httpd
selection_child:
Image|endswith:
- /sh
- /bash
- /dash
condition: selection_parent and selection_child
falsepositives:
- Applications that legitimately call exec() or shell_exec() (image tools, mail, backups)
level: medium

Remediation: what PHP teams should do

  1. Upgrade to the fixed release for the deployed branch: PHP 8.2.36, 8.3.37, 8.4.28 or 8.5.13. Confirm distribution backports through the vendor advisory and package changelog.

  2. Restart PHP-FPM, Apache and other long-running PHP processes so they load the patched runtime. Rebuild containers from patched base images and update CI/CD templates.

  3. If immediate patching is blocked, disable session.upload_progress.enabled (it is on by default) when it is not needed, and limit untrusted data stored in sessions. Wiz describes this as mitigating the primary attack path, while Cisco lists no workaround for its products, so treat it as risk reduction and not a substitute for patching.

  4. Assess whether session data or session stores may have been exposed. Where compromise is suspected, preserve logs and relevant session files, contain affected systems, rotate application secrets and invalidate affected sessions.

  5. Add PHP runtime/version checks to asset inventory and CI/CD scanning. Pin container images to maintained, patched releases and monitor vendor security notices.

  6. Where an upgrade cannot be done quickly, consider moving PHP sessions to a non-file back end such as Redis or a database, because other session storage back ends are not affected by this file-write defect. Test first, and note this does not address the other vulnerabilities fixed in the November release.

Example fix commands

Adjust package and service names to your distribution, repository and PHP branch. These examples are illustrative; test them in staging first.

1. Check the running version and whether your vendor backported the fix

php -v
# Debian/Ubuntu: look for the CVE in the package changelog
apt changelog php8.2-cli | grep -i "CVE-2026-126714"
# RHEL/Fedora family
rpm -q --changelog php-common | grep -i "CVE-2026-126714"

An empty grep result does not prove a host is unpatched: vendors may reference the GHSA ID or describe the fix differently. Compare the installed package version with the vendor advisory.

2. Upgrade and restart long-running processes

# Debian/Ubuntu
sudo apt-get update && sudo apt-get install --only-upgrade php8.2-cli php8.2-fpm
sudo systemctl restart php8.2-fpm apache2
# RHEL/Fedora family
sudo dnf upgrade "php*"
sudo systemctl restart php-fpm httpd

3. Rebuild containers from a patched base image

# Dockerfile: pin a fixed release
FROM php:8.2.36-apache
# Rebuild with fresh base layers and recreate running containers
docker compose build --pull --no-cache
docker compose up -d --force-recreate

4. Temporary mitigation if patching is delayed (php.ini or a conf.d override)

; Removes one input path only. It is not a substitute for patching.
session.upload_progress.enabled = 0

Restart warning: a restart interrupts in-flight requests, so schedule a maintenance window or drain traffic first. Upgrading a package does not change workers already running in memory, so confirm the new version with php -v and check process start times (for example, ps -o lstart,cmd -C php-fpm8.2) after the restart.

Compliance touchpoints for Indian organisations

If you operate in India, suspected exploitation can also trigger regulatory obligations. Use the points below as a starting checklist and confirm applicability with your compliance or legal team; this is general information, not legal advice.

  • CERT-In Directions (28 April 2022): Report specified cyber incidents to CERT-In within six hours of noticing them, and keep ICT system logs for a rolling 180 days within Indian jurisdiction. Preserve web server, PHP and operating-system logs accordingly.

  • DPDP Act 2023 and DPDP Rules 2025: If personal data is affected, the DPDP Rules, 2025 (notified 13 November 2025) require intimation to the Data Protection Board without delay, a detailed report within 72 hours, and notice to affected individuals. Commencement is phased: the Board-related provisions took effect on 13 November 2025, while most operative obligations, including breach intimation, are scheduled to commence on 13 May 2027. Confirm with your legal team which provisions apply to your organisation now.

  • Sector regulators: RBI-, SEBI- and IRDAI-regulated entities have their own incident-reporting channels and timelines in addition to CERT-In.

  • PCI DSS v4.x: Where cardholder data is in scope, Requirement 6.3.3 expects critical and high-risk security patches to be installed within one month of release.

How TechOwl Shield helps

TechOwl Shield’s external attack-surface visibility, vulnerability assessment and penetration testing, and managed security monitoring can help organisations identify exposed PHP services, prioritise vulnerable assets, validate remediation and investigate suspicious server activity. These services complement—not replace—vendor patching, runtime restarts and an organisation’s incident-response process.

Frequently asked questions

1. Does CVE-2026-126714 always require session.upload_progress?

No. The PHP advisory describes upload progress as one way to influence session contents. It is the primary path in the discoverer’s research and in public proof-of-concept code, but other application-controlled session data may also be relevant.

2. Does disabling upload progress fully fix the issue?

No. It removes one possible input path, but the recommended fix is to upgrade to a patched PHP release.

3. Does the lab demonstrate remote code execution?

No. It demonstrates controlled file corruption and deserialization of an inert object. It does not execute commands or use an application gadget chain.

4. Is CVE-2026-126714 being exploited in the wild?

No in-the-wild exploitation had been publicly reported in the sources we reviewed (latest dated 21 November 2026), and CISA’s KEV catalog did not list the CVE as of 20 November 2026. A third-party proof-of-concept was published on 21 November 2026, so treat patching as urgent.

5. Are PHP 8.1 and older versions affected?

Yes. The same defect is present in the final releases of the end-of-life 5.6 to 8.1 lines, and there is no upstream fix. Migrate to a supported branch or obtain a vendor backport.

6. Which PHP versions should be installed?

Use 8.2.36, 8.3.37, 8.4.28 or 8.5.13 for the corresponding branches, subject to vendor backport verification.

7. Do I need to restart PHP after upgrading?

Yes. Restart PHP-FPM/Apache and other long-running PHP workers, and recreate containers from updated images.

References and further reading

  1. PHP source advisory GHSA-fm2m-fjf5-v3cp

  2. depthfirst research: phpAfterShell, from interrupted session writes to remote code execution

  3. Wiz: phpAfterShell and critical PHP RCE vulnerabilities

  4. NetSPI: phpAfterShell and critical PHP vulnerabilities

  5. SOCRadar: phpAfterShell slips past the PHP2Shell patch

  6. Cisco Security Advisory: Vulnerability in PHP Affecting Cisco Products, November 2026

  7. Amazon Linux Security Center: CVE-2026-126714

  8. BleepingComputer: CISA confirms PHP2Shell vulnerabilities exploited in attacks

  9. PHP 2026 release archive

  10. PHP downloads and release packages

  11. PHP supported versions

  12. AWS Security Bulletin: PHP Foundation Security Releases, 19 November 2026

  13. Semgrep: PHP runtime vulnerabilities, November 2026

  14. MITRE CWE-502: Deserialization of Untrusted Data

  15. MITRE CWE-367: Time-of-check Time-of-use (TOCTOU) Race Condition

  16. OWASP Deserialization Cheat Sheet

  17. MITRE ATT&CK Enterprise Matrix

  18. CISA Known Exploited Vulnerabilities Catalog

  19. Hogan Lovells: India’s DPDP Act brought into force (phased commencement)

Evidence and sources: this article was updated after the 19 November 2026 disclosure. It combines TechOwl Shield’s lab observations with the linked upstream and vendor references. The screenshots are original lab outputs, not screenshots of exploitation in the wild. Threat-status statements reflect sources reviewed up to 21 November 2026 and are time-sensitive.

Disclaimer: The demonstrations were performed in an isolated, authorised lab. No production systems were targeted. The PoCs are controlled fault-injection and inert-object demonstrations, not weaponized exploits.

TechOwl Shield products and resources

Explore TechOwl Shield’s external attack-surface visibility, vulnerability assessment and penetration testing, and managed security monitoring services, along with further security research and resources, at https://www.techowlshield.com.