phpAfterShell

depthfirst

5 min read Original article ↗

TL;DR

PHP has just released a fix for CVE-2026-126714 (CVSS v4.0: 9.2), a critical vulnerability we discovered in the interaction between upload progress and PHP’s file-based session handler. If a pwrite()/ftruncate() update is interrupted, PHP may leave behind a malformed session file that is later loaded by session_start(), yielding an arbitrary deserialization primitive. Chained with another of our PHP-native deserialization-to-RCE findings, this leads directly to remote code execution.

Any application running an affected PHP version with file-based sessions is exposed until PHP is upgraded.

Why it matters:

  • PHP powers 68% of websites with a known server-side language (W3Techs).
  • The flaw is in PHP itself, not in any one application or framework.
  • The outcome is remote code execution.

Security impact

What is affected

The vulnerability lives in PHP’s session handling with file-based storage, which is the default (session.save_handler = files).

  • PHP 8.5 < 8.5.13.
  • PHP 8.4 < 8.4.28.
  • PHP 8.3 < 8.3.37.
  • PHP 8.2 < 8.2.36.
  • PHP 8.1 and earlier are end-of-life. The official 7.4, 8.0, and 8.1 EOL mitigation branches disable upload progress in the callback and are not affected.

The October 21 PHP releases (8.5.12, 8.4.27, 8.3.36, 8.2.35) do not contain the fix.

Applications that store sessions in Redis, a database, or another non-file handler are not affected by this specific defect. The full evaluation is in the PHP security advisory.

Recommended action: Upgrade

If you run an affected version, install the fixed release for your branch. Rebuild any container images, redeploy, and confirm production is running the new version.

If you runUpgrade to
PHP 8.5 < 8.5.138.5.13
PHP 8.4 < 8.4.288.4.28
PHP 8.3 < 8.3.378.3.37
PHP 8.2 < 8.2.368.2.36
PHP 8.1 or earlierA supported branch

PHP 8.1 and earlier are end-of-life. The official 7.4, 8.0, and 8.1 EOL mitigation branches disable upload progress in the callback and are not affected.

If you cannot upgrade immediately: turn off session upload progress.

Session upload progress is the easiest attack path. If your application does not need the feature, disable it in php.ini and restart your PHP workers. Also limit the untrusted data your application stores in sessions.

session.upload_progress.enabled = 0

This removes the easiest path to the flaw, not the flaw itself. You still need the upgrade.

Check your exposure with depthfirst

depthfirst shows where affected PHP versions are in use and prioritizes findings. You can find affected PHP versions in your environment in five steps.

  1. Connect your repositories. Add every repository that might contain PHP, including self-hosted tools and legacy services.
  2. Run a scan. depthfirst reads the PHP version each repository declares. Findings appear after the next scan, or right away on a rescan.
  3. Open the language runtime findings. Go to Issues, Dependencies, Language runtime. A repository on an affected PHP version shows a finding for CVE-2026-126714.
  4. Review each finding. It shows the declared PHP version and the version to upgrade to. Treat every match as vulnerable.
  5. Confirm what is deployed. A repository’s declared version can differ from production, so check the version serving web requests.

Not a depthfirst customer? We offer repository and container image scans for PHP exposure, and help assessing temporary mitigations for teams that cannot upgrade right away.

Get a scan →

Technical details

The bug lives in PHP’s file-based session storage. When PHP writes updated session data back to a session file, the write is not atomic. If it is interrupted partway through, the file keeps part of the new data and part of the old. On a later request PHP reads the file back and deserializes it, and the mixed contents can be made to parse as objects the attacker chose. A gadget chain in the application’s code turns those objects into code execution in the PHP worker process. Session upload progress is the easiest path to the bug, which is why disabling it is the interim mitigation.

The full root cause analysis and the patch are in our technical writeup:

Read the full technical analysis

Credits

This vulnerability was discovered by depthfirst’s frontier AI models working with depthfirst researchers.

depthfirst reported the issue privately to the PHP project in late October 2026 and worked with PHP’s maintainers as they developed patches for all four supported branches. PHP published the fix and its advisory on November 19, 2026. We thank the PHP maintainers for their work throughout the disclosure process.

Frequently asked questions

  • How do I know if I am affected?

    Check two things. First, the PHP version serving your web requests: anything older than 8.5.13, 8.4.28, 8.3.37, or 8.2.36 is affected. Second, your session storage: if sessions are stored in files, which is PHP’s default, you are in scope. If both are true, you are affected.

  • We patched PHP in October. Are we covered?

    No. This is a separate flaw. The October 21 releases (8.5.12, 8.4.27, 8.3.36, 8.2.35) do not contain the fix.

  • We are on WordPress, Laravel, or another framework. Does that matter?

    No. The flaw is in PHP itself. Any PHP application using file-based sessions is in scope.

  • We store sessions in Redis or a database. Are we affected?

    Other session storage is not affected by this specific defect.

  • We already turned off session upload progress. Are we safe?

    That removes the easiest attack path. You still need the upgrade.

  • We run PHP 8.1 or older. What should we do?

    Those versions are end-of-life and will not get this fix. Move to a supported branch.

  • Can depthfirst tell me if I am exposed?

    Yes. depthfirst shows you where affected PHP versions are in use. Whether a given server can be exploited depends on its configuration, so patch every match.

  • Where can I find the technical writeup?

    Our full root cause analysis and patch walkthrough are in the technical blog post.

PHP exposure scans and mitigation guidance

We’re offering language runtime scans of your repositories, and container image scans, to help identify potentially vulnerable PHP versions across your applications.

Running an unsupported version and can't upgrade immediately? Our team can also help assess temporary mitigations while you plan your migration.