Nginx Remote Code Execution Vulnerability (CVE-2026-42945) Notice

Overview

Recently, NSFOCUS CERT detected that Nginx and F5 issued security bulletins to fix the Nginx remote code execution vulnerability (CVE-2026-42945); because the ngx_http_rewrite_module module contains question marks in processing (? ) has a defect in the calculation logic when replacing strings with rewrite. Under certain configuration conditions, an unauthenticated attacker can trigger a heap buffer overflow by sending a specially crafted HTTP request, causing the NGINX worker process to crash and restart; if the system disables ASLR and meets specific memory layout conditions, remote code execution can be achieved. The CVSS score is 9.2. At present, the vulnerability details and PoC have been made public. Relevant users are requested to take measures to protect themselves as soon as possible.

Nginx is an open source high-performance HTTP server and reverse proxy server, widely used in Web service deployment, load balancing, SSL termination and API gateway scenarios. Its commercial version NGINX Plus provides enterprise-level support from F5, with advanced monitoring, dynamic configuration, WAF integration and other functions.

Reference link: https://my.f5.com/manage/s/article/K000161019

Scope of Impact

Affected versions

  • 0.6.27 <= NGINX Open Source <= 0.9.7
  • 1.0.0 <= NGINX Open Source <= 1.30.0
  • R32 <= NGINX Plus < R32 P6
  • R36 <= NGINX Plus < R36 P4

Note: Only when the rewrite, if or set instructions are used continuously in the Nginx configuration, and an unnamed PCRE regular expression capture (such as $1, $2) is used, and the replacement string of the rewrite instruction contains a question mark (? ) is affected by this vulnerability.

Unaffected version

  • NGINX Open Source >= 1.30.1
  • NGINX Open Source >= 1.31.0
  • NGINX Plus R32 >= R32 P6
  • NGINX Plus R36 >= R36 P4

Detection

Manual check

Related users can search in the Nginx configuration directory with the following command:

grep -RInE ‘rewrite|set |\$[0-9]|if \(‘ /etc/nginx Determine whether there is a similar high-risk configuration mode as follows: location~ ^/api/(.*)$ {
rewrite ^/api/(.*)$ /internal?migrated=true;
set$original_endpoint$1;
}

Use the following command to detect whether ASLR (Address Space Layout Randomization) is turned off in the current system. Return 2 to indicate that it is turned on.

cat /proc/sys/kernel/randomize_va_space

Note: If Nginx is within the affected range and has a high-risk configuration, it will be affected by the vulnerability.

Mitigation

Official upgrade

At present, the official has released a new version to fix this vulnerability. Affected users are requested to upgrade the version as soon as possible for protection.

Download link: https://nginx.org/en/download.html

Other protective measures

If the relevant users are temporarily unable to perform upgrade operations, temporary relief can also be achieved through the following measures:

Replace unnamed capture ($1, $2) with named capture in all affected rewrite instructions

Vulnerable example:

rewrite ^/users/([0-9]+)/profile/(.*)$ /profile.php?id=$1&tab=$2 last

Post-mitigation example:

rewrite ^/users/(?<user_id>[0-9]+)/profile/(?<section>.*)$ /profile.php?id=$user_id&tab=$section last

Statement

This advisory is only used to describe a potential risk. NSFOCUS does not provide any commitment or promise on this advisory. NSFOCUS and the author will not bear any liability for any direct and/or indirect consequences and losses caused by transmitting and/or using this advisory. NSFOCUS reserves all the rights to modify and interpret this advisory. Please include this statement paragraph when reproducing or transferring this advisory. Do not modify this advisory, add/delete any information to/from it, or use this advisory for commercial purposes without permission from NSFOCUS.

About NSFOCUS

NSFOCUS, a pioneering leader in cybersecurity, is dedicated to safeguarding telecommunications, Internet service providers, hosting providers, and enterprises from sophisticated cyberattacks.

Founded in 2000, NSFOCUS operates globally with over 3000 employees at two headquarters in Beijing, China, and Santa Clara, CA, USA, and over 50 offices worldwide. It has a proven track record of protecting over 25% of the Fortune Global 500 companies, including four of the five largest banks and six of the world’s top ten telecommunications companies.

Leveraging technical prowess and innovation, NSFOCUS delivers a comprehensive suite of security solutions, including the Intelligent Security Operations Platform (ISOP) for modern SOC, DDoS Protection, Continuous Threat Exposure Management (CTEM) Service and Web Application and API Protection (WAAP). All the solutions and services are augmented by the Security Large Language Model (SecLLM), ML, patented algorithms and other cutting-edge research achievements developed by NSFOCUS.

Leave a Reply

Your email address will not be published. Required fields are marked *

NSFOCUS
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.