Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
nginx-cve-2026-42945-check — Local read-only scanner for CVE-2026-42945 (NGINX Rift) that checks NGINX, OpenResty, and Tengine instances for vulnerable rewrite configurations without executing exploits or modifying services. | Kitploit
Tools/GitHubGitHub/byezero/nginx-cve-2026-42945-check
Static AnalysisVulnerability ScannersVulnerability AnalysisScripting & AutomationConfiguration AuditingWeb Security
GitHubbyezero/nginx-cve-2026-42945-check

nginx-cve-2026-42945-check

Local read-only scanner for CVE-2026-42945 (NGINX Rift) that checks NGINX, OpenResty, and Tengine instances for vulnerable rewrite configurations without executing exploits or modifying services.

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
View Repository
43 months agoNot yet reviewed
Share

NGINX CVE-2026-42945 Local Checker

Language: 中文 | English

This repository provides two standalone local scripts for checking whether a Linux or Windows server has Nginx, OpenResty, or Tengine instances that may be exposed to CVE-2026-42945 related risk.

The scripts are read-only. They do not run an exploit, do not send attack requests, do not modify configuration, do not restart services, and do not upgrade software.

Vulnerability Background

CVE-2026-42945, also known as NGINX Rift, is publicly described as a heap-based buffer overflow in ngx_http_rewrite_module. According to the NVD description, the vulnerable condition involves a rewrite directive followed by a rewrite, if, or set directive, unnamed PCRE capture variables such as $1 or , and a replacement string that includes a question mark . A remote unauthenticated attacker may trigger the condition with crafted HTTP requests, causing an NGINX worker process heap buffer overflow. The impact may include worker process restarts, and code execution may be possible on systems where ASLR is disabled.

$2
?

The official NGINX security advisory lists the NGINX Open Source fixed and affected boundaries as follows:

StatusNGINX Open Source versions
Fixed1.31.0+ / 1.30.1+
Potentially affected0.6.27-1.30.0

Linux distributions, commercial products, OpenResty, Tengine, and private builds may have backported patches or product-specific version mapping. The scripts collect local evidence, but vendor advisories should be used for final confirmation.

What This Tool Checks

This is not an exploitation or PoC tool. It is a local evidence collector and static configuration checker. It focuses on the following pattern:

  1. A rewrite directive replacement string uses an unescaped unnamed capture variable such as $1 or $2.
  2. The same rewrite replacement string contains an unescaped ?. A literal escaped \? is not treated as a risk condition.
  3. A later rewrite, if, or set directive exists in the same configuration scope.

Example risk pattern:

root@kitploit:~
location ~ ^/api/(.*)$ {
    rewrite ^/api/(.*)$ /internal?endpoint=$1 last;
    set $flag 1;
}

The risk is not a single rewrite or set directive by itself. Version, effective configuration context, and directive order all matter. When a match is reported, manually confirm whether the configuration is active, reachable by external requests, and already fixed by a vendor backport.

Files

FileDescription
check_nginx_linux.shLocal Linux checker
check_nginx_windows.ps1Local Windows checker
README.mdChinese README
README.en.mdEnglish README

Scope

Supported in this version:

  • Checks local native Nginx / OpenResty / Tengine installations.
  • Collects host information, process and service information, version information, build options, and effective configuration.
  • Checks multiple Nginx / OpenResty / Tengine instances on the same host.
  • Detects CVE-2026-42945 related risky rewrite patterns.
  • Produces Chinese console output, summary.txt, summary.json, and raw evidence files.

Not included in this version:

  • Docker / Kubernetes checks.
  • Remote SSH / WinRM scanning.
  • Automatic remediation, upgrades, or configuration changes.
  • Exploit, PoC, or attack traffic.

Requirements

Run with administrative privileges when possible:

  • Linux: use root or an account with sudo privileges.
  • Windows: run PowerShell as Administrator.

The scripts will still try to collect evidence without administrative privileges. If the effective nginx -T configuration cannot be exported, the result is marked as 需人工复核 (manual review required).

Linux Usage

Upload check_nginx_linux.sh to the target server and run:

root@kitploit:~
chmod +x check_nginx_linux.sh
sudo ./check_nginx_linux.sh

If sudo is unavailable, you can run:

