---
title: "NGINX Rewrite Exposure (CVE-2026-42945)"
canonical: https://trickest.com/library/nginx-rewrite-exposure-check-cve-2026-42945
description: "Fingerprint NGINX servers with two passive GETs and sort versions against the CVE-2026-42945 fix line, without sending the rewrite URI that crashes a worker."
---

# NGINX Rewrite Exposure (CVE-2026-42945)

## Overview

This workflow screens NGINX servers for CVE-2026-42945, the heap overflow in the rewrite module that has existed since NGINX 0.6.27 and can crash or, on some builds, compromise a worker process from any HTTP client. The bug needs a common configuration shape, a rewrite directive with an unnamed capture and a question-mark replacement followed by more rewrite instructions in the same scope, and that shape cannot be read from outside the server. So the honest detection is a version screen: it identifies NGINX, sorts the banner version against the fixed releases, and flags every NGINX host for configuration review. There is no safe exploitability probe, because the only request that discriminates vulnerable from patched is a crafted URI that deterministically crashes the worker, and this workflow will never send one. Each host comes back with a verdict you can feed into [exposure management](/use-cases/exposure-management).

## Pipeline

1. Read the target list and send two passive GETs per host, single attempt and no retries: one to the root page for the Server header and page traits, one to a nonexistent probe path for error-page traits and ingress default-backend detection.
2. The probe paths are fixed constants, and the safety guard rejects any path carrying percent-encoding, plus signs, or query syntax, so the exploit-shaped rewrite URI cannot be constructed even by accident. No POSTs, no header manipulation.
3. Parse the version from the Server header or error-page text and classify it against the OSS fix line, 1.30.1 and 1.31.0, or the NGINX Plus fixes, R32 P6 through R36 P4.
4. Keep the two sibling bugs apart: a version sitting between the 1.30.1 and 1.30.2 fix points is flagged with a note, since the rewrite overflow this page covers and the separate rewrite-module CVE-2026-9256 have different fix releases and must not be conflated.
5. Reconcile one verdict per target and write findings plus summary counts.

## Inputs

- **Target list.** Web server addresses you are authorized to fingerprint. The default file ships a sample host; bind your own.

## Outputs

- **findings.jsonl.** One row per host: target, the Server header evidence, the parsed version and which fix line it compares against, verdict, severity, and the config-pattern review note.
- **summary.jsonl.** One line with the total, verdict counts, and the advisory metadata including the explicit no-KEV and no-exploitation statement.

## Integrations

- HTTP. Exactly two GETs per host on fixed paths, no retries, no request bodies, no header tricks.

## Sample output

The records below are illustrative and do not come from a real run. They show a server on an affected version, a patched one, and one where the sibling CVE needs separate treatment.

```jsonl
{"target": "https://web-a.example.com", "server_header": "nginx/1.29.4", "version_source": "server_header", "verdict": "affected_version", "detail": "below the 1.30.1/1.31.0 fix; config-pattern review required", "error": null}
{"target": "https://web-b.example.org", "server_header": "nginx/1.31.0", "version_source": "server_header", "verdict": "patched_version", "detail": "at the 1.31.0 fix", "error": null}
{"target": "https://web-c.example.net", "server_header": "nginx/1.30.1", "version_source": "server_header", "verdict": "version_not_listed", "detail": "at the CVE-2026-42945 fix but below the CVE-2026-9256 fix line; sibling bug needs its own check", "error": null}
```

```json
{"cve": "CVE-2026-42945", "product": "NGINX ngx_http_rewrite_module", "total_targets": 3, "verdict_counts": {"affected_version": 1, "patched_version": 1, "version_not_listed": 1}, "kev": false, "config_pattern_note": "the vulnerable shape is a rewrite with an unnamed capture and a question-mark replacement plus further rewrite directives in the same scope"}
```

## FAQ

### Does an affected_version verdict mean the server is vulnerable?

No. It means the version sits below the fix for a bug that also needs a specific rewrite configuration pattern to become reachable, and that pattern cannot be observed remotely. Treat the row as a version screen that triggers a config review on the host, not as proof of exposure.

### Why not just send the crafted URI?

The only request that distinguishes vulnerable from patched deterministically crashes the worker process, which is a denial-of-service action against the target. The workflow refuses to send it by construction: the path guard rejects any URI that could carry the exploit shape.

### Which versions are affected?

Every NGINX OSS build from 0.6.27 through 1.30.0 and NGINX Plus R32 through R36 before their patch releases. The fixes are 1.30.1 and 1.31.0 on OSS and R32 P6, R36 P4 on Plus. NGINX builds from 1.30.2 to the 1.31 line need the separate rewrite-module CVE-2026-9256 check instead.

### Is this bug exploited in the wild?

No confirmed exploitation. CISA's coordinator scored exploitation as none, it is not on the KEV list, and public exploit code exists from the researcher disclosure. Patching is a version-hygiene task, not an incident response.

## Related workflows

- [NGINX HTTP/2 Exposure (CVE-2026-123633)](/library/nginx-http2-exposure-check-cve-2026-123633). Reach for it when the next NGINX flag is in the HTTP/2 layer instead of the rewrite module.
- [Apache mod_http2 Exposure (CVE-2026-119618)](/library/apache-mod-http2-exposure-check-cve-2026-119618). Reach for it when the next web server version screen is Apache, not NGINX.
- [Full Network Port and Service Assessment](/library/full-network-port-and-service-assessment). Map which hosts run NGINX across the estate first.

---
_Markdown source of https://trickest.com/library/nginx-rewrite-exposure-check-cve-2026-42945._
