Critical PHP timezone cache use-after-free can lead to RCE (CVE-2026-129496)

A use-after-free in PHP's timezone cache, triggered by a diagnostic written to a file-based error_log during module startup, can be exploited by an unauthenticated remote attacker to crash PHP-FPM, mod_php or CGI workers and may allow arbitrary code execution. Affected PHP 8.2. before 8.2.36, 8.3. before 8.3.37, 8.4. before 8.4.28, 8.5. before 8.5.13.

Background

CVE-2026-129496 is a use-after-free in PHP's timezone cache. In non-thread-safe builds, a diagnostic written to a file-based error_log during module startup (e.g., invalid date.timezone or session configuration warning) causes the timezone cache to be allocated in startup memory that is freed while a reference to it is kept. A diagnostic raised early in the first request of a worker (e.g., max_input_vars warning) then accesses the freed cache.

On such a deployment, an unauthenticated remote attacker can crash PHP-FPM, Apache mod_php or CGI workers with a crafted request. Arbitrary code execution may be possible and has been demonstrated with known memory addresses.

Affected versions

- PHP 8.2. before 8.2.36 - PHP 8.3. before 8.3.37 - PHP 8.4. before 8.4.28 - PHP 8.5. before 8.5.13

What to do

1. Identify all PHP deployments and verify exact versions (e.g., php -v). 2. Upgrade PHP to a fixed release: 8.2.36, 8.3.37, 8.4.28, or 8.5.13 (or later) as appropriate for your stack. 3. If an immediate upgrade is not possible, review the official PHP security advisory and NVD entry and apply any recommended mitigations before returning affected systems to production. 4. Re-test web applications and PHP-FPM/mod_php/CGI worker startup after patching. 5. Monitor for exploit attempts or unexpected worker crashes and check logs for the startup diagnostics described in the advisory.

Sources