> ## 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 8.5 backtrace flaw (CVE-2026-129474): remote code execution

> PHP 8.5 CVE-2026-129474: a use-after-free in __call() and __callStatic() backtraces. Sizing your exposure, PHP 8.5.13, fixed packages and php.ini settings.

*Published on November 30, 2026*

> [!WARNING]
>
> **CVE-2026-129474 — PHP 8.5, CVSS v4.0 9.2.** An unauthenticated request that triggers a fatal error just as the application enters `__call()` or `__callStatic()` can corrupt the PHP worker's memory and, according to the PHP advisory, lead to code execution. Only **PHP 8.5 before 8.5.13** is affected; the fix shipped on November 19, 2026. Update, or set `zend.exception_ignore_args` to `1` in the meantime.

## The bug in two sentences

When PHP builds the backtrace of a call forwarded to `__call()` or `__callStatic()`, it can read stale arguments, some of which point to memory that has already been freed. If a fatal error, such as exceeding `memory_limit`, fires at that exact moment and backtraces include arguments, request-controlled bytes can be treated as live PHP values.

This is a use-after-free (CWE-416). Frameworks rely heavily on these magic methods to forward calls: logging facades, database layers, service proxies.

The PHP advisory describes the demonstrated attack: crafted JSON sent to an import endpoint, later logged through a magic static method, and sized so that building a logging argument exceeds `memory_limit`. An execution time limit expiring in the same window is another possible trigger.

The demonstrated path requires:

* `fatal_error_backtraces=1`, the PHP 8.5 default;
* `zend.exception_ignore_args=0`;
* a request path that reaches a magic method with enough data to influence memory allocation;
* knowledge of usable memory addresses despite ASLR.

Affected versions:

* **PHP 8.5.0 through 8.5.12**, fixed in **8.5.13**;
* PHP 8.2 through 8.4 contain the underlying bug with no known remote trigger: the PHP project keeps them out of the affected range.

Fatal error backtraces arrived with PHP 8.5.0, and PHP 8.5.12 moved the handling of the allocation failure into the faulty window.

