Skip to content
Memory corruption Write-up Advanced

CVE-2026–42945: Understanding NGINX Rift

A heap buffer overflow in NGINX's rewrite module occurs when a rewrite rule captures part of the URL, the rewrite target contains a question mark, and a later directive reuses the captured data. An unauthenticated attacker could crash a worker process and, under favourable memory conditions, potentially achieve remote code execution.

medium.com

Published on medium.com

The vulnerability was publicly disclosed on May 13, 2026 by depthfirst, alongside several other memory corruption issues found during the same audit.

Mr. Spider, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

The measurement and write stages disagree on the size of the captured value because the query-string handling state escapes characters like '+' into '%2B', causing a heap overflow.

Impact

An attacker could crash an NGINX worker process, causing a denial of service, and may potentially achieve remote code execution under favourable memory conditions, though exploitation is difficult due to limited byte-level control.

What the attacker needed

Specific rewrite configuration; unauthenticated remote access

The fix

The vulnerability was fixed in NGINX Open Source 1.30.1 and 1.31.0, and NGINX Plus R32 P6, R36 P4, and 37.0.0.

How it was found

  1. Set up a vulnerable NGINX configuration with a rewrite rule that captures part of the URL, a rewrite target containing a question mark, and a later directive that reuses the captured data.
  2. Send a request with a captured value containing many plus signs to trigger the overflow.
  3. Run the proof-of-concept script in single-command mode to confirm command execution.
  4. Run the proof-of-concept script in shell mode to obtain an interactive shell.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

NGINX is a web server that can rewrite URLs. In a specific configuration, it first calculates how much memory it needs for a captured part of the URL, but then writes a longer, escaped version into that same memory. This overflow can crash the server and, in rare cases, let an attacker run their own code.

What is Memory corruption?

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.