NGINX Rift — CVE-2026-42945 Heap Buffer Overflow in ngx_http_rewrite_module (CVSS v4 9.2 Critical, 18-Year-Old Pre-Auth RCE, Public PoC)

NGINX Rift — CVE-2026-42945 Heap Buffer Overflow in (TL-2026-0517), also tracked as NGINX Rift, is a critical-severity software vulnerability scored CVSS 9.2, first published 2026-05-14. It has no confirmed attribution, affects F5 / NGINX NGINX Open Source, references 3 CVEs (CVE-2026-42945, CVE-2026-42946, CVE-2026-40701), maps to 27 MITRE ATT&CK techniques (T1005, T1036.005, T1046), and is covered by 9 detection rules and 26 indicators of compromise.

Key facts for TL-2026-0517

Threat ID
TL-2026-0517
Also known as
NGINX Rift, Rift, CVE-2026-42945
Severity
CRITICAL
CVSS
9.2 (CVSS:4.0/AV:N/AC:H/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N)
Status
ACTIVE
Category
VULNERABILITY
First published
2026-05-14
Last reviewed
2026-05-14
Attribution confidence
NONE
Motivation
UNKNOWN
Target sectors
government, financial, healthcare, technology, telecommunications, ecommerce, media, education, cloud, managed-services, critical-infrastructure
Target regions
Global, North America, Europe, Asia-Pacific, Latin America, Middle East, Africa
Detection rules
9
Indicators of compromise
26

Malware and tooling in NGINX Rift — CVE-2026-42945 Heap Buffer Overflow in

Malware and tooling: DepthFirst Autonomous Vulnerability Discovery, Generic ROP/shellcode payload over HTTP request body, Nginx-Rift

NGINX Rift (CVE-2026-42945) is an unauthenticated heap-based buffer overflow in the ngx_http_rewrite_module that affects NGINX Open Source 0.6.27 through 1.30.0 and NGINX Plus R32 through R36, disclosed by autonomous vulnerability researcher DepthFirst on 2026-05-13. A specific configuration idiom — a rewrite directive followed by a rewrite, if, or set directive in the same scope, combined with an unnamed PCRE capture ($1, $2, ...) whose replacement string contains a question mark — allows a crafted HTTP request to corrupt the heap of an NGINX worker process. The deterministic outcome is a worker crash and denial of service; on hosts with ASLR disabled (embedded appliances, legacy containers, statically-linked builds) the primary is remote code execution. F5 issued fixes in 1.31.0, 1.30.1, NGINX Plus R36 P4 and R32 P6 the same day as disclosure, and a public weaponizable PoC is hosted at DepthFirstDisclosures/Nginx-Rift on GitHub.

How NGINX Rift — CVE-2026-42945 Heap Buffer Overflow in works

## Overview

NGINX Rift, tracked as CVE-2026-42945, is a heap-based buffer overflow (CWE-122) in NGINX's ngx_http_rewrite_module discovered and disclosed by autonomous vulnerability discovery system DepthFirst on 2026-05-13. F5 Networks, the CNA for NGINX, assigned a CVSS v4.0 base score of 9.2 (Critical) and a CVSS v3.1 score of 8.1 (High), reflecting unauthenticated network exploitation with high impact on confidentiality, integrity, and availability. The flaw exists in code dating back to NGINX 0.6.27 (2009), making it an 18-year-old vulnerability in the world's most widely deployed reverse proxy and web server — NGINX powers an estimated 33% of the public web by request volume.

## Affected Code Path and Trigger

The vulnerable logic lives in ngx_http_rewrite_module.c's handling of regex captures during rewrite, if, and set directive evaluation. When a rewrite directive uses an unnamed PCRE capture group reference ($1, $2, $3, ...) and the replacement string contains a literal question mark, NGINX's variable-substitution code path miscalculates the destination buffer size for the rewritten URI. A second rewrite, if, or set directive in the same location/server scope that operates on the rewritten value then triggers an out-of-bounds write into the worker heap. The buffer underprovision is deterministic, and the overflow primitive overwrites adjacent heap chunk metadata and pool-allocator structures, allowing controlled corruption of NGINX's ngx_pool_t arena.

The trigger configuration idiom is common in production:

``` location / { rewrite ^/old/(.*)$ /new/$1?legacy=true; # unnamed capture + '?' in replacement if ($http_user_agent ~* bot) { # second directive operating on URI return 403; } } ```

Any request to the affected location with a URL that matches the rewrite pattern triggers the overflow. No authentication, no user interaction, and no special headers are required — the entire exploitation primitive is reachable from an anonymous HTTP request.

## Exploit Chain

