June 14, 2026

PBX Science

VoIP & PBX, Networking, DIY, Computers.

NGINX Rift: An 18-Year-Old Flaw in the World’s Most-Used Web Server Now Enables Unauthenticated Remote Code Execution

NGINX Rift: An 18-Year-Old Flaw in the World’s Most-Used Web Server Now Enables Unauthenticated Remote Code Execution



NGINX Rift: CVE-2026-42945 β€” Critical 18-Year-Old RCE Vulnerability
⚠ Security Advisory β€” CVSS 9.2 Β· Critical Β· Active PoC Published
Critical Vulnerability

NGINX Rift: An 18-Year-Old Flaw in the World’s Most-Used Web Server Now Enables Unauthenticated Remote Code Execution

CVE-2026-42945, a heap buffer overflow dormant since 2008, was disclosed on May 13, 2026 alongside a working public proof-of-concept. Hundreds of millions of servers are affected. Here is everything administrators need to know.

βš‘ Immediate Action Required

A working exploit is publicly available on GitHub. If your NGINX configuration uses rewrite and set directives together with unnamed capture groups ($1, $2) and a ? in the replacement string, you are potentially exploitable right now. Patch or apply the workaround immediately.

CVE ID
CVE-2026-42945
CVSS v4 Score
9.2
Dormant For
18 yrs

Background & Discovery

On May 13, 2026, security research firm depthfirst β€” in coordinated disclosure with F5 β€” published details of a critical vulnerability lurking inside NGINX since 2008. The bug was autonomously found in April 2026 when the depthfirst AI-assisted analysis system scanned the NGINX source code and flagged four separate memory corruption flaws. The most severe of these was assigned CVE-2026-42945 with a CVSS v4 score of 9.2 (Critical).

Nicknamed NGINX Rift, the vulnerability is a heap buffer overflow residing in ngx_http_rewrite_module β€” the core script engine that processes URL rewrite rules, used in virtually every non-trivial NGINX deployment worldwide. A public proof-of-concept (PoC) exploit was released on GitHub hours after disclosure, dramatically compressing the window for administrators to act.

“An attacker who can reach a vulnerable NGINX server over HTTP can send a single request that overflows the heap in the worker process and achieves remote code execution. There is no authentication step, no prior access requirement, and no need for an existing session.”
β€” depthfirst security advisory

Root Cause: A State Mismatch Across Two Engine Passes

NGINX’s internal script engine handles rewrite directives using a two-pass architecture:

  • Pass 1 (Length Calculation): A freshly zeroed sub-engine calculates how large the output buffer needs to be, then allocates that memory.
  • Pass 2 (Data Copy): The main engine writes the actual data into the allocated buffer.

The critical failure occurs when a rewrite directive contains a question mark (?). This permanently sets an is_args = 1 flag on the main engine. However, the length-calculation sub-engine is zeroed β€” so it runs with is_args = 0 and does not account for URI escaping.

During the write pass, the main engine applies URI percent-encoding, which can expand a single byte into three bytes (e.g., a space becomes %20). The result: the write pass overflows the undersized heap buffer with attacker-controlled URI data. This heap overflow can corrupt adjacent memory structures in the NGINX worker process and, with precise exploitation, achieve remote code execution.

Simplified illustration of the mismatch
# Length pass uses sub-engine (is_args = 0) allocated_size = raw_capture_length # e.g. 10 bytes # Write pass uses main engine (is_args = 1 β†’ URI escaping active) bytes_written = escaped_length # e.g. 28 bytes β€” OVERFLOW! # Result: writes 28 bytes into a 10-byte heap buffer β†’ Heap buffer overflow β†’ memory corruption β†’ potential RCE

Important nuance: The vulnerability is configuration-dependent. It requires the use of both a rewrite and a set directive in combination, with an unnamed PCRE capture group ($1, $2) and a replacement string containing ?. Not every NGINX installation is automatically exploitable β€” but this combination is extremely common in API gateway and application routing configurations.

Exploitation Chain: No Login Required

The depthfirst team demonstrated a full, reliable exploit chain using techniques that bypass NGINX’s memory protections:

1
Trigger the Overflow

An unauthenticated attacker sends a single crafted HTTP request to a route using the vulnerable rewrite + set configuration pattern. No credentials, session, or prior access needed.

2
Cross-Request Heap Feng Shui

Because NGINX forks worker processes from a master, the heap layout is deterministic across all workers. Attackers open a second connection to manipulate allocations so the victim pool lands adjacent to the attacker-controlled pool.

3
Corrupt the Cleanup Pointer

The overflow is used to overwrite the cleanup pointer in an adjacent ngx_pool_t structure. POST request bodies spray the payload since URI bytes cannot contain null bytes.

4
Remote Code Execution

When the pool is destroyed, the corrupted pointer redirects execution to a fake cleanup structure invoking system() β€” achieving arbitrary command execution as the NGINX worker user.

On hardened systems with ASLR fully enabled, the realistic worst case may be a worker process crash (DoS) rather than full RCE. However, NGINX’s deterministic multi-process architecture significantly aids exploitation, and the researchers demonstrated reliable code execution in their PoC.

Affected Products & Versions

Product Affected Versions Fixed In
NGINX Open Source 0.6.27 – 1.30.0 1.30.1 / 1.31.0
NGINX Open Source (legacy) 0.6.27 – 0.9.7 No fix planned
NGINX Plus R32 – R36 R32 P6 / R36 P4
NGINX Instance Manager 2.16.0 – 2.21.1 Check F5 advisory
NGINX App Protect WAF 4.9.0–4.16.0 / 5.1.0–5.8.0 Check F5 advisory
NGINX Gateway Fabric 1.3.0–1.6.2 / 2.0.0–2.5.1 Check F5 advisory
NGINX Ingress Controller 3.5.0–5.4.1 (various) Check F5 advisory

Note for distribution users: If you run a distribution-packaged NGINX (Ubuntu, Debian, CentOS, etc.), do not assume you are safe based on the package name alone. Confirm the actual NGINX version number with nginx -v.

Remediation & Mitigation

βœ“ Recommended

Upgrade Immediately

Upgrade to NGINX Open Source 1.30.1 or 1.31.0, or NGINX Plus R36 P4 / R32 P6. Restart the service after patching for the fix to take effect.

⚡ If Patching Is Not Immediately Possible

Use Named Capture Groups

Replace all unnamed captures ($1, $2) with named captures in vulnerable rewrite rules. This eliminates the trigger condition.

Workaround β€” before (risky)
# VULNERABLE: unnamed capture + ? in replacement rewrite ^/api/(.*)$ /v2/$1? last;
Workaround β€” after (safe)
# SAFE: named capture group eliminates the trigger rewrite ^/api/(?P<path>.*)$ /v2/${path}? last;
Quick audit command β€” Run this on your server to identify potentially vulnerable rewrite rules:

grep -rn 'rewrite' /etc/nginx/ | grep '\$[0-9]' | grep '?'

Any output indicates a configuration that matches the trigger pattern and requires immediate attention.
Post-upgrade verification commands
# Confirm the installed version nginx -v # Test configuration syntax nginx -t # Reload/restart the service systemctl restart nginx

Disclosure Timeline

DECEMBER 2008

Vulnerable code introduced with NGINX 0.6.27. The bug lies dormant across all subsequent releases.

APRIL 18, 2026

depthfirst’s autonomous analysis system scans the NGINX source code and detects four memory corruption issues, including CVE-2026-42945.

APRIL 21, 2026

depthfirst reports all five identified issues to NGINX via a GitHub security advisory.

APRIL 24, 2026

F5/NGINX confirms four of the five reported vulnerabilities.

APRIL 28, 2026

depthfirst informs NGINX that a working RCE proof-of-concept has been developed.

MAY 5, 2026

depthfirst shares the RCE PoC with F5/NGINX along with a demonstration video.

MAY 13, 2026

F5 releases the coordinated advisory and patched versions. depthfirst publishes full technical write-up and PoC source code on GitHub.

MAY 14, 2026 β€” TODAY

PoC is publicly available. Active exploitation risk is high. Administrators must act immediately.

Why This Matters

NGINX powers an estimated one-third of all websites globally, serving as the reverse proxy, load balancer, API gateway, and Kubernetes Ingress layer of choice for cloud-native infrastructure. The rewrite module at the heart of this vulnerability is not an obscure feature β€” it underpins authentication boundaries, application routing, multi-tenant request handling, and legacy API migration paths across millions of production environments.

Three additional CVEs were disclosed alongside NGINX Rift: CVE-2026-42946 (CVSS 8.3, excessive memory allocation in ngx_http_scgi_module), CVE-2026-40701 (CVSS 6.3, use-after-free in ngx_http_ssl_module), and CVE-2026-42934. Administrators should treat this as a full upgrade event, not a single patch.

The fact that a critical RCE bug of this nature survived 18 years undetected β€” not because the code was obfuscated, but because the vulnerability only emerges from the interaction of three separate components β€” is a sobering reminder that traditional code review and fuzzing alone are insufficient for complex stateful systems.

Summary

CVE-2026-42945 is a real, critical, exploitable vulnerability with a public PoC. Upgrade NGINX Open Source to 1.30.1 or 1.31.0 or NGINX Plus to R36 P4 / R32 P6 immediately. If you cannot patch, audit your rewrite rules with the grep command above and migrate to named capture groups as a stopgap. Do not delay.

Sources: depthfirst technical write-up (depthfirst.com) Β· F5 Security Advisory (May 13, 2026) Β· The Hacker News Β· GitHub: DepthFirstDisclosures/Nginx-Rift Β· SOCRadar CVE Intelligence Β· SecurityOnline.info

CVE information verified against NVD and official vendor advisories. This report reflects information available as of May 14, 2026. Check F5’s official advisory for the latest product-specific patch guidance.

NGINX Rift: An 18-Year-Old Flaw in the World's Most-Used Web Server Now Enables Unauthenticated Remote Code Execution

NGINX Rift: An 18-Year-Old Flaw in the World’s Most-Used Web Server Now Enables Unauthenticated Remote Code Execution


Windows Software Alternatives in Linux


Disclaimer of pbxscience.com

PBXscience.com Β© All Copyrights Reserved. | Newsphere by AF themes.