diff --git a/meta-webserver/recipes-httpd/nginx/files/CVE-2026-15176.patch b/meta-webserver/recipes-httpd/nginx/files/CVE-2026-15176.patch new file mode 100644 index 0000000000..19b9ab787d --- /dev/null +++ b/meta-webserver/recipes-httpd/nginx/files/CVE-2026-15176.patch @@ -0,0 +1,54 @@ +From ce1da78900b07e72f37a25f55e6606220ac45902 Mon Sep 17 00:00:00 2001 +From: Roman Arutyunyan +Date: Fri, 10 Jul 2026 20:10:12 +0400 +Subject: [PATCH] Avoid post-rewrite URI to path mapping with alias + +Previously, after a "rewrite" had changed the URI, and before a new +location was chosen, the new URI might not match the current location +prefix. This becomes a problem when the location uses "alias", which +is why normally such inconsistency is detected by checking the +r->valid_location flag. Meanwhile this flag only handles the +inconsistency when using the "break" directive or parameter. However +in absence of those, there's still an inconsistency window from URI +change up until the end of the current set of rewrite directives. +URI to path mapping within this window might result in a buffer +overflow if location's prefix was longer than the rewritten URI. + +The following example resulted in a buffer overflow with the request +"/foo/1": + +location /foo/ { + alias /bar/; + rewrite ^/foo/.*$ /x; + return 200 $request_filename; +} + +Alternatively, $request_filename might be used in access log format, +"set", "if", "add_header", etc. + +The fix is to reject URI mapping in ngx_http_map_uri_to_path() if the +r->uri_changed flag is set. + +CVE: CVE-2026-15176 +Upstream-Status: Backport [https://github.com/nginx/nginx/commit/ce1da78900b07e72f37a25f55e6606220ac45902] + +Signed-off-by: Hetvi Thakar +--- + src/http/ngx_http_core_module.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c +index a5f4597294..385b84e1b3 100644 +--- a/src/http/ngx_http_core_module.c ++++ b/src/http/ngx_http_core_module.c +@@ -1936,7 +1936,7 @@ ngx_http_map_uri_to_path(ngx_http_request_t *r, ngx_str_t *path, + + alias = clcf->alias; + +- if (alias && !r->valid_location) { ++ if (alias && (!r->valid_location || r->uri_changed)) { + ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, + "\"alias\" cannot be used in location \"%V\" " + "where URI was rewritten", &clcf->name); +-- +2.35.6 diff --git a/meta-webserver/recipes-httpd/nginx/nginx_1.28.3.bb b/meta-webserver/recipes-httpd/nginx/nginx_1.28.3.bb index 1ee9d41562..5b31fabc37 100644 --- a/meta-webserver/recipes-httpd/nginx/nginx_1.28.3.bb +++ b/meta-webserver/recipes-httpd/nginx/nginx_1.28.3.bb @@ -17,6 +17,7 @@ SRC_URI:append = " \ file://CVE-2026-56434.patch \ file://CVE-2026-95101.patch \ file://CVE-2026-97629.patch \ + file://CVE-2026-15176.patch \ " LIC_FILES_CHKSUM = "file://LICENSE;md5=3dc49537b08b14c8b66ad247bb4c4593" diff --git a/meta-webserver/recipes-httpd/nginx/nginx_1.29.7.bb b/meta-webserver/recipes-httpd/nginx/nginx_1.29.7.bb index 77b6303a74..c2a6e2b6be 100644 --- a/meta-webserver/recipes-httpd/nginx/nginx_1.29.7.bb +++ b/meta-webserver/recipes-httpd/nginx/nginx_1.29.7.bb @@ -17,6 +17,7 @@ SRC_URI:append = " \ file://CVE-2026-56434.patch \ file://CVE-2026-95101.patch \ file://CVE-2026-97629.patch \ + file://CVE-2026-15176.patch \ " # 1.28.x branch is the current stable branch, the recommended default