1. **Reconnaissance** — Attacker identifies NGINX targets via Shodan, Censys, or banner fingerprinting (Server header). The Rift PoC includes a passive fingerprint that estimates the configuration shape using probe requests against /robots.txt, /favicon.ico, and common rewrite-target paths to detect rewrite chains. 2. **Configuration Probing** — DepthFirst's writeup documents a heuristic prober that sends requests with sentinel patterns (e.g., /old/AAAA?test=BBBB) to detect rewrite-chain behavior in the HTTP response (302 Location header, internal redirect chain length, response timing). 3. **Heap Spray and Layout** — The exploit primes the NGINX pool allocator by issuing 100–500 large requests with controlled header values to populate adjacent heap chunks with attacker-controlled data. Pool fragmentation creates predictable layout for the overflow target. 4. **Trigger Request** — The attacker sends the malformed request that triggers the rewrite overflow. The overflow corrupts an adjacent pool_cleanup_t struct's cleanup handler pointer, which NGINX dereferences on connection teardown. 5. **Control Hijack (ASLR disabled)** — When ASLR is disabled at the OS or binary level (common on stripped containers, embedded appliances, and statically-linked NGINX builds), the attacker overwrites the cleanup handler with a known address pointing to a ROP gadget or a system() call. NGINX's master process retains setuid root capability for binding low ports, but workers drop to nobody; RCE executes as the worker user (commonly nginx, www-data, or nobody). 6. **Denial of Service (ASLR enabled)** — When ASLR is enabled, the dereferenced pointer is unpredictable and the worker SIGSEGVs. NGINX master respawns the worker, but a sustained exploit campaign exhausts the worker_processes pool and creates a denial-of-service condition.

## Why the 18-Year Lifespan

The overflow has existed since NGINX 0.6.27 (released October 2009) because the buffer-size calculation for PCRE replacements predates the inclusion of '?' as a special URI delimiter in the rewrite pipeline. The bug was not caught by AddressSanitizer or libFuzzer runs because the trigger requires a specific multi-directive configuration that public fuzzing harnesses did not generate. DepthFirst's autonomous discovery system used grammar-guided configuration synthesis combined with constraint-solving over PCRE replacement strings to find the trigger pattern.

## Public PoC and Weaponization Status

A public PoC named Nginx-Rift was published to https://github.com/DepthFirstDisclosures/Nginx-Rift on 2026-05-13 (same day as disclosure) and as of 2026-05-14 has 433 stars and 77 forks. The repository contains:

- A Python exploit (rift.py) that probes for the vulnerability and delivers the DoS payload - A Docker test harness with vulnerable NGINX 1.30.0 configured with a triggering rewrite chain - A configuration auditor that scans nginx.conf files for vulnerable patterns - A constraint-solving module that generates working PCRE captures plus replacement strings tailored to a target's URL space

The RCE primitive (cleanup-handler hijack) is documented in the DepthFirst writeup but is not weaponized in the public PoC; only the DoS path is provided.

## Affected NGINX Family Products

F5 confirmed the vulnerable code path is shared across the entire NGINX product family: NGINX Open Source 0.6.27 through 1.30.0; NGINX Plus R32 through R36; NGINX Instance Manager 2.16.0 through 2.21.1; F5 WAF for NGINX 5.9.0 through 5.12.1; NGINX App Protect WAF 4.9.0 through 4.16.0 and 5.1.0 through 5.8.0; F5 DoS for NGINX 4.8.0; NGINX App Protect DoS 4.3.0 through 4.7.0; NGINX Gateway Fabric 1.3.0 through 1.6.2 and 2.0.0 through 2.5.1; NGINX Ingress Controller 3.5.0 through 3.7.2, 4.0.0 through 4.0.1, and 5.0.0 through 5.4.1. Products on F5's distributed cloud platforms (F5 Distributed Cloud, F5 Silverline, NGINX One Console) and the BIG-IP/BIG-IQ/F5OS line are not affected — they share TMOS code and do not link the vulnerable ngx_http_rewrite_module.

## Companion CVEs in the Advisory

F5 disclosed two additional medium-severity issues alongside CVE-2026-42945. CVE-2026-42946 is a buffer overread in ngx_http_scgi_module and ngx_http_uwsgi_module that leaks up to 64 bytes of adjacent worker memory through SCGI/uWSGI upstream responses; this affects information disclosure but not memory corruption. CVE-2026-40701 is a use-after-free in the ngx_resolver during OCSP stapling response handling that requires a malicious upstream DNS server to trigger. Both are fixed in the same 1.31.0 and 1.30.1 releases.

## Detection and Response

Defenders should:

