Vulnerabilities & CVEs

NGINX Vulnerability: 18-Year-Old Flaw Fuels DoS, RCE Risk

Eighteen years. That's how long a critical flaw sat hidden in NGINX, the web server powering a third of the internet. Discovered recently, this vulnerability can be exploited for serious damage, from crashing servers to executing arbitrary code.

Diagram illustrating a web server architecture with a highlighted 'rewrite' module, indicating a vulnerability.

Key Takeaways

  • An 18-year-old critical vulnerability (CVE-2026-42945) in NGINX allows for denial of service and potential remote code execution.
  • The flaw stems from a heap buffer overflow in the `ngx_http_rewrite_module`, triggered by common `rewrite` and `set` directive configurations.
  • While RCE can be achieved, the proof-of-concept relies on disabling ASLR, though this configuration exists in some environments.
  • NGINX's multi-process architecture can aid attackers by providing a consistent memory layout for repeated exploit attempts.
  • Fixes are available in newer NGINX Open Source and NGINX Plus versions, with a workaround involving named PCRE captures for those unable to upgrade.

Eighteen years. That’s how long a critical flaw sat hidden in NGINX, the web server powering a third of the internet. Discovered recently, this vulnerability can be exploited for serious damage, from crashing servers to executing arbitrary code.

It’s CVE-2026-42945, and its CVSS score isn’t playing around: a crisp 9.2, meaning critical. What’s more chilling is that this wasn’t found by some lone hacker poking around, but by an autonomous scanning system from DepthFirst AI, which also sniffed out three other memory corruption issues in the same six-hour session. This isn’t just one bug; it’s a symptom of a deeper architectural oversight that somehow slipped through the cracks for nearly two decades.

NGINX, for those who don’t live and breathe server configurations, is the backbone of the modern web. It’s the silent workhorse behind cloud providers, SaaS giants, financial institutions, and your favorite e-commerce cart. It handles traffic, balances loads, and caches content with ruthless efficiency. Now, F5, the company that owns it, has to deal with the fallout of a bug that’s older than many of the developers who might have written its code.

So, how does an 18-year-old flaw actually work? It’s a heap buffer overflow, tucked away in the ngx_http_rewrite_module. The versions affected? A staggering swath, from 0.6.27 to 1.30.0. The trigger? A common configuration pattern involving both rewrite and set directives, often found in API gateways and reverse proxy setups. Essentially, NGINX’s internal script engine fumbles the ball when handling memory allocation for rewrites. It calculates space based on unescaped URI lengths but then tries to write escaped data—like ‘+’ or ‘&’—which are longer, leading to that dreaded heap overflow.

The researchers at DepthFirst didn’t just find the bug; they proved it. They demonstrated unauthenticated code execution by crafting specific HTTP requests that corrupt memory, overwrite pointers, and even force NGINX to execute system() during the cleanup process. Scary stuff. However, there’s a crucial caveat: their proof-of-concept for remote code execution relied on turning off Address Space Layout Randomization (ASLR), a memory protection feature. While ASLR is standard on most systems, it can be disabled for performance gains in certain environments, like embedded systems or VMs used for analysis. So, while not a universal “slam dunk” for RCE, it’s a very real threat under specific, though not uncommon, configurations.

What really twists the knife here is NGINX’s multi-process architecture. If an exploit crashes a worker process, the master process just spins up a new one with an identical memory layout. This “luxury” of a predictable memory state makes repeated exploitation attempts far more reliable. As DepthFirst puts it:

If our exploit fails and crashes a worker, the master process simply spawns a new one with the exact same memory layout.

This allows us to safely try multiple times until we succeed without worrying about the worker crashing and changing the memory layout.

This inherent design feature, normally a strength, becomes a liability for attackers looking to bypass defenses. It theoretically even allows for ASLR leaks, where an attacker could progressively overwrite pointers byte by byte to map out memory.

The other three vulnerabilities DepthFirst uncovered, while not as critical, are still noteworthy. We’re looking at excessive memory allocation (potentially crushing workers with TBs of data), a use-after-free in asynchronous DNS handling, and an off-by-one bug in UTF-8 parsing. Each adds another layer of instability to the NGINX ecosystem.

Why Does This Matter for Developers?

This isn’t just an ops problem. For developers, especially those building APIs or working with microservices that heavily rely on NGINX as a gateway or proxy, this is a wake-up call. The configurations mentioned—specifically the interplay between rewrite and set directives—are likely present in countless projects. The fact that this vulnerability has existed for so long, and required advanced AI scanning to surface, highlights the dark corners of legacy codebases. Developers need to be hyper-aware of how common configuration patterns can hide deep-seated vulnerabilities.

The PR Spin vs. Reality

F5’s advisory, while offering fixes, also notes that some researchers are pushing back on the “real-world exploitability” of CVE-2026-42945, citing the need for highly specific conditions. This is classic corporate deflecting. While true that an attacker can’t just point a script at any random NGINX server and expect magic, the conditions described—common configurations using rewrite and set—are far from obscure. To dismiss it as an edge case is to ignore the reality of how complex systems are deployed in the wild. The existence of a functional exploit, even with ASLR disabled, is enough to warrant immediate attention.

What Are The Fixes?

The good news? NGINX Open Source 1.31.0 and 1.30.1, along with specific NGINX Plus releases, have patches. If upgrading isn’t an immediate option, F5 offers a workaround: replacing unnamed PCRE capture groups ($1, $2, etc.) in vulnerable rewrite rules with named captures. This bypasses the problematic state handling that causes the overflow. It’s a pragmatic stopgap, but a permanent upgrade is always the gold standard.

The sheer age of this vulnerability is a stark reminder that even the most ubiquitous software can harbor ancient dragons. AI-powered scanning is proving its worth not just in finding new threats, but in uncovering forgotten ones that have been lurking in plain sight.


🧬 Related Insights

Frequently Asked Questions

What versions of NGINX are affected by CVE-2026-42945? NGINX Open Source versions 0.6.27 through 1.30.0 are affected, along with specific versions of NGINX Plus and other related F5 products.

How can I mitigate this vulnerability if I can’t upgrade immediately? If you can’t upgrade, F5 recommends replacing unnamed PCRE capture groups in vulnerable rewrite rules with named captures. This eliminates the primary prerequisite for exploitation.

Is the remote code execution exploit guaranteed to work? The researchers demonstrated RCE on systems where ASLR was disabled. While ASLR is a common protection, it can be turned off for performance reasons in certain environments, making the RCE a real, albeit conditional, threat.

Written by
Threat Digest Editorial Team

Curated insights, explainers, and analysis from the editorial team.

Frequently asked questions

What versions of NGINX are affected by CVE-2026-42945?
NGINX Open Source versions 0.6.27 through 1.30.0 are affected, along with specific versions of NGINX Plus and other related F5 products.
How can I mitigate this vulnerability if I can't upgrade immediately?
If you can't upgrade, F5 recommends replacing unnamed PCRE capture groups in vulnerable `rewrite` rules with named captures. This eliminates the primary prerequisite for exploitation.
Is the remote code execution exploit guaranteed to work?
The researchers demonstrated RCE on systems where ASLR was disabled. While ASLR is a common protection, it can be turned off for performance reasons in certain environments, making the RCE a real, albeit conditional, threat.

Worth sharing?

Get the best Cybersecurity stories of the week in your inbox — no noise, no spam.

Originally reported by Bleeping Computer

Stay in the loop

The week's most important stories from Threat Digest, delivered once a week.