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
cve-2026-42945-scan — Scan your NGINX configuration to determine whether it is affected by CVE-2026-42945. | Kitploit
Tools/GitHubGitHub/realityone/cve-2026-42945-scan
Static AnalysisVulnerability ScannersConfiguration AuditingWeb SecurityMisconfiguration
GitHubrealityone/cve-2026-42945-scan

cve-2026-42945-scan

Scan your NGINX configuration to determine whether it is affected by CVE-2026-42945.

View Repository
133 months agoNot yet reviewed

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

cve-2026-42945-scan

Static scanner for NGINX configuration files that detects the rewrite/set pattern associated with CVE-2026-42945.

The scanner parses NGINX configs with crossplane, walks location blocks, and prints every location that looks affected in this format:

root@kitploit:~
/<path-to>/xxx.conf:<line-number> -> location XXXXX

Example:

root@kitploit:~
/path/to/nginx.conf:39 -> location ~ ^/api/(.*)$

Reference: CVE-2026-42945-POC.

Requirements

  • Python 3.10 or newer
  • uv

Dependencies are managed with uv in pyproject.toml and locked in uv.lock. The only runtime dependency is .

crossplane

Setup

From the repository root:

root@kitploit:~
uv sync

You can also skip a separate setup step and let uv run create the environment on first use.

Usage

Scan one config file:

root@kitploit:~
uv run ./scan.py /etc/nginx/nginx.conf

Scan a directory recursively:

root@kitploit:~
uv run ./scan.py -r /etc/nginx

Scan recursively from the current directory for *.conf files:

root@kitploit:~
uv run ./scan.py -r './*.conf'

Quote globs when you want the scanner to expand them recursively. If your shell expands ./*.conf first, the scanner receives only the files matched by the shell.

Scan only the provided files and do not follow include directives:

root@kitploit:~
uv run ./scan.py --single ./site.conf

Show parser warnings, including missing include files:

root@kitploit:~
uv run ./scan.py -v -r /etc/nginx

Go Version

A Go implementation with the same output format and exit codes is available in go/. It uses nginx-go-crossplane for NGINX config parsing and pflag for CLI flags. It requires Go 1.23 or newer.

Run it with go run:

root@kitploit:~
cd go
go run . -r ../tests/fixtures

When findings are present, the scanner exits with code 1. go run will print an extra exit status 1 line for that case; build the binary when you want only the scanner output.

Build a standalone binary:

root@kitploit:~
cd go
go build -o cve-2026-42945-scan-go .
./cve-2026-42945-scan-go -r ../tests/fixtures

What It Detects

The risky configuration pattern is a location that contains:

  • a rewrite directive whose replacement contains an unescaped ?
  • no terminal rewrite flag such as last, break, redirect, or permanent
  • a later set directive that copies a regex capture such as $1, ${1}, $name, or ${name}

Example vulnerable pattern:

root@kitploit:~
location ~ ^/api/(.*)$ {
    rewrite ^/api/(.*)$ /internal?migrated=true;
    set $original_endpoint $1;
}

The scanner reports the location line, not the rewrite or set line, because the location is the actionable block to inspect and fix.

Test Fixtures

The tests/fixtures/ directory contains small NGINX configs that can be used as examples:

FixtureExpected result
tests/fixtures/vulnerable.confreports a positional capture finding
tests/fixtures/named_capture.confreports a named capture finding
tests/fixtures/missing_include_still_scans.confreports a finding even though an include is missing
tests/fixtures/safe_break_flag.confno finding because the rewrite uses break
tests/fixtures/safe_no_capture.confno finding because no capture is available

Run the scanner against all example fixtures:

root@kitploit:~
uv run ./scan.py -r tests/fixtures

Expected findings:

root@kitploit:~
/absolute/path/to/tests/fixtures/missing_include_still_scans.conf:6 -> location ~ ^/partial/(.*)$
/absolute/path/to/tests/fixtures/named_capture.conf:2 -> location /users
/absolute/path/to/tests/fixtures/vulnerable.conf:2 -> location ~ ^/api/(.*)$

Output

If affected locations are found, each finding is printed on its own line:

root@kitploit:~
/absolute/path/to/file.conf:30 -> location ~ ^/aaaa/dddd/(.*)$
/absolute/path/to/nginx.conf:39 -> location ~ ^/api/(.*)$

No output means no affected location was found in the parsed configuration.

Limitations

This is a static configuration scanner. It does not:

  • verify the running NGINX version
  • prove exploitability
  • execute or test requests against a server
  • fully evaluate dynamic variables or generated configs
  • detect vulnerable snippets that are hidden in missing include files

Treat findings as locations that need review and remediation. A host is only actually affected when both the vulnerable NGINX version range and the risky configuration pattern are present.

Development

Run the test suite:

root@kitploit:~
uv run python -m unittest discover -s tests -v

Run the Go test suite:

root@kitploit:~
cd go
go test ./...

Run the syntax check:

root@kitploit:~
uv run python -m py_compile scan.py

Run against the bundled POC config:

root@kitploit:~
uv run ./scan.py CVE-2026-42945-POC/env/nginx.conf

Expected output:

root@kitploit:~
/absolute/path/to/CVE-2026-42945-POC/env/nginx.conf:39 -> location ~ ^/api/(.*)$
Download Tool