Skip to content

NGINX CVE-2026-42945: rewrite module overflow, who is affected and what to install

NGINX fixed a heap overflow in its rewrite module on 13 May 2026. It needs a specific config pattern. Current releases are 1.30.6 and 1.31.8.

Seeding.Top editorial team3 min read

This article was drafted with AI assistance.

On 13 May 2026, NGINX released 1.30.1 (stable) and 1.31.0 (mainline) with a fix for CVE-2026-42945, a heap buffer overflow in ngx_http_rewrite_module (nginx.org advisories, CHANGES-1.30). It affects NGINX Open Source 0.6.27 through 1.30.0. The researchers who found it, depthfirst, call it "NGINX Rift" and have published a proof of concept.

Many seedbox and home-server setups put NGINX in front of qBittorrent, the *arr apps or Jellyfin, so it is worth checking. But the bug only triggers with a particular kind of rewrite rule, and NGINX itself rates it medium.

When it applies

From the NVD description, supplied by F5, the vulnerable pattern is:

  • a rewrite directive that uses an unnamed regex capture ($1, $2, ...)
  • with a replacement string that contains a question mark ?
  • followed by another rewrite, if or set directive

An unauthenticated attacker can then send crafted requests that overflow a heap buffer in the worker process, which crashes and restarts. Code execution is possible only on systems with ASLR disabled or when the attacker can bypass ASLR.

Severity depends on who you ask. nginx.org lists it as medium. F5's CVSS scores in NVD are 8.1 (v3.1) and 9.2 (v4.0), both with "high" attack complexity. A typical location block with proxy_pass and no rewrites is not affected. Neither are Traefik and Caddy, which do not use NGINX code.

To see whether your config has rewrites with captures at all:

```bash
sudo nginx -T 2>/dev/null | grep -nE '^\s*rewrite\s'
```

Any rewrite line with $1-style captures and a ? in the replacement deserves a closer look.

Current status: upgrade past 1.30.1

Upgrading to 1.30.1 was the advice in May. It is no longer enough. Since then nginx.org has fixed more bugs, including two more in the rewrite path (advisories):

  • CVE-2026-9256, overlapping captures in rewrite, fixed in 1.30.2 / 1.31.1 (22 May 2026)
  • CVE-2026-42533 (map with regex, rated major), fixed in 1.30.4 / 1.31.3 (15 July 2026)
  • CVE-2026-15176 (alias after rewrite), plus four others, fixed in 1.30.6 / 1.31.7 (14 October 2026)

The current releases are 1.30.6 stable (14 October 2026) and 1.31.8 mainline (21 October 2026) (CHANGES-1.30, CHANGES).

Distro packages keep old version numbers

If you installed nginx from Debian or Ubuntu, nginx -v will show an older upstream version (1.22, 1.24, 1.26 ...) even when fully patched, because fixes are backported. Do not compare that number with the nginx.org table. Compare the package version with your distro tracker instead.

CVE-2026-42945 was fixed in these packages (Debian tracker, Ubuntu):

Release

Fixed nginx package

Debian 13 trixie

1.26.3-3+deb13u5 (DSA-6278-1, 16 May 2026)

Debian 12 bookworm

1.22.1-9+deb12u7 (DSA-6278-1)

Ubuntu 24.04 noble

1.24.0-2ubuntu7.8

Ubuntu 22.04 jammy

1.18.0-6ubuntu14.11

Later NGINX fixes arrive as later package revisions, so install whatever security updates are pending.

How to update

Check what you have:

```bash
nginx -v
dpkg -l nginx nginx-common 2>/dev/null | grep ^ii # Debian/Ubuntu package version
```

Update from your distro:

```bash

Debian / Ubuntu

sudo apt update && sudo apt install --only-upgrade nginx nginx-common

RHEL / Rocky / AlmaLinux

sudo dnf upgrade nginx

sudo nginx -t
sudo systemctl restart nginx
```

Use restart, not reload. A reload re-reads the configuration with the binary that is already running, so the old code stays in memory.

If you use nginx.org's own packages, follow the repository setup on nginx.org/en/linux_packages.html. It uses a signed keyring file rather than the deprecated apt-key.

Docker

The official image tags nginx:stable and nginx:mainline track the current branches. If you pin a version, move it to 1.30.6 or later.

```bash
docker compose pull nginx
docker compose up -d nginx
docker compose exec nginx nginx -v
```

up -d recreates the container with the new image. Restarting the old container does not.

Images that bundle NGINX, such as reverse-proxy managers or app images with an internal web server, need an update from their maintainer. Check their release notes for the NGINX version they ship.

On a managed seedbox

If your provider runs NGINX for you, updating it is their job. Ask support if you are unsure. If you run your own NGINX inside your slot, the steps above apply. Whatever your setup, keep admin UIs behind authentication rather than exposed directly.

Sources

Source: nginx.org