- Upgrade to NGINX 1.31.0 (mainline), 1.30.1 (stable), NGINX Plus R36 P4, or NGINX Plus R32 P6 immediately - Audit nginx.conf for the trigger pattern: rewrite/if/set directives that share scope with another rewrite using $N captures and a question mark in the replacement - Enable ASLR on all NGINX hosts (cat /proc/sys/kernel/randomza_va_space should be 2) - Deploy WAF rules that block requests where the URI matches a configured rewrite pattern and contains overly long capture-targetable substrings - Monitor for repeated worker_process crashes via systemd-journald, nginx error log SIGSEGV entries, and Prometheus node_exporter process_resident_memory_bytes anomalies

MITRE ATT&CK techniques used in TL-2026-0517

Collection

T1005 Data from Local System

Defense Evasion

T1036.005 Match Legitimate Resource Name or Location; T1070.004 Indicator Removal: File Deletion

Discovery

T1046 Network Service Discovery; T1057 Process Discovery; T1082 System Information Discovery

Execution

T1059.004 Command and Scripting Interpreter: Unix Shell; T1203 Exploitation for Client Execution

Privilege Escalation

T1068 Exploitation for Privilege Escalation

Command and Control

T1071.001 Application Layer Protocol: Web Protocols; T1105 Ingress Tool Transfer

Initial Access

T1133 External Remote Services; T1190 Exploit Public-Facing Application

Impact

T1489 Service Stop; T1499.002 Endpoint Denial of Service: Service Exhaustion Flood; T1499.004 Application or System Exploitation

Persistence

T1505.003 Server Software Component: Web Shell; T1543.002 Create or Modify System Process: Systemd Service

Credential Access

T1552.001 Unsecured Credentials: Credentials In Files

Lateral Movement

T1570 Lateral Tool Transfer

Resource Development

T1587.004 Develop Capabilities: Exploits; T1588.005 Obtain Capabilities: Exploits; T1588.006 Obtain Capabilities: Vulnerabilities

Reconnaissance

T1592.002 Gather Victim Host Information: Software; T1595 Active Scanning; T1595.002 Active Scanning: Vulnerability Scanning; T1596.005 Search Open Technical Databases: Scan Databases

Affected products and versions in NGINX Rift — CVE-2026-42945 Heap Buffer Overflow in

  • F5 / NGINX — NGINX Open Source
    Vulnerable versions: 0.6.27 through 1.30.0
    Fixed in: 1.31.0; 1.30.1
  • F5 / NGINX — NGINX Plus
    Vulnerable versions: R32 through R36
    Fixed in: R36 P4; R32 P6
  • F5 / NGINX — NGINX Instance Manager
    Vulnerable versions: 2.16.0 through 2.21.1
    Fixed in: awaiting vendor advisory update
  • F5 — F5 WAF for NGINX
    Vulnerable versions: 5.9.0 through 5.12.1
    Fixed in: awaiting vendor advisory update
  • F5 / NGINX — NGINX App Protect WAF
    Vulnerable versions: 4.9.0 through 4.16.0; 5.1.0 through 5.8.0
    Fixed in: awaiting vendor advisory update
  • F5 — F5 DoS for NGINX
    Vulnerable versions: 4.8.0
    Fixed in: awaiting vendor advisory update
  • F5 / NGINX — NGINX App Protect DoS
    Vulnerable versions: 4.3.0 through 4.7.0
    Fixed in: awaiting vendor advisory update
  • F5 / NGINX — NGINX Gateway Fabric
    Vulnerable versions: 1.3.0 through 1.6.2; 2.0.0 through 2.5.1
    Fixed in: awaiting vendor advisory update
  • F5 / NGINX — NGINX Ingress Controller
    Vulnerable versions: 3.5.0 through 3.7.2; 4.0.0 through 4.0.1; 5.0.0 through 5.4.1
    Fixed in: awaiting vendor advisory update

Remediation for NGINX Rift — CVE-2026-42945 Heap Buffer Overflow in

Patches

  • NGINX Open Source 1.31.0
  • NGINX Open Source 1.30.1
  • NGINX Plus R36 P4
  • NGINX Plus R32 P6
  • Vendor-curated builds from upstream Debian, Ubuntu, RHEL, Alpine, and Amazon Linux distributions tracking the 1.30.1 / 1.31.0 backport

Immediate actions

  • Upgrade NGINX Open Source to 1.31.0 (mainline) or 1.30.1 (stable)
  • Upgrade NGINX Plus to R36 P4 or R32 P6
  • Audit nginx.conf and included files for the trigger pattern: rewrite + rewrite/if/set in the same scope using unnamed captures ($1..$9) where the replacement string contains a literal '?'
  • Block external traffic to NGINX endpoints exposing affected rewrite chains until patched
  • Verify ASLR is enabled on all NGINX hosts (echo 2 > /proc/sys/kernel/randomize_va_space)

Workarounds

  • Remove or rewrite vulnerable rewrite chains: replace unnamed captures with named captures and move query-string construction out of the rewrite replacement
  • Insert a 'return 444' or 'return 400' at the top of locations that contain vulnerable rewrite idioms until the patch is applied
  • Deploy a reverse-proxy WAF in front of NGINX (HAProxy with ModSecurity, Envoy, or cloud WAF) to filter requests matching the rewrite-trigger surface
  • Lower worker_processes count and increase worker_connections to absorb worker crash storms while patching

Longer-term hardening

  • Standardize on NGINX configurations that use named captures (?<name>...) and explicit query-string handling instead of '?' in rewrite replacements
  • Deploy upstream-of-NGINX WAF (e.g., F5 Distributed Cloud, Cloudflare, Imperva) with rules that block oversized URI paths or anomalous rewrite-chain inputs
  • Build CI checks that run nginx -T and a configuration linter against the DepthFirst Rift auditor pattern set to catch reintroduction
  • Enforce least-privilege worker user (nginx or www-data with no shell, no write to webroot) and AppArmor/SELinux confinement for the nginx worker process
  • Subscribe to F5 NGINX security advisories and CISA KEV for follow-on related issues

CVEs associated with NGINX Rift — CVE-2026-42945 Heap Buffer Overflow in

CVE-2026-42945, CVE-2026-42946, CVE-2026-40701

Weaknesses (CWE) in NGINX Rift — CVE-2026-42945 Heap Buffer Overflow in

CWE-122, CWE-787, CWE-126, CWE-416

Timeline of NGINX Rift — CVE-2026-42945 Heap Buffer Overflow in

  • NGINX 0.6.27 released; ngx_http_rewrite_module buffer-size calculation for PCRE replacements containing '?' introduces the off-by-N heap miscalculation that becomes CVE-2026-42945.
  • DepthFirst autonomous vulnerability discovery system identifies anomalous heap behavior in ngx_http_rewrite_module via grammar-guided configuration fuzzing combined with PCRE constraint-solving.
  • DepthFirst privately discloses CVE-2026-42945 to F5 NGINX Security team under 90-day coordinated disclosure.
  • F5 NGINX engineering completes the fix for ngx_http_rewrite_module and begins internal regression testing across NGINX Plus and NGINX Ingress Controller builds.
  • DepthFirstDisclosures/Nginx-Rift repository goes live on GitHub with a Python exploit (rift.py), Docker harness reproducing the heap overflow on NGINX 1.30.0, and a configuration auditor for vulnerable rewrite patterns.
  • NVD publishes CVE-2026-42945 (CVSS v4.0 9.2 Critical), CVE-2026-42946 (medium buffer overread), and CVE-2026-40701 (medium use-after-free) as the combined F5 NGINX advisory cluster.
  • F5 publishes Security Advisory K000161019, NGINX Open Source 1.31.0 and 1.30.1 ship, NGINX Plus R36 P4 and R32 P6 release simultaneously; DepthFirst publishes the technical writeup and the Nginx-Rift PoC repository on GitHub.
  • Threadlinqs Intelligence publishes TL-2026-0517 with MITRE ATT&CK kill-chain mapping, full exploit chain analysis, IOC pack for configuration auditing and exploit detection, and detection rule coverage across Splunk SPL, Microsoft KQL, and Sigma.
  • Nginx-Rift PoC reaches 433 stars and 77 forks within 24 hours; multiple proof-of-exploit videos circulate on infosec social media; major Linux distributions (Debian, Ubuntu, RHEL, Alpine, Amazon Linux) begin backporting the 1.30.1 fix.
  • As of 2026-05-29, CVE-2026-42945 (NGINX Rift) remains a live, actively exploited critical flaw: VulnCheck confirmed in-the-wild exploitation against honeypots from 2026-05-16 and a public PoC with an ASLR-bypass RCE chain exists. Despite F5 patches on disclosure day, ~5.7M exposed NGINX servers are still vulnerable and unpatched.

Sources cited for NGINX Rift — CVE-2026-42945 Heap Buffer Overflow in

Threats related to NGINX Rift — CVE-2026-42945 Heap Buffer Overflow in

Detection coverage for TL-2026-0517

As of 2026-05-14, Threadlinqs Intelligence publishes 9 detection rule(s) for TL-2026-0517 across Splunk SPL, Microsoft KQL and Sigma, covering 26 indicator(s) of compromise. The whole corpus is readable without an account; a free account unlocks full detection query text in Splunk SPL, Microsoft KQL and Sigma; paid tiers add raw indicator values, correlation and the MCP server. Threadlinqs MCP server · View plans.

Threadlinqs Intelligence — Real-Time Threat Detection Platform

[ 0 threats ] [ 0 det ] [ CRIT: 0 ] [ HIGH: 0 ]
// threat_feed
$ sort --newest
Showing all threats

Latest Threats