NGINX Open Source and NGINX Plus (rewrite module)
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.
Published Updated F5 advisory K000161019
Affected and fixed versions
| Product / branch | 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 |
Always confirm against the vendor advisory, which lists every fixed hotfix.
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:
- 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.
- Your configuration has the pattern above: a
rewritewith$1-style captures and a?in the replacement, followed by anotherrewrite,iforsetin the same block.
This is an example of the kind of rewrite involved, from depthfirst:
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
- 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.
- If you can’t upgrade yet, switch the affected rewrites to named captures. This is depthfirst’s mitigation:
rewrite ^/users/(?<user_id>[0-9]+)/profile/(?<section>.*)$ /profile.php?id=$user_id&tab=$section last;
- 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.
- 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
rewriterules, 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.
Indicators of compromise
No indicators of compromise have been published for this CVE yet. We'll add them here if the vendor or a researcher releases any. Until then, use the behaviour in Detection.
Sources
Spotted a mistake on this page? Tell us, and we'll fix it.
Page changelog
- Full analysis published.
KEV status, EPSS score and vendor data refreshed automatically, last on 3 Dec 2026.