root@kitploit:~
./check_nginx_linux.sh

Windows Usage

Upload check_nginx_windows.ps1 to the target server and run it from an elevated PowerShell:

root@kitploit:~
powershell -ExecutionPolicy Bypass -File .\check_nginx_windows.ps1

Output

The script creates a result directory next to the script. The directory name includes hostname, timestamp, and process ID to avoid evidence mixing when the script is run multiple times in the same second.

root@kitploit:~
nginx_check_<hostname>_<timestamp>_<pid>/
  summary.txt
  summary.json
  raw/
    host_info.txt
    process_info.txt
    service_info.txt
    package_info.txt
    nginx_paths.txt
    instances/
      instance_01/
        nginx_invocation.txt
        nginx_version.txt
        nginx_build.txt
        nginx_config_dump.txt
        risky_config_matches.txt
      instance_02/
        ...
File or directoryDescription
summary.txtHuman-readable Chinese summary
summary.jsonStructured output for later aggregation
raw/Raw command output and evidence files
raw/instances/instance_XX/Per-instance version, configuration, and risk evidence

Important summary fields:

FieldDescription
实例数量Number of local Nginx / OpenResty / Tengine candidate instances checked
配置大小Size of the raw nginx -T configuration dump
扫描行数Number of configuration dump lines scanned
危险配置命中数量Number of risky rewrite matches
证据摘要Evidence preview for the highest-risk instance

Large configurations are not printed to the console. The full effective configuration is saved as nginx_config_dump.txt under each instance directory. If a configuration dump is larger than 10 MB, the script continues scanning and recommends manual sampling of the raw evidence.

Multiple Instances

If multiple nginx, openresty, or tengine candidate executables are found, the scripts check each one and write per-instance evidence.

The top-level conclusion uses the highest-risk instance. The conservative priority order is:

  1. 受影响有风险配置 (affected with risky configuration)
  2. 需人工复核 (manual review required)
  3. 受影响无风险配置 (affected version, no risky configuration found)
  4. 不受影响 (not affected)
  5. 未安装Nginx (Nginx not found)

需人工复核 is ranked above 受影响无风险配置 because an unknown or incomplete instance should not be hidden by another instance whose configuration was successfully checked.

Conclusions

ConclusionMeaning
未安装NginxNo Nginx / OpenResty / Tengine command, process, or service was found
不受影响A fixed version was found and no risky configuration was detected
受影响无风险配置The version may be affected, but no risky rewrite pattern was detected
受影响有风险配置The version may be affected, or the derivative version needs review, and a risky rewrite pattern was detected
需人工复核Unknown version, derivative build, incomplete configuration collection, insufficient privilege, or insufficient evidence

Version Rules

ProductVersion assessment
NGINX 1.31.0+Fixed, reported as 已修复(mainline)
NGINX 1.30.1+Fixed, reported as 已修复(stable)
NGINX 0.6.27-1.30.0Potentially affected
OpenResty / TengineVersion and configuration are collected, but impact mapping requires manual review

Distribution packages may have backported patches while keeping older upstream version strings. Use summary.txt and package evidence together with vendor advisories for final confirmation.

Remediation Guidance

  • Upgrade to a fixed version released by the upstream or distribution vendor.
  • Prioritize internet-facing reverse proxies, ingress points, and boundary load balancers.
  • Review rewrite, if, and set combinations under all location, server, and if scopes.
  • Avoid using unnamed captures such as $1 or $2 in rewrite replacement strings that contain ?.
  • Consider named captures, saving variables earlier, splitting rewrite logic, or removing unnecessary query-string rewrites.
  • Do not rely on version checks alone. Configuration reachability and trigger patterns matter.

Limitations

  • This is a local read-only checker, not an exploit validation tool.
  • Static configuration scanning may produce false positives. Manual context review is still required.
  • If nginx -T cannot export the full effective configuration, the scripts do not mark the host as safe.
  • OpenResty, Tengine, and private builds are marked for manual version-impact review by default.
  • No detected risky pattern does not guarantee absolute safety. Upgrading to a vendor-confirmed fixed version is still recommended.

References

  • NGINX Security Advisories
  • NVD: CVE-2026-42945
  • F5 Advisory K000161019
  • depthfirst: NGINX Rift
Download Tool