Skip to content

Nginx CVE-2026-42945 #5539

@acenomad

Description

@acenomad

From cve.org and maintainer disclosure

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, for systems with Address Space Layout Randomization (ASLR ) disabled, code execution is possible.

OpenResty have apparently already committed the necessary patches to their public repo, but have not yet formally released a new version according to their relevant issue.

Edit: there's a technical write-up with more details from the security researcher who discovered the vulnerability.

In the meantime until patches reach downstream, F5 recommends the following mitigation per their aforementioned disclosure:

To mitigate this vulnerability, use named captures instead of unnamed captures in rewrite definitions.

For example, the following rewrite directive uses unnamed PCRE capture groups, $1 and $2:

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

To mitigate this vulnerability for this example, replace $1 and $2 with the appropriate named captures, $user_id and $section:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions