# CVE-2026-42945: NGINX Rift, an 18-year-old rewrite bug that crashes or takes over workers

A heap overflow in NGINX's rewrite module lets an unauthenticated attacker crash worker processes, and run code where ASLR is off or bypassed. A public exploit exists, and VulnCheck saw attack attempts three days after disclosure.

- Vendor: F5, NGINX Open Source and NGINX Plus (rewrite module)
- Severity: CRITICAL (CVSS 4.0 9.2)
- Exploited (CISA KEV): not listed
- EPSS: 69.4% on 2026-12-02
- Public exploit: yes
- Patch available: yes
- Vendor advisory: K000161019, https://my.f5.com/manage/s/article/K000161019
- Published: 2026-05-13; updated: 2026-10-13
- Page: https://patchtonight.com/cve/CVE-2026-42945/

## Affected and fixed versions

| Affected | Fixed in |
| --- | --- |
| NGINX Open Source 0.6.27 to 1.30.0 | 1.30.1 or 1.31.0 or later |
| NGINX Plus R36 | R36 P4 or later |
| NGINX Plus R32 | R32 P6 or later |
| NGINX Plus R37 | Not affected |

## What it is

A heap buffer overflow (CWE-122) in NGINX's `ngx_http_rewrite_module`, nicknamed **NGINX Rift** by depthfirst, which found it. The bug has been in NGINX since version 0.6.27, about 18 years.

It only triggers with a specific configuration: a `rewrite` that uses an **unnamed regex capture** (`$1`, `$2`) in a replacement containing a **question mark**, followed in the same scope by another `rewrite`, `if` or `set`. On such a server, an unauthenticated attacker's crafted request overflows the heap in the worker process.

- **Denial of service:** the worker crashes and restarts. Repeated requests keep workers crash-looping, according to depthfirst. Help Net Security reports that the crash works on default builds.
- **Code execution:** possible where **ASLR is disabled** or the attacker can bypass it, according to F5, VulnCheck and Kevin Beaumont. depthfirst says the corrupted bytes are shaped by the attacker's URI.

depthfirst published exploit code on GitHub on disclosure day. VulnCheck's canary systems saw exploitation attempts from May 16, three days later. Help Net Security describes these as attempts. No successful compromises have been reported, and the CVE is not in CISA's KEV catalog.

F5 scores it 9.2 in CVSS 4.0 (8.1 in CVSS 3.1). nginx.org rates it "medium", because only some configurations are exposed.

## Am I affected?

**Yes, if both are true:**

1. You run NGINX Open Source 0.6.27 to 1.30.0, or NGINX Plus R32 or R36 before the fixed patch (table above). Distribution packages often carry their own fixes, so check your vendor's advisory too. Red Hat, for example, has published errata.
2. Your configuration has the pattern above: a `rewrite` with `$1`-style captures and a `?` in the replacement, followed by another `rewrite`, `if` or `set` in the same block.

This is an example of the kind of rewrite involved, from depthfirst:

```nginx
rewrite ^/users/([0-9]+)/profile/(.*)$ /profile.php?id=$1&tab=$2 last;
```

Search every included file, not just `nginx.conf`. `nginx -T` prints the full configuration, including includes.

**Not affected:** NGINX Open Source 1.31.0 and later, and NGINX Plus R37. F5 did not evaluate releases past End of Technical Support.

## What to do

1. **Upgrade.** NGINX Open Source to 1.30.1 (stable) or 1.31.0 (mainline) or later. NGINX Plus to R36 P4, R32 P6 or R37. Remember the NGINX inside appliances, containers and ingress controllers.
2. **If you can't upgrade yet, switch the affected rewrites to named captures.** This is depthfirst's mitigation:

```nginx
rewrite ^/users/(?<user_id>[0-9]+)/profile/(?<section>.*)$ /profile.php?id=$user_id&tab=$section last;
```

3. **Make sure ASLR is enabled** on hosts running NGINX. It does not stop the crash, but it is what stands between this bug and code execution.
4. **If a vulnerable server was internet-facing,** check it (below). If you find signs of code execution, rebuild the host and rotate the TLS keys and any credentials it held.

## Detection

No indicators of compromise have been published.

- **Worker crashes in the NGINX error log.** Look for workers exiting on a signal, such as segmentation faults, and for a sudden rise in worker restarts.
- **Requests that line up with the crashes.** Long, odd URIs aimed at paths handled by the vulnerable `rewrite` rules, especially from one source in a short time.
- **After a crash, unexpected child processes** of NGINX workers or outbound connections from the server, which would point to code execution.

## Sources

- [F5 advisory K000161019](https://my.f5.com/manage/s/article/K000161019)
- [nginx.org security advisories](https://nginx.org/en/security_advisories.html)
- [CVE record](https://cveawg.mitre.org/api/cve/CVE-2026-42945)
- [depthfirst, NGINX Rift](https://depthfirst.com/nginx-rift)
- [depthfirst exploit code on GitHub](https://github.com/DepthFirstDisclosures/Nginx-Rift)
- [Help Net Security, VulnCheck reports exploitation attempts](https://www.helpnetsecurity.com/2026/05/18/ngnix-vulnerability-exploited-cve-2026-42945/)

---

Data from PatchTonight (https://patchtonight.com), compiled from vendor advisories, CISA KEV and FIRST EPSS. Please credit PatchTonight and link to the CVE page when you use it.
