
CVE-2026-42945
Critical Heap-Based Buffer Overflow in NGINX
CVE-2026-42945 (also known as NGINX Rift) is a critical security vulnerability in the ngx_http_rewrite_module of NGINX.
The vulnerability arises from inconsistent buffer size calculation between the length-checking phase and the actual copy/escape phase when handling URI rewriting rules.
| Status | Versions |
|---|---|
| Affected | 0.6.27 → 1.30.0 |
| Fixed | 1.30.1 and 1.31.0+ |
| Status | Releases |
|---|---|
| Affected | R32 → R36 |
| Fixed | R36 P4, R32 P6, 37.0.0+ |
Note: Many F5 NGINX products (Ingress Controller, App Protect, Gateway Fabric, etc.) are affected if running on vulnerable base versions.
The bug is triggered by a specific combination of directives:
rewrite directive whose replacement string contains a ? (activates is_args flag).rewrite, if, or set directive that uses unnamed PCRE captures ($1, $2, etc.).is_args = false) → underestimates required buffer size.is_args = true) → calls ngx_escape_uri() with NGX_ESCAPE_ARGS.+, &, %, etc.) in the URI cause heap overflow.| Impact | Severity | Description |
|---|---|---|
| Denial of Service |
CVSS v4.0 Score: 9.2 (Critical)
CVSS v3.1 Score: 8.1 (High)
Replace unnamed captures with named captures:
rewrite ^/users/([0-9]+)/profile/(.*)$ /profile.php?id=$1&tab=$2 last;
rewrite ^/users/(?<user_id>[0-9]+)/profile/(?<section>.*)$ /profile.php?id=$user_id&tab=$section last;
Key Recommendation: Audit all rewrite rules that combine replacement strings containing ? and subsequent use of $1, $2, etc.
CVE-2026-42945 is one of the most significant NGINX vulnerabilities in recent years due to its long existence, ease of exploitation, and potential for RCE.
Act now — patch your instances and update your configurations.
Made with ❤️ for the security community
| High |
| Reliable worker process crash |
| Remote Code Execution | Critical (conditional) | Possible when ASLR is disabled or bypassed |
| Attack Complexity | Low | Single HTTP request, no authentication |