GHSA-2fjv-p558-g82m / CVE-2026-129182: Use-after-free via repopulation of last_fatal_error_backtrace global after shutdown
- Published:
- Fetched:
- Updated:
- Affects:
- php engine
- KEV due:
- 2026-10-29
https://github.com/php/php-src/security/advisories/GHSA-2fjv-p558-g82m ↗
Use-after-free via repopulation of last_fatal_error_backtrace global after shutdown ### Summary As part of CVE-2026-109619 (GHSA-6wmf-4rv5-p3rp), PHP 8.5.12 fixes a generic use-after-free of the `last_fatal_error_backtrace` global by clearing it during executor shutdown. Further scenarios have been discovered in which a fatal diagnostic during later shutdown work repopulates the global. The request heap is then released, and an early diagnostic in a subsequent request handled by the same worker can access the stale backtrace before normal executor initialization. ### Details The backtrace can be recreated while PHP restores modified INI settings after executor cleanup: - When `max_memory_limit` is specified in both the global and a path-specific configuration, restoring the global limit can fail if memory consumption still exceeds that limit. The resulting fatal error recreates the backtrace. - When the global configuration specifies `zlib.output_compression=1`, and a path-specific configuration specifies `zlib.output_compression=0` and `output_handler=ob_gzhandler` (or another handler), restoring compression before restoring `output_handler` can raise a fatal configuration error because the two settings conflict. Both shutdown cases are possible with PHP-FPM and mod_php. The `max_memory_limit` override requires administrative configuration. `.user.ini` can supply the zlib settings but cannot change `max_memory_limit`. Exploitation also requires a diagnostic before executor initialization in a later request handled by the same worker. Apache per-directory configuration can provide this. FPM is conditionally exposed when the frontend sends a diagnostic-producing `PHP_VALUE` or `PHP_ADMIN_VALUE` FastCGI parameter. Ordinary FPM pool settings and `.user.ini` do not provide this early diagnostic. The fix is generic: PHP no longer creates or consumes the fatal-error backtrace while the executor is inactive. This also covers other shutdown diagnostics that might recreate the same state. ### Impact Successful exploitation can result in memory corruption and potentially full remote code execution (RCE), as in CVE-2026-109619 (GHSA-6wmf-4rv5-p3rp). The two restoration cases demonstrate heap use-after-free and worker crashes. RCE through these specific entry points has not been demonstrated. ### Affected versions The affected global was introduced in PHP 8.5.0 by fatal error backtraces. The fix for CVE-2026-109619 in PHP 8.5.12 cleared it during executor shutdown but did not stop later shutdown work from setting it again, so every PHP 8.5 release before 8.5.13 is affected. PHP 8.4 and earlier do not contain the global and are not affected. ### Mitigation Upgrade to PHP 8.5.13 when it becomes available. As a temporary workaround, disable fatal-error backtraces administratively with `fatal_error_backtraces=0` and restart all workers. Ensure that request-specific configuration cannot re-enable the setting. Affected packages: php:engine Patched: engine 8.5.13