> ## Documentation Index
> Fetch the complete documentation index at: https://blog.onetsolutions.net/llms.txt
> Use this file to discover all available pages before exploring further.

# PHP-FPM privilege escalation to root (CVE-2026-129291)

> PHP-FPM flaw CVE-2026-129291 lets a worker gain the master's root privileges when catch_workers_output is on. Fixed versions, packages and mitigation.

*Published on November 22, 2026*

> [!WARNING]
>
> **CVE-2026-129291 — PHP-FPM, CVSS v4.0 8.8.** An attacker who already runs PHP code in a PHP-FPM worker can gain the privileges of the master process, often root, when the pool captures worker output (`catch_workers_output`). Fixed in **PHP 8.5.13, 8.4.28, 8.3.37 and 8.2.36**, released on November 19, 2026. The official `php:*-fpm` Docker images turn that setting on: update, or turn it off in the meantime.

## The bug in two sentences

With `catch_workers_output` on and the epoll backend, the PHP-FPM master can close a worker's output pipe without removing the matching epoll event, then free that worker's record. A later event on the old pipe goes through a pointer into freed memory: the master calls a stale callback.

This is a use-after-free (CWE-416). The attacker must already run PHP code in a worker, control worker lifetimes and keep inherited pipe descriptors open. The payoff: moving from the pool user, such as `www-data`, to the master's privileges.

The researcher who reported the flaw got root command execution from a `www-data` worker on unmodified official PHP 8.5.12 Docker images (x86-64 and arm64). According to the PHP advisory, the exploit depends on memory layout and timing. The flaw can also crash the master, disrupt logging or requests, and make workers respawn over and over.

Affected versions:

* **PHP 8.1.20 through 8.1.34**, with no upstream fix;
* **PHP 8.2.7 through 8.2.35**, fixed in **8.2.36**;
* **PHP 8.3.0 through 8.3.36**, fixed in **8.3.37**;
* **PHP 8.4.0 through 8.4.27**, fixed in **8.4.28**;
* **PHP 8.5.0 through 8.5.12**, fixed in **8.5.13**.

The faulty code came in with PHP 8.1.20 and 8.2.7, as part of the fix for bug GH-10461.

The PHP project scores the flaw **8.8** in 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`); NVD carries the same score. Red Hat rates it "Important" with 7.0 in CVSS 3.1, Ubuntu medium priority. The full advisory is [GHSA-jm4m-qfqx-967m](https://github.com/php/php-src/security/advisories/GHSA-jm4m-qfqx-967m).

> [!NOTE]
>
> According to the CISA assessment shown by NVD, no exploitation is reported and the attack is not automatable. The flaw is a second-stage bug: paired with code execution in a worker, such as the one in [PHP-FPM (CVE-2026-129289)](https://blog.onetsolutions.net/en/php-fpm-smuggling-cve-2026-129289.md), fixed by the same release, it leads all the way to the master's privileges.

## Sizing your exposure

The question to ask: **does any of your PHP-FPM pools have `catch_workers_output` turned on?** The default is `no`. On Linux, PHP-FPM picks epoll by default, so the second precondition is almost always met.

| Profile | Exposure | Action |
| - | - | - |
| Container built on the official `php:*-fpm` image | **High**: setting on in the image, master runs as root in the container | Rebuild on a fixed image; if you can't, turn off `catch_workers_output` |
| VPS with a pool set to `catch_workers_output = yes` and third-party PHP code or several sites | **High**: one compromised site leads to root | Update today; if you can't, turn off `catch_workers_output` |
| VPS with `catch_workers_output = yes`, a single site you control | Moderate: code must first run in a worker | Update |
| PHP-FPM master started by a non-root user | Limited to that user's privileges | Update |
| Pools with default settings (`catch_workers_output` missing or `no`) | Not exposed to this CVE | Update anyway: the release fixes other flaws |

Look for the setting in your pool configuration:

```bash theme={null}
# Active catch_workers_output lines (Debian, Ubuntu then RHEL, AlmaLinux)
sudo grep -rnE '^\s*catch_workers_output\s*=' /etc/php/*/fpm/ /etc/php-fpm.conf /etc/php-fpm.d/ 2>/dev/null

# Forced event mechanism (no line: auto detection, epoll on Linux)
sudo grep -rnE '^\s*events\.mechanism\s*=' /etc/php/*/fpm/ /etc/php-fpm.conf 2>/dev/null
```

A `catch_workers_output = yes` line marks an affected pool. A line commented out with `;` is inactive.

Then check which user runs the master:

```bash theme={null}
# User of the PHP-FPM master process
ps -eo user,args | grep '[p]hp-fpm: master'
```

In a container built on the official image, the setting lives in `/usr/local/etc/php-fpm.d/docker.conf`:

```bash theme={null}
# Replace <container> with the name of your PHP-FPM container
docker exec <container> grep -rn 'catch_workers_output' /usr/local/etc/php-fpm.d/
```

> [!NOTE]
>
> In a container, the attacker gets the master's privileges inside that container. According to the PHP advisory, that alone does not give them a container escape.

## Updating PHP, distro by distro

The real fix is a PHP package update followed by a **restart** of PHP-FPM: a master that is already running keeps the old code.

Take a [snapshot of your VPS](https://help.onetsolutions.net/vps/snapshot) first.

### Debian

| Version | Fixed package | Advisory |
| - | - | - |
| Debian 13 (trixie) | `php8.4` `8.4.28-1~deb13u1` | DSA-6641-1 |
| Debian 12 (bookworm) | `php8.2` `8.2.36-1~deb12u1` | DLA-4916-1 |

These are the same advisories as for [CVE-2026-129289](https://blog.onetsolutions.net/en/php-fpm-smuggling-cve-2026-129289.md): one update covers both flaws.

### Ubuntu

| Version | Fixed package |
| - | - |
| 26.10 | `php8.5` `8.5.9-0ubuntu2.2` |
| 26.04 LTS | `php8.5` `8.5.4-0ubuntu1.6` |
| 24.04 LTS | `php8.3` `8.3.6-0ubuntu0.24.04.14` |
| 22.04 LTS | `php8.1` `8.1.2-1ubuntu2.29` |
| 20.04 LTS | `php7.4` `7.4.3-4ubuntu2.29+esm6` (Ubuntu Pro) |

```bash theme={null}
# Debian, Ubuntu: install the PHP fixes, then restart PHP-FPM
sudo apt update
sudo apt install --only-upgrade 'php*'
sudo systemctl restart 'php*-fpm.service'

