Логотип exploitDog
Консоль
Логотип exploitDog

exploitDog

github логотип

GHSA-jm4m-qfqx-967m

Опубликовано: 19 нояб. 2026
Источник: github
Github: Не прошло ревью
CVSS4: 8.8

Описание

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 worker's reused descriptor, disrupt logging or request handling, cause repeated worker respawns, or crash the master. Common affected configurations include the official PHP-FPM Docker images, which enable worker output capture. The default PHP-FPM setting outside such configurations is catch_workers_output = no.

Affected versions

The affected delayed-cleanup path was introduced by the fix for GH-10461, first released in PHP 8.1.20 and 8.2.7.

Mitigation

Upgrade to the fixed release for your PHP branch when it becomes available. As a temporary workaround, disable catch_workers_output in affected pools. Running the FPM master without root limits the privileges obtainable through this vulnerability, but does not correct the use-after-free. Disabling Curl or OPcache only removes parts of the demonstrated exploit chain and should not be treated as a complete mitigation.

Пакеты

Наименование

php

php
Затронутые версииВерсия исправления

>=8.1.20, <=8.1.34

Отсутствует

Наименование

php

php
Затронутые версииВерсия исправления

>=8.2.7, <8.2.36

8.2.36

Наименование

php

php
Затронутые версииВерсия исправления

>=8.3.0, <8.3.37

8.3.37

Наименование

php

php
Затронутые версииВерсия исправления

>=8.4.0, <8.4.28

8.4.28

Наименование

php

php
Затронутые версииВерсия исправления

>=8.5.0, <8.5.13

8.5.13

EPSS

Процентиль: 73%
0.01392
Низкий

8.8 High

CVSS4

Дефекты

CWE-416

Связанные уязвимости

ubuntu
8 дней назад

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 default but enabled in the official PHP-FPM Docker images. This issue affects PHP versions from 8.1.20 through 8.1.34, from 8.2.7 before 8.2.36, 8.3.* before 8.3.37, 8.4.* before 8.4.28 and 8.5.* before 8.5.13.

CVSS3: 7
redhat
8 дней назад

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 default but enabled in the official PHP-FPM Docker images. This issue affects PHP versions from 8.1.20 through 8.1.34, from 8.2.7 before 8.2.36, 8.3.* before 8.3.37, 8.4.* before 8.4.28 and 8.5.* before 8.5.13.

nvd
8 дней назад

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 default but enabled in the official PHP-FPM Docker images. This issue affects PHP versions from 8.1.20 through 8.1.34, from 8.2.7 before 8.2.36, 8.3.* before 8.3.37, 8.4.* before 8.4.28 and 8.5.* before 8.5.13.

msrc
1 день назад

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

debian
8 дней назад

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

EPSS

Процентиль: 73%
0.01392
Низкий

8.8 High

CVSS4

Дефекты

CWE-416