Skip to content
Memory corruption Write-up Advanced

Nginx Rift (CVE-2026–42945)

A state mismatch between the length-calculation and data-copying passes of Nginx's rewrite engine causes a heap buffer overflow when a rewrite replacement contains a question mark and later references unnamed regex captures. An attacker could send a crafted HTTP request to crash a worker process, and under favourable conditions may achieve controlled memory corruption.

rezauditore Follow

Published on medium.com

Bro, Nginx has earned a reputation as one of the most battle tested pieces of infrastructure on the Internet.

rezauditore, 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 length-calculation pass uses a temporary engine where the is_args flag is 0, while the copy pass uses the primary engine where is_args is 1, so the two passes disagree on whether capture data must be escaped.

Impact

A malformed request can crash a worker process, and repeated requests can create a crash loop; under favourable conditions a carefully crafted overwrite may provide a path toward arbitrary code execution.

What the attacker needed

Crafted HTTP request; rewrite rule with ? and unnamed captures

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 using rules. It first works out how much space the rewritten URL will need, then fills a buffer of that size. Here the two steps disagreed about whether to escape certain characters, so the second step wrote more data than the first had reserved, overflowing the buffer.

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.

More by rezauditore

View all

1 more disclosed report, best first.

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.