PHP 8.5 use-after-free enables RCE

Critical 9.2 CVE-2026-129182

Critical · patch soon

Severity 9.2 Reach 10.0 Ease 8.0 Exploitation 5.0 Tooling 0.0

Risk assessment

PHP 8.5.x before 8.5.13 use-after-free lets remote attackers corrupt memory and crash workers, possibly running code (CVSS 9.2). Update to 8.5.13.

By Yazoul AI · automated

What to do

Apply the latest security patches from the vendor. If patching is not immediately possible, review the mitigation steps in this advisory and monitor for exploitation attempts.

High exploitation risk - EPSS 96th percentile - CVE-2026-129182 is a critical use-after-free in PHP 8.5.* before 8.5.13 that lets a remote attacker corrupt worker memory and potentially execute code. Upgrade to PHP 8.5.13.

Overview

The bug lives in how PHP stores the last fatal error backtrace. Normally that backtrace is captured when a fatal error occurs, so later diagnostics can report it. The problem appears during request shutdown. If a fatal error is raised while modified INI settings are being restored at the end of a request, PHP can repopulate the stored backtrace after the executor has already been cleaned up. The request memory is then freed, but the global still points at it.

In a later request handled by the same PHP-FPM or mod_php worker, a diagnostic emitted before the executor is initialized can read that stale pointer. The result is memory corruption: worker crashes at minimum, and possibly remote code execution.

Who is affected

This is a chained scenario, and each half needs a specific configuration:

  • The shutdown error requires per-path configuration of max_memory_limit, or of zlib.output_compression together with output_handler. A .user.ini file can set these.
  • The early diagnostic requires Apache per-directory configuration, or for PHP-FPM a PHP_VALUE or PHP_ADMIN_VALUE parameter sent by the front end.

Shared hosting and multi-tenant platforms are the highest risk, because tenants often control .user.ini while the platform controls the front-end configuration. Workers persist across requests, so one poisoned worker keeps serving other users’ traffic.

CVSS is 9.2: network attack vector, low complexity, no privileges and no user interaction required. EPSS puts exploitation probability at 11 percent over the next 30 days. There is no confirmed active exploitation, but the conditions are common enough that exposure should be treated as a live risk.

Remediation and mitigation

  1. Upgrade to PHP 8.5.13 or later. This is the only complete fix. Coordinate the rollout with your hosting provider or platform team if you do not control the PHP build.

  2. If you cannot patch immediately, remove the preconditions. Reject or strip client-supplied PHP_VALUE and PHP_ADMIN_VALUE headers at the front end. Disable .user.ini handling where feasible, and audit per-directory and per-path overrides for max_memory_limit, zlib.output_compression, and output_handler.

  3. Restart workers after any configuration change. Long-lived PHP-FPM pools keep stale state; a graceful reload clears it.

  4. Monitor for crashes. Repeated segfaults or worker exits on the same pool are a useful early signal of this bug.

  5. Segment tenants. Isolate pools per tenant so a corrupted worker cannot serve another customer’s requests.

For context on how configuration-level preconditions drive real-world exploitation, see Apache ActiveMQ CVE-2026-34197 added to CISA KEV catal.

Security Insight

The severity here comes from PHP’s execution model, not from a single bad line of code. Fatal-error state that outlives a request, combined with workers that are reused indefinitely, turns what looks like a diagnostic detail into a cross-request memory hazard. This mirrors the long history of interpreter-level bugs (Perl’s taint-era issues, older Java deserialization flaws) where the engine’s own bookkeeping became the attack surface. The chained precondition requirement keeps casual exploitation low, but in shared hosting environments those preconditions are often the default, not the exception.

Further Reading

Share

Get a Telegram alert when the next one lands: PHP advisories

No public exploit yet. Get a Telegram alert when one appears

Never Miss a Critical Alert

CVE advisories, breach reports, and threat intel — delivered daily to your inbox.