# Check the installed version
dpkg -l 'php*-fpm' | grep ^ii
```

> [!NOTE]
>
> Don't rely on the version printed by `php -v` alone. Debian and Ubuntu backport the fix: Ubuntu 24.04 still reports PHP 8.3.6 once patched. Only the full package version, compared with your distribution's advisory, is the reference.

### RHEL and AlmaLinux

Red Hat shipped its fixes between November 20 and 22, 2026:

| Version | Fixed package | Advisory |
| - | - | - |
| RHEL 10 | `php8.4` `8.4.28-1.el10_3` | RHSA-2026:100821 |
| RHEL 9.8 EUS | `php:8.3` and `php:8.2` streams | RHSA-2026:101252, RHSA-2026:101253 |
| RHEL 8 | `php:7.4` stream, `php-7.4.33-9.module+el8.10.0+25371+681fa571` | RHSA-2026:100991 |
| RHEL 7 ELS | `php-5.4.16-48.el7_9.2` | RHSA-2026:101337 |

As of November 22, 2026, the base `php` package of RHEL 9, its `php:8.2`, `php:8.3` and `php:8.4` streams, and the `php:8.2` stream of RHEL 8 are still marked "Affected" with no erratum: follow the [Red Hat CVE page](https://access.redhat.com/security/cve/CVE-2026-129291). For AlmaLinux, watch [errata.almalinux.org](https://errata.almalinux.org).

```bash theme={null}
# Find out whether PHP comes from a module stream
dnf module list --enabled php

# Install the fix as soon as it ships, then restart PHP-FPM
sudo dnf upgrade 'php*'
sudo systemctl restart php-fpm

# Check the installed version
rpm -q php-fpm
```

Until the package lands, apply the mitigation below.

### Docker containers

Rebuild your images on a fixed `php:*-fpm` base image (8.2.36, 8.3.37, 8.4.28 or 8.5.13), then redeploy. Check the version inside:

```bash theme={null}
docker exec <container> php -v
```

## Turning off catch\_workers\_output until you can update

If you can't update right away, the PHP team recommends turning off `catch_workers_output` in the affected pools. Without it, worker stdout and stderr go to `/dev/null`: whatever your scripts write to `stderr` no longer shows up in the PHP-FPM log.

### On a VPS

In each affected pool, replace the line with:

```ini theme={null}
catch_workers_output = no
```

Test the configuration, then restart:

```bash theme={null}
# Debian, Ubuntu (change 8.4 to your PHP version)
sudo php-fpm8.4 -t && sudo systemctl restart php8.4-fpm

# RHEL, AlmaLinux
sudo php-fpm -t && sudo systemctl restart php-fpm
```

### In an official Docker image

Add a step to your `Dockerfile` that rewrites the setting in `docker.conf`:

```dockerfile theme={null}
FROM php:8.4-fpm
# CVE-2026-129291 mitigation: stop capturing worker output
RUN sed -i 's/^catch_workers_output = yes/catch_workers_output = no/' \
    /usr/local/etc/php-fpm.d/docker.conf
```

Rebuild the image and redeploy the container.

> [!NOTE]
>
> Running the PHP-FPM master as a non-root user narrows the privileges gained, but does not fix the use-after-free. Turning off curl or OPcache only removes pieces of the demonstrated exploit. None of these replaces the update.

## Checking the mitigation

```bash theme={null}
# The package version must match your distribution's advisory
dpkg -l 'php*-fpm' | grep ^ii      # Debian, Ubuntu
rpm -q php-fpm                     # RHEL, AlmaLinux

# PHP-FPM must have restarted after the package update
systemctl show -p ActiveEnterTimestamp 'php*-fpm.service'
```

If you turned the setting off, run the `grep` from "Sizing your exposure" again: no `catch_workers_output = yes` line should remain, on the VPS or in the container.

## Turning catch\_workers\_output back on after the update

Once PHP is fixed and PHP-FPM restarted, you can bring capture back if you read worker output in the PHP-FPM log:

```ini theme={null}
catch_workers_output = yes
```

```bash theme={null}
# Debian, Ubuntu (change 8.4 to your PHP version)
sudo php-fpm8.4 -t && sudo systemctl restart php8.4-fpm
```

In a Docker image, just drop the `sed` step and rebuild on the fixed base image.

## What next?

Turning off `catch_workers_output` is only a stopgap: the target remains your distribution's fixed PHP package, or a rebuilt Docker image. The same PHP release fixes the critical [PHP-FPM flaw (CVE-2026-129289)](https://blog.onetsolutions.net/en/php-fpm-smuggling-cve-2026-129289.md): check both in a single pass. Turn on [automatic security updates](https://blog.onetsolutions.net/en/automatic-security-updates-linux-vps.md) and go through the [Linux VPS security tips](https://blog.onetsolutions.net/en/enhanced-vps-linux-security.md). For any technical question, open a ticket from your [OnetSolutions customer area](https://help.onetsolutions.net/console/support).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.