The PHP project scores the flaw **9.2** in CVSS 4.0 (`AV:N/AC:H/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N`); NVD carries the same score. Red Hat scores it 8.1 in CVSS 3.1, Ubuntu rates it medium priority. The full advisory is [GHSA-8mjj-2r7p-4hg2](https://github.com/php/php-src/security/advisories/GHSA-8mjj-2r7p-4hg2).

> [!NOTE]
>
> According to the CISA assessment shown by NVD, no exploitation is reported and the attack is not automatable. The PHP advisory cites Laravel facades and Magento's guest shipping estimation as paths that reach a magic method, with no exploitation demonstrated on a full installation of either.

## Sizing your exposure

The question to ask: **does any of your sites run PHP 8.5 with `zend.exception_ignore_args` set to `0`?** The `php.ini-production` file shipped by PHP sets it to `1`, which blocks the demonstrated path.

| Profile | Exposure | Action |
| - | - | - |
| PHP 8.5 before 8.5.13, `zend.exception_ignore_args=0`, `fatal_error_backtraces=1`, application facing the Internet | **High**: demonstrated attack path | Update today; otherwise apply the settings below |
| `php:8.5` or `php:8.5-fpm` container with no `php.ini` enabled in the `Dockerfile` | **Check it**: the image ships `php.ini-production` without enabling it | Rebuild on 8.5.13; check the effective value |
| PHP 8.5 before 8.5.13, `zend.exception_ignore_args=1` | Demonstrated path blocked | Update in the next cycle |
| PHP 8.5 before 8.5.13, `fatal_error_backtraces=0` | Path blocked according to the PHP advisory | Update in the next cycle |
| PHP 8.4 or older (Debian 12 and 13, Ubuntu 24.04 and 22.04, RHEL packages) | Not affected according to PHP, Debian, Ubuntu and Red Hat | No action for this CVE |
| PHP 8.5.13 or fixed Ubuntu package | Fixed | No action |

Start with the PHP version your sites run:

```bash theme={null}
# Installed PHP-FPM versions (Debian, Ubuntu)
dpkg -l 'php*-fpm' | grep ^ii

# RHEL, AlmaLinux, or PHP installed from a third-party repository
rpm -qa 'php*fpm*'
```

If version 8.5 shows up, read the PHP-FPM configuration, not the command-line one:

```bash theme={null}
# Values from PHP-FPM's php.ini (adjust 8.5 to your binary name)
sudo php-fpm8.5 -i | grep -E 'fatal_error_backtraces|zend.exception_ignore_args'

# Overrides in pools and ini files (Debian, Ubuntu then RHEL, AlmaLinux)
sudo grep -rnE 'fatal_error_backtraces|zend\.exception_ignore_args' \
  /etc/php/ /etc/php.ini /etc/php.d/ /etc/php-fpm.d/ 2>/dev/null

# Overrides set by the sites themselves
sudo grep -rnE 'fatal_error_backtraces|zend\.exception_ignore_args' \
  /var/www --include=.user.ini --include=.htaccess 2>/dev/null
```

A `php_admin_value`, `php_value` or `php_admin_flag` line in a pool wins over `php.ini`. As the PHP advisory points out, changing only the CLI configuration is not enough.

> [!NOTE]
>
> `display_errors=0` is **not** a mitigation: it hides the error output, but the backtrace is still built.

## Updating PHP by distribution

The real fix is PHP 8.5.13 or your distribution's fixed package, followed by a **restart** of PHP-FPM: workers that are already running keep the old code.

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

### Ubuntu

| Release | Fixed package | Advisory |
| - | - | - |
| 26.10 | `php8.5` `8.5.9-0ubuntu2.2` | USN-9185-1 |
| 26.04 LTS | `php8.5` `8.5.4-0ubuntu1.6` | USN-9185-1 |
| 24.04 LTS, 22.04 LTS | PHP 8.5 not in the release | — |

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

# Check the installed version
dpkg -l 'php8.5*' | grep ^ii
```

> [!NOTE]
>
> Do not rely on the number shown by `php -v` alone. Ubuntu backports the fix: a fixed package can report PHP 8.5.4 or 8.5.9. Only the full package version, checked against the advisory, counts.

### Debian

The Debian tracker marks `php8.4` (Debian 13) and `php8.2` (Debian 12) as not affected: the flaw only hits PHP 8.5. If you install PHP 8.5 from a third-party repository, apply that repository's update to 8.5.13, or the settings below.

### RHEL and AlmaLinux

According to bulletin [RHSB-2026-020](https://access.redhat.com/security/vulnerabilities/RHSB-2026-020), the PHP versions shipped by RHEL are not affected: Red Hat does not ship PHP 8.5. If you install PHP 8.5 from a third-party repository, update it to 8.5.13:

```bash theme={null}
# Install the fix, then restart PHP-FPM
sudo dnf upgrade 'php*'
sudo systemctl restart php-fpm

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

### Docker containers

Rebuild your images on a `php:8.5` base image at version **8.5.13** or later, then redeploy. Check the bundled version:

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

The official image's documentation recommends enabling the production configuration, which sets `zend.exception_ignore_args` to `1`:

```dockerfile theme={null}
FROM php:8.5-fpm
# Enable php.ini-production (zend.exception_ignore_args = On)
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
```

## Blocking the attack path in the meantime

If you cannot update right away, PHP and Red Hat give the same mitigation: **`zend.exception_ignore_args=1`** and, to close the trigger as well, **`fatal_error_backtraces=0`**. The first setting strips arguments from exception traces: your logs still show the call stack, without the values passed.

### On an Ubuntu VPS

Create an ini file read by PHP-FPM:

```ini theme={null}
; /etc/php/8.5/fpm/conf.d/99-cve-2026-129474.ini
; Mitigation for CVE-2026-129474
zend.exception_ignore_args = 1
fatal_error_backtraces = 0
```

To stop a site from restoring these values through `ini_set()` or a `.user.ini`, also pin them in each pool, for example `/etc/php/8.5/fpm/pool.d/www.conf`:

```ini theme={null}
php_admin_flag[zend.exception_ignore_args] = on
php_admin_flag[fatal_error_backtraces] = off
```

Test the configuration, then restart:

```bash theme={null}
sudo php-fpm8.5 -t && sudo systemctl restart php8.5-fpm
```

### With PHP 8.5 from a third-party repository on RHEL or AlmaLinux

Red Hat says to set both values in `/etc/php.ini` or in the pool file under `/etc/php-fpm.d/`, then restart:

```bash theme={null}
sudo php-fpm -t && sudo systemctl restart php-fpm.service
```

> [!NOTE]
>
> According to Red Hat, the same mitigation covers CVE-2026-129182, another PHP 8.5-only use-after-free in fatal error backtraces, fixed by the same 8.5.13 release.

## Checking the mitigation

`php -i` on the command line does not show pool overrides. The check that counts goes through PHP-FPM: drop a temporary script into a site's document root, query it, then delete it.

```bash theme={null}
# Adjust the path and host name to your site
echo '<?php var_dump(ini_get("zend.exception_ignore_args"), ini_get("fatal_error_backtraces"));' \
  | sudo tee /var/www/html/ini-check-129474.php > /dev/null
curl -s http://localhost/ini-check-129474.php
sudo rm /var/www/html/ini-check-129474.php
```

The first value must be `"1"`. The second must be `"0"` or empty if you also turned backtraces off.

After an update, also check the restart:

```bash theme={null}
# PHP-FPM must have restarted after the package update
systemctl show -p ActiveEnterTimestamp php8.5-fpm.service
```

## Restoring backtraces after the update

Once PHP 8.5.13 or the fixed package is in place, you can turn `fatal_error_backtraces` back on if you read those traces in your logs: remove the matching line from the ini file and the pool, then restart PHP-FPM.

```bash theme={null}
sudo php-fpm8.5 -t && sudo systemctl restart php8.5-fpm
```

Keep `zend.exception_ignore_args = 1`: it is the `php.ini-production` value, and it keeps function arguments out of your logs.

## What next?

The settings are only a stopgap: the target remains PHP 8.5.13 or your distribution's fixed package. The November 19 release also fixes [PHP-FPM (CVE-2026-129289)](https://blog.onetsolutions.net/en/php-fpm-smuggling-cve-2026-129289.md), [PHP-FPM epoll (CVE-2026-129291)](https://blog.onetsolutions.net/en/php-fpm-epoll-cve-2026-129291.md) and [PHPAfterShell (CVE-2026-126714)](https://blog.onetsolutions.net/en/phpaftershell-cve-2026-126714.md): check them in a single pass. Turn on [automatic security updates](https://blog.onetsolutions.net/en/automatic-security-updates-linux-vps.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.