VulnWatch by ve1ve2
high 8.8 EPSS 1.03%

GHSA-jm4m-qfqx-967m / CVE-2026-129291: PHP-FPM epoll use-after-free can lead to local privilege escalation

Source:
PHP releases (GitHub php/php-src tags)
Published:
Fetched:
Updated:
Affects:
php sapi-fpm

https://github.com/php/php-src/security/advisories/GHSA-jm4m-qfqx-967m ↗

repo-advisoryphpCWE-416securityrepo:php/php-src

PHP-FPM epoll use-after-free can lead to local privilege escalation ### Summary PHP-FPM can dispatch an epoll event that refers to a freed worker record when worker output capture is enabled. An attacker who can execute PHP code in an unprivileged FPM worker can exploit this use-after-free to execute commands with the privileges of the FPM master, which commonly runs as root. ### Details When `catch_workers_output` is enabled, the FPM master monitors pipes connected to worker stdout and stderr. The epoll registrations store pointers to event structures embedded in the corresponding worker record. When a worker exits, `fpm_child_close()` attempts to drain its output pipes. If a helper process still holds a pipe's write end open, the read can return `EAGAIN` instead of reaching EOF. In this case, the master closes the pipe's read descriptor without first removing its event or invalidating the descriptor number stored in the worker record. Cleanup of that record is deferred for one second. An attacker can stop a newly forked sibling after it drops to the pool user but before it closes inherited descriptors. The stopped sibling retains the original pipe readers and epoll descriptor, keeping the original watch alive after the master closes its own descriptors. The delayed cleanup can then use a descriptor number that has already been reused, removing the wrong watch or failing to remove the original one before freeing the worker record. A subsequent write to the old pipe makes epoll return a pointer into the freed record. The master passes that pointer to `fpm_event_fire()`, which reads and calls the event callback. The demonstrated exploit uses the stale output callback to write through a freed logging buffer, corrupt the allocator's free list, and replace the callback with a function that executes a command. Root command execution was reproduced from a `www-data` worker against unmodified PHP 8.5.12 Docker images on Linux arm64 and x86-64. The exploit is dependent on memory layout and process timing. Curl and OPcache were used to obtain memory addresses for the demonstrated chain; they are not required to trigger the underlying epoll use-after-free. The affected delayed-cleanup path was introduced in PHP 8.1.20 and 8.2.7. The fix unregisters each stdio event while its original descriptor is still valid, closes the descriptor, and sets the stored descriptor to `-1` so that delayed cleanup cannot act on it again. ### Impact Exploitation requires local code execution in an FPM worker, an affected pool with `catch_workers_output` enabled, the epoll event backend, and the ability to manipulate worker lifetimes and retain inherited pipe descriptors. A root FPM master permits escalation from the pool user to root. If the master runs as an unprivileged user, successful exploitation is limited to that user's privileges. In a container, this grants the master's container privileges and does not by itself establish a container escape. The underlying descriptor-lifetime error can also close another Affected packages: php:sapi-fpm Patched: sapi-fpm None, sapi-fpm 8.2.36, sapi-fpm 8.3.37, sapi-fpm 8.4.28, sapi-fpm 8.5.13

Linked vulnerabilities (2)

CVE-2026-129291 high 8.8 EPSS 1.03% (p65) NVDCVE.orgGHSA
CVSS:4.0/AV:L/AC:H/AT:P/PR:L/UI:N/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X

PHP-FPM epoll use-after-free can lead to local privilege escalation. When catch_workers_output is enabled and the epoll event backend is used, the PHP-FPM master can close a worker's output pipe in fpm_child_close() without removing the associated event, and the delayed cleanup can free the worker record while its epoll registration is still active. A later event is then dispatched through a pointer into freed memory. A local attacker who can execute PHP code in an FPM worker can crash the master or execute code with its privileges, commonly root. catch_workers_output is disabled by...

CWE: CWE-416, CWE-825Aliases: CVE-2026-115560, CVE-2026-126714, CVE-2026-127960, CVE-2026-128064, CVE-2026-128090, CVE-2026-129289, CVE-2026-129292, CVE-2026-129496, CVE-2026-129506, CVE-2026-129538, CVE-2026-15353, GHSA-jm4m-qfqx-967m, CVE-2026-129481, CVE-2026-129501NVD: Awaiting Analysis
CVSS:4.0/AV:L/AC:H/AT:P/PR:L/UI:N/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H

PHP-FPM epoll use-after-free can lead to local privilege escalation

CWE: CWE-416Aliases: CVE-2026-129291

Also reported by (1)