Skip to content
Memory corruption Write-up Advanced

Nginx Rift (CVE-2026–42945)-Part2

A heap overflow in Nginx's rewrite engine occurs when a rewrite rule with a question mark sets argument mode, but a later complex value sizing pass uses a fresh engine that does not inherit this state. The length calculation therefore omits URI escaping while the copy pass applies it, causing the copy to write more bytes than allocated and potentially allowing remote memory corruption.

medium.com

Published on medium.com

medium.com](https://medium.com/@rezauditore/nginx-rift-cve-2026-42945-92e58b3e3128)

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 sizing pass uses a freshly initialised script engine that does not copy the is_args flag from the execution engine, so the length calculation and the copy operation disagree on whether URI escaping is needed.

Impact

A remote attacker could trigger a heap overflow, potentially leading to memory corruption, though the text does not demonstrate full exploitation.

What the attacker needed

Nginx configured with a rewrite rule containing '?'; A later directive uses a regex capture in a complex value

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. When a rule contains a question mark, the server switches into a mode where certain characters in the URL must be escaped (for example, & becomes %26). The bug is that one part of the code calculates how much space is needed without knowing about this mode, while another part writes the escaped data, so it writes more than was reserved and can corrupt memory.

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.