Task 1: Introduction
NGINX Rift is a heap buffer overflow in the ngx_http_rewrite_module of NGINX that allows an unauthenticated remote attacker to crash a worker process or, under favourable memory conditions, achieve remote code execution. The bug has been present in the codebase since 2008 and was disclosed on 13 May 2026 by depthfirst, alongside three other memory corruption issues identified during the same audit.
Key facts:
- CVSS v4 base score: 9.2 (Critical)
- Affected components: NGINX Open Source 0.6.27 through 1.30.0, NGINX Plus R32 through R36, and several downstream F5 products including NGINX App Protect, Gateway Fabric, and Ingress Controller
- Fixed versions: NGINX Open Source 1.30.1 and 1.31.0, NGINX Plus R32 P6, R36 P4, and 37.0.0 (the first release on the new Long-Term Support track introduced on 13 May 2026)
- Public PoC: Available on the DepthFirstDisclosures/Nginx-Rift repository
The vulnerability is not reachable on every NGINX install. It requires a configuration that uses the rewrite directive with an unnamed PCRE capture (such as $1 or $2), a replacement string containing a question mark, and a subsequent rewrite, if, or set directive in the same scope. This pattern is common in production deployments that perform legacy URL canonicalisation, API gateway routing, or path preservation across migrations, so the realistic exposure is considerably broader than the trigger condition might first suggest.
Three other vulnerabilities were disclosed alongside Rift in the same audit. The full set is summarised below:
| CVE | Subsystem | Severity | Impact |
|---|---|---|---|
CVE-2026-42945 (Rift) |
ngx_http_rewrite_module |
9.2 Critical | Heap overflow, RCE |
CVE-2026-42946 |
ngx_http_scgi_module, ngx_http_uwsgi_module |
8.3 High | Heap overread on crafted upstream response (AitM), worker memory disclosure or DoS |
CVE-2026-40701 |
ngx_http_ssl_module |
6.3 Medium | Use-after-free on OCSP DNS path |
CVE-2026-42934 |
ngx_http_charset_module |
6.3 Medium | Out-of-bounds read on UTF-8 boundary |
Rift is the most severe of the four because it is unauthenticated, deterministic in heap layout across worker processes, and reachable on widely deployed configurations. The same multi-process architecture that makes NGINX a reliable web server (a master process and several identical workers, each with a duplicated address space) also makes the bug forgiving to exploit. A failed attempt only crashes a worker; the master immediately respawns a fresh worker with the same memory layout, so an attacker can retry until the exploit succeeds.
Learning Objectives
By the end of this room, you will be able to:
- Describe the role of the
rewriteandsetdirectives in NGINX request processing - Explain the two-pass design of the NGINX script engine and how a state mismatch between passes causes the heap overflow
- Identify the configuration pattern that exposes a server to
CVE-2026-42945 - Walk through the heap feng shui technique used to convert the overflow into code execution
- Apply the published configuration mitigation and confirm the proof-of-concept is blocked
Prerequisites
This room assumes comfort with HTTP request structure, the basics of reverse proxying, and operation from a Linux command line. Familiarity with the Web Fundamentals module and the Linux Fundamentals module is sufficient. Prior exposure to heap memory corruption concepts is helpful but not required; the relevant heap concepts are introduced in Task 4 as they appear.
Connecting to the Machine
Click the Start Lab Machine button at the top of this task and allow about a minute for the machine to boot. The room provides a graphical VNC session that opens in a new browser window; the desktop session is already logged in as the ubuntu user. The vulnerable NGINX target runs on port 19321, so the target is reachable from the VNC desktop at http://127.0.0.1:19321/ and from a remote attacker at http://MACHINE_IP:19321/, where MACHINE_IP is the address shown at the top of this task. The full launch state and the exploitation procedure are covered in Task 5.
Answer the questions below
I have successfully started my machine.