Skip to content
RESEARCH INDEX BREACHROAD / INTELLIGENCE NOTE

CVE-2026-126714: phpAfterShell session RCE

Critical phpAfterShell abuses non-atomic PHP session writes. We explain CVE-2026-126714 mechanics, affected versions, mitigations and detection.

PUBLIC RESEARCH
AUTHOR
/ CEO Breachroad · OSCP · PNPT
PUBLISHED
20 November 2026
READING TIME
22 min read
TOPIC
Vulnerabilities and CVEs
CVE-2026-126714: phpAfterShell session RCE

Google Cloud published bulletin GCP-2026-090 on 20 November 2026 for CVE-2026-126714, a critical vulnerability named phpAfterShell. The flaw affects PHP’s default file-based session handler. When a session write is interrupted, a partially overwritten, malformed file can remain on disk. A later session_start() deserialises that state, and crafted data can allow an unauthenticated remote attacker to execute code.

This is an unusual chain because its source is not one obvious application function. It combines runtime behaviour, a non-atomic file write, abrupt worker termination and subsequent deserialisation. The primary path identified by Google is Session Upload Progress, which can write data to the session before application code executes.

Fixed releases are PHP 8.2.36, 8.3.37, 8.4.28 and 8.5.13. PHP 8.1 and the older lines named in the advisory will receive no upstream fix. Organisations therefore need to update more than a package declaration: they must establish which runtime the deployed image actually contains, whether session.upload_progress is required and where session state is stored.

What the vendor confirms about CVE-2026-126714

Google Cloud bulletin GCP-2026-090 lists these affected ranges:

  • PHP 8.5 before 8.5.13;
  • PHP 8.4 before 8.4.28;
  • PHP 8.3 before 8.3.37;
  • PHP 8.2 before 8.2.36;
  • PHP 8.1 and PHP 7.2, for which no fixed release exists.

Within Google Cloud, affected products include App Engine Standard second-generation PHP 7.2–8.5 runtimes, App Engine Flexible, Cloud Run and Cloud Run functions. That scope does not mean every application on those platforms is automatically exploitable. Runtime version, file-based sessions, reachability of a controlled-write path and the ability to interrupt a worker in the necessary state all matter.

The official notice rates the issue critical and describes unauthenticated RCE. It does not report active exploitation, identify victims or publish proof-of-concept code. The absence of those statements is not proof that no attack occurred; it defines the boundary of public evidence.

How PHP file-based sessions work

With session.save_handler = files, PHP stores session state in a file identified by a session ID. When code calls session_start(), the runtime reads and deserialises that content into $_SESSION. It writes the state again after modification.

From a reader’s perspective, a safe state update should be atomic: the new complete version replaces the old only once it is ready. Google says the vulnerable mechanism did not write atomically. If a process stopped because of a memory limit, timeout or other abrupt termination, it could leave a partially changed session file.

The next request does not inherently know that the earlier write was incomplete. session_start() attempts to interpret the state. Where an attacker controlled relevant fragments written to the session, the malformed file could be arranged so that deserialisation led to code execution.

That is the mechanism described by Google. The bulletin does not publish a ready-to-run payload, exact byte layout or reliable procedure for forcing the interruption. Analysts should not attach unverified exploit details to this CVE.

Why Session Upload Progress matters

The PHP Session Upload Progress documentation explains how PHP can record the progress of an uploaded file in $_SESSION, allowing another request to poll it.

The architectural detail is critical: upload-progress information is written to the session before application scripts execute. The documentation also states that an application-defined session handler cannot control this early write because user code has not run yet. The PHP session configuration manual describes upload progress as enabled by default and warns that client-supplied file and field names are written without application-level code validation.

An application can therefore be exposed even when its upload controller is carefully implemented. The runtime handles part of the data earlier. Google recommends:

session.upload_progress.enabled = 0

when the application does not need session-based upload progress. This mitigates the primary phpAfterShell path; it is not a replacement for updating PHP.

Attack prerequisites without overclaiming

“Unauthenticated remote RCE” is a serious impact statement, but exposure analysis should establish the real conditions. A potential path needs at least:

  • an affected PHP version;
  • the file session handler or an equivalent vulnerable path;
  • a way to deliver data that PHP writes into session state;
  • an interrupted partial write;
  • later reading of that file through session_start();
  • an execution context in which the final effect can occur.

Do not turn that list into “our WAF means we are safe.” These conditions involve runtime state and request sequencing, not a single string that a signature can always block. Equally, it would be inaccurate to claim that every PHP website has been compromised.

Google Cloud: who updates the runtime

The advisory separates several responsibility models.

Customer-managed containers

Cloud Run and custom App Engine Flexible runtimes can immediately rebuild with PHP 8.2.36, 8.3.37, 8.4.28 or 8.5.13 and redeploy. Changing a base-image tag in source is not enough if running revisions still point to an older digest.

Runtimes with automatic base-image updates

App Engine Standard second generation for PHP 8.2–8.5 and eligible Cloud Run services or Cloud Run functions are expected to receive patched runtimes through automatic updates. Google still recommends applying the Session Upload Progress mitigation immediately instead of waiting passively.

Pinned or non-automatic environments

App Engine Flexible managed runtimes, Cloud Run jobs and worker pools, first-generation Cloud Functions and deployments pinned to a patch string need rebuilding and redeployment when updated images become available.

End-of-life PHP

PHP 8.1 and older affected lines will not receive an upstream patch. Disabling upload progress and moving away from file sessions reduce exposure, but migration to a supported release is the target state. End of life also means no future security servicing, so a configuration exception does not solve the maintenance problem.

A first-hours response plan

1. Inventory versions that are actually running

Inspect the runtime inside live revisions, pods, VMs and functions. Do not rely solely on composer.json, an image tag or a pipeline declaration. Record the image digest, runtime version, platform and service owner.

2. Establish the session configuration

Verify session.save_handler, session.save_path and session.upload_progress.enabled. Determine whether the application genuinely uses progress tracking and which public endpoints accept multipart/form-data.

3. Apply the mitigation

If the feature is unnecessary, disable it, rebuild and confirm the value in the running process. Where feasible, move sessions away from the local filesystem to an external store such as Redis, Memcache or a database, as Google recommends. Test TTL, locking, failover and tenant isolation before changing production state management.

4. Upgrade and force a new revision

Deploy a fixed runtime. Terminate old instances, test scale-to-zero and restart, then verify that all traffic reaches the new digest. In a multi-region environment, one successful revision does not represent the whole fleet.

5. Preserve evidence

Before cleanup, retain logs, image metadata, administrative events and—under the organisation’s forensic procedure—copies of suspicious session files. Do not open them in tooling that might interpret their content. If host integrity is in doubt, rebuild from a trusted image rather than repairing a worker in place.

Detecting phpAfterShell

Google has not published a universal IOC set. The following are Breachroad detection hypotheses to adapt to the application:

  • bursts of uploads with unusual file or field names;
  • coincident memory-limit errors, timeouts or abrupt PHP worker exits;
  • session deserialisation errors and increased session_start() failures;
  • session files with abnormal size, modification time or structure;
  • child-process execution from a PHP worker;
  • new outbound connections from a web container or instance;
  • executable file creation in application or temporary directories;
  • mismatch between an approved image digest and a live revision.

A timeout or upload alone is not evidence of exploitation. The meaningful pattern is controlled session input, worker interruption, later session read and an abnormal process or network effect.

Redis is not a magic fix

Moving away from files removes the local path at issue but creates a new dependency. A session store must require authentication, remain off the public Internet, encrypt transport, separate environments and enforce deliberate TTLs. Key design should prevent collisions across applications and tenants.

Failure behaviour also matters. If an application silently falls back to files when Redis becomes unavailable, the mitigation can disappear at the worst time. The fallback should fail safely and alert rather than changing the trust model without visibility.

Do not confuse CVE-2026-126714 with other PHP flaws

The phpAfterShell name resembles other PHP issues disclosed in 2026, including earlier flaws described as PHP2Shell. These are separate CVEs with different causes. CVE-2026-126714 concerns non-atomic file-session writes and later deserialisation. Do not copy version ranges, mitigations or indicators from another advisory.

Nor is session.upload_progress.enabled = 0 a complete runtime fix. Google explicitly recommends an upgrade or session mitigations; the mature response validates both layers.

Source facts versus Breachroad conclusions

Google and PHP confirm: affected versions, fixed releases, non-atomic session-file writes, possible partial state after abrupt worker termination, deserialisation during session_start(), unauthenticated RCE, the role of Session Upload Progress and recommended mitigations.

Public sources do not confirm: exploitation in the wild, victims, a universal payload or that every PHP application exposes the chain.

Breachroad conclusions include: the triage order, detection hypotheses, evidence-handling recommendations and external-store tests. They follow the confirmed mechanism without pretending to document undisclosed attacks.

CVE-2026-126714 demonstrates that application security includes runtime code executed before an application’s controller. A mature vulnerability-management process must cover runtimes, base images and configuration, while impact analysis should apply the principles in our insecure deserialisation guide.

Cybersecurity training for technical teams helps turn an advisory into a controlled production change. A cloud and infrastructure security assessment can examine runtimes, image pipelines, sessions, secrets and Cloud Run or App Engine telemetry.

SHARE / COPY