CVE-2026-42945 NGINX ngx_http_rewrite_module vulnerability

Critical 9.2 Published Updated

Unauthenticated attackers can trigger a heap buffer overflow in NGINX via crafted requests, causing service restarts or remote code execution if ASLR is bypassed.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2026-42945?

CVE-2026-42945 is a critical memory corruption vulnerability in F5 NGINX Open Source, published on 13 May 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

NGINX Plus and NGINX Open Source have a vulnerability in the ngx_http_rewrite_module module. This vulnerability exists when the rewrite directive is followed by a rewrite, if, or set directive and an unnamed Perl-Compatible Regular Expression (PCRE) capture (for example, $1, $2) with a replacement string that includes a question mark (?). An unauthenticated attacker along with conditions beyond its control can exploit this vulnerability by sending crafted HTTP requests. This may cause a heap buffer overflow in the NGINX worker process leading to a restart. Additionally, attackers can execute code on systems with Address Space Layout Randomization (ASLR) disabled or when the attacker can bypass ASLR.  Note: Software versions which have reached End of Technical Support (EoTS) are not evaluated.

Weakness: CWE-131, CWE-122

Which versions are affected by CVE-2026-42945?

2 open source packages ship an affected version, including nginx and nginx-gateway. It affects 7 products.

PackageAffectedFixed in
nginx BitnamiFrom 0.6.271.30.1
nginx-gateway BitnamiFrom 0.6.271.30.1
Linux distribution packages (38)
nginx AlmaLinux:10All versions2:1.26.3-6.el10_2.3
nginx-all-modules AlmaLinux:10All versions2:1.26.3-2.el10_1.2
nginx-all-modules AlmaLinux:10All versions2:1.26.3-6.el10_2.3
nginx-core AlmaLinux:10All versions2:1.26.3-6.el10_2.3
nginx-filesystem AlmaLinux:10All versions2:1.26.3-2.el10_1.2
nginx-filesystem AlmaLinux:10All versions2:1.26.3-6.el10_2.3
nginx-mod-devel AlmaLinux:10All versions2:1.26.3-6.el10_2.3
nginx-mod-http-image-filter AlmaLinux:10All versions2:1.26.3-6.el10_2.3
nginx-mod-http-perl AlmaLinux:10All versions2:1.26.3-6.el10_2.3
nginx-mod-http-xslt-filter AlmaLinux:10All versions2:1.26.3-6.el10_2.3
nginx-mod-mail AlmaLinux:10All versions2:1.26.3-6.el10_2.3
nginx-mod-stream AlmaLinux:10All versions2:1.26.3-6.el10_2.3
nginx AlmaLinux:8All versions1:1.24.0-3.module_el8.10.0+4182+ca797750.1.alma.1
nginx-all-modules AlmaLinux:8All versions1:1.24.0-3.module_el8.10.0+4182+ca797750.1.alma.1
nginx-filesystem AlmaLinux:8All versions1:1.24.0-3.module_el8.10.0+4182+ca797750.1.alma.1
nginx-mod-devel AlmaLinux:8All versions1:1.24.0-3.module_el8.10.0+4182+ca797750.1.alma.1
nginx-mod-http-image-filter AlmaLinux:8All versions1:1.24.0-3.module_el8.10.0+4182+ca797750.1.alma.1
nginx-mod-http-perl AlmaLinux:8All versions1:1.24.0-3.module_el8.10.0+4182+ca797750.1.alma.1
nginx-mod-http-xslt-filter AlmaLinux:8All versions1:1.24.0-3.module_el8.10.0+4182+ca797750.1.alma.1
nginx-mod-mail AlmaLinux:8All versions1:1.24.0-3.module_el8.10.0+4182+ca797750.1.alma.1
nginx-mod-stream AlmaLinux:8All versions1:1.24.0-3.module_el8.10.0+4182+ca797750.1.alma.1
nginx AlmaLinux:9All versions2:1.20.1-24.el9_7.3.alma.1
nginx AlmaLinux:9All versions2:1.20.1-28.el9_8.2.alma.1
nginx-all-modules AlmaLinux:9All versions1:1.24.0-7.module_el9.8.0+246+ef96a02d.1.alma.1
nginx-all-modules AlmaLinux:9All versions2:1.20.1-24.el9_7.3.alma.1
nginx-all-modules AlmaLinux:9All versions2:1.20.1-28.el9_8.2.alma.1
nginx-all-modules AlmaLinux:9All versions2:1.26.3-9.module_el9.8.0+247+aa936373
nginx-core AlmaLinux:9All versions2:1.20.1-24.el9_7.3.alma.1
nginx-core AlmaLinux:9All versions2:1.20.1-28.el9_8.2.alma.1
nginx-filesystem AlmaLinux:9All versions1:1.24.0-7.module_el9.8.0+246+ef96a02d.1.alma.1
nginx-filesystem AlmaLinux:9All versions2:1.20.1-24.el9_7.3.alma.1
nginx-filesystem AlmaLinux:9All versions2:1.20.1-28.el9_8.2.alma.1
nginx-filesystem AlmaLinux:9All versions2:1.26.3-9.module_el9.8.0+247+aa936373
nginx-mod-devel AlmaLinux:9All versions2:1.20.1-24.el9_7.3.alma.1
nginx-mod-devel AlmaLinux:9All versions2:1.20.1-28.el9_8.2.alma.1
nginx-mod-http-image-filter AlmaLinux:9All versions2:1.20.1-24.el9_7.3.alma.1
nginx-mod-http-image-filter AlmaLinux:9All versions2:1.20.1-28.el9_8.2.alma.1
nginx-mod-http-perl AlmaLinux:9All versions2:1.20.1-24.el9_7.3.alma.1

Products include F5 Dos, F5 Nginx Gateway Fabric, F5 Nginx Ingress Controller, F5 Nginx Instance Manager, F5 Nginx Open Source, F5 Nginx Plus and 1 more.

How do I fix CVE-2026-42945?

Upgrade nginx to 1.30.1 or later.

Upgrade to the fixed version. Memory-safe languages, compiler hardening and fuzzing prevent most new cases. More about Memory corruption.

Is CVE-2026-42945 being exploited?

There is no known exploitation of CVE-2026-42945 in the wild and no public exploit code.

Public exploit code: 47 proofs of concept on GitHub.

Sources

Also known as ALPINE-CVE-2026-42945, ALSA-2026:18029, ALSA-2026:18041, ALSA-2026:18063, ALSA-2026:19159, ALSA-2026:19371 and 56 more.

Is CVE-2026-42945 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free