PHPafterShell (CVE-2026-126714): Critical PHP Session RCE Fix

Updated: November 19th, 2026
4 mins read
PHPafterShell

TLDR;

  • phpAfterShell (CVE-2026-126714) is a remote code execution flaw in PHP’s file-based session storage.
  • The PHP project rates it 9.2 (Critical) on CVSS v4.0 and published patches on November 19, 2026.
  • Fixed in PHP 8.5.13, 8.4.28, 8.3.37, and 8.2.36.
  • PHP 8.1 and earlier are end of life and will not receive this fix.
  • No public report of in-the-wild exploitation at the time of this advisory.
  • Action: upgrade to the fixed release on your PHP branch and restart PHP workers.

PHP is a server-side scripting language used by a large share of production web applications. phpAfterShell (CVE-2026-126714) is a flaw in how PHP’s file-based session handler writes session data to disk. When an update is interrupted, the file can keep a mix of old and new bytes, which gives an attacker a deserialization primitive on later requests.

Combined with a gadget chain in application code, this leads to remote code execution in the PHP worker. The depthfirst research team reported the issue, and PHP disclosed it on November 19, 2026. phpAfterShell lands one week after php2shell, the last critical PHP flaw we covered.

Technical Details of CVE-2026-126714 (PHPafterShell)

The CVE-2026-126714 (PHPafterShell) sits in PHP’s file-based session storage, which PHP selects by default through session.save_handler = files. When PHP writes updated session data back to its session file it uses pwrite() followed by ftruncate(). The sequence is not atomic. If the operation is interrupted partway through, the file keeps part of the new content and part of the old content on disk.

On a later request, session_start() reads the file and runs PHP’s session deserializer over the mixed bytes. An attacker who controls part of the session payload can shape the resulting stream so the deserializer produces objects of a type the attacker chooses. The result is an arbitrary object injection primitive.

Session upload progress is the easiest trigger for the interrupt. The feature writes partial upload state into the session file while a POST is still in flight, which lets an attacker influence when and how a write is cut off. The primitive alone gives object injection. Chained with a suitable gadget in the loaded application code, it reaches remote code execution inside the PHP worker process.

The attack vector is network-based. The vendor advisory does not publish a full CVSS vector string or a CWE identifier at the time of writing.

Affected Products or Versions for CVE-2026-126714 (PHPafterShell)

The flaw affects PHP’s reference implementation on all actively supported branches when sessions are stored in files. The vendor lists specific minimum fixed versions for each supported branch. Applications that store sessions in Redis, a database, or another non-file handler are safe from this specific defect.

  • PHP 8.5 before 8.5.13 is affected. Fixed in 8.5.13.
  • PHP 8.4 before 8.4.28 is affected. Fixed in 8.4.28.
  • PHP 8.3 before 8.3.37 is affected. Fixed in 8.3.37.
  • PHP 8.2 before 8.2.36 is affected. Fixed in 8.2.36.
  • PHP 8.1 and earlier are end of life. The 7.4, 8.0, and 8.1 EOL mitigation branches disable upload progress in the callback and are safe from this flaw.
  • The October 21 releases (8.5.12, 8.4.27, 8.3.36, 8.2.35) do not contain the fix.

Detection for CVE-2026-126714 (PHPafterShell)

Start from the PHP version actually serving web traffic in production, since a repository’s declared version can differ from the deployed runtime. Then confirm the session storage configuration. A host is in scope when the runtime is on an affected version and sessions are kept in files.

  • Run php -v on each web host or container and compare the output against the fixed versions above.
  • Check php.ini for session.save_handler. A value of files, or no value set, puts the host in scope.
  • Check php.ini for session.upload_progress.enabled. A value of 1, or no value set, enables the easiest attack path.
  • Inspect container images and build pipelines for pinned PHP minor versions below the fixed releases.
  • No reliable indicators of compromise have been published at this time.

Mitigation for CVE-2026-126714

Install the fixed release for your PHP branch: 8.5.13, 8.4.28, 8.3.37, or 8.2.36. Rebuild any container images, redeploy, and confirm production is running the new version. Restart PHP workers (php-fpm, mod_php, or the SAPI in use) so every long-lived process picks up the new binary. If you run PHP 8.1 or earlier, move to a supported branch. Those versions are end of life and will not get this fix.

Workaround for PHPafterShell

If an immediate upgrade is not possible, disable the session upload progress feature and limit the untrusted data your application stores in sessions. This removes the easiest path to the flaw, so treat it as an interim measure only.

  • Set session.upload_progress.enabled = 0 in php.ini and restart PHP workers.
  • Review session contents and stop writing attacker-controlled fields into the session where possible.
  • Where feasible, switch session.save_handler to a non-file backend such as Redis or a database for the affected hosts.

How Astra Helps

We are monitoring the situation and will update this page once more information comes in. If you need help or guidance on phpAfterShell, talk to our team.

References: PHP security advisory for CVE-2026-126714 (published November 19, 2026); depthfirst disclosure.