diff mbox series

[meta-webserver,wrynose,10/10] nginx: fix CVE-2026-125283

Message ID 20261125061529.2721522-10-hthakar@cisco.com
State New
Headers show
Series [meta-webserver,wrynose,01/10] nginx: fix CVE-2026-97205 | expand

Commit Message

From: Hetvi Thakar <hthakar@cisco.com>

This patch applies the upstream nginx stable backport for
CVE-2026-125283. The upstream fix commit is referenced in [1],
and the public CVE advisory is referenced in [2].

[1] https://github.com/nginx/nginx/commit/b99b6b528b64e93354b5c3453e45701e70c461a8
[2] https://ubuntu.com/security/CVE-2026-125283

Signed-off-by: Hetvi Thakar <hthakar@cisco.com>
---
 .../nginx/files/CVE-2026-125283.patch         | 35 +++++++++++++++++++
 .../recipes-httpd/nginx/nginx_1.28.3.bb       |  1 +
 .../recipes-httpd/nginx/nginx_1.29.7.bb       |  1 +
 3 files changed, 37 insertions(+)
 create mode 100644 meta-webserver/recipes-httpd/nginx/files/CVE-2026-125283.patch
diff mbox series

Patch

diff --git a/meta-webserver/recipes-httpd/nginx/files/CVE-2026-125283.patch b/meta-webserver/recipes-httpd/nginx/files/CVE-2026-125283.patch
new file mode 100644
index 0000000000..206425dab1
--- /dev/null
+++ b/meta-webserver/recipes-httpd/nginx/files/CVE-2026-125283.patch
@@ -0,0 +1,35 @@ 
+From b99b6b528b64e93354b5c3453e45701e70c461a8 Mon Sep 17 00:00:00 2001
+From: Roman Arutyunyan <arut@nginx.com>
+Date: Thu, 5 Nov 2026 18:50:48 +0400
+Subject: [PATCH] Try files: fix uri formating in case of script underwrite
+
+Previously, if try_files was used with alias, and the script produced
+a string smaller than the predicted size, then an integer underflow
+could happen which resulted in buffer overrun.
+
+Fix is to recalculate the length after running the script.
+
+A similar length recalculation exists in ngx_http_index_module.
+It was added by 25f920eca when fixing script overruns.
+
+Reported by Marc Luchian & Liviu-Alexandru Bud.
+
+CVE: CVE-2026-125283
+Upstream-Status: Backport [https://github.com/nginx/nginx/commit/b99b6b528b64e93354b5c3453e45701e70c461a8]
+
+Signed-off-by: Hetvi Thakar <hthakar@cisco.com>
+---
+ src/http/modules/ngx_http_try_files_module.c | 1 +
+ 1 file changed, 1 insertion(+)
+diff --git a/src/http/modules/ngx_http_try_files_module.c b/src/http/modules/ngx_http_try_files_module.c
+index bbdab85984..9092602857 100644
+--- a/src/http/modules/ngx_http_try_files_module.c
++++ b/src/http/modules/ngx_http_try_files_module.c
+@@ -186,6 +186,7 @@ ngx_http_try_files_handler(ngx_http_request_t *r)
+                 return NGX_ERROR;
+             }
+ 
++            len = e.pos - name + 1;
+             path.len = e.pos - path.data;
+ 
+             *e.pos = '\0';
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 761c0edfd0..055b2aba3e 100644
--- a/meta-webserver/recipes-httpd/nginx/nginx_1.28.3.bb
+++ b/meta-webserver/recipes-httpd/nginx/nginx_1.28.3.bb
@@ -34,6 +34,7 @@  SRC_URI:append = " \
     file://CVE-2026-113425_p3.patch \
     file://CVE-2026-113425_p4.patch \
     file://CVE-2026-121810.patch \
+    file://CVE-2026-125283.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 e030fb3ec8..fb2172fc66 100644
--- a/meta-webserver/recipes-httpd/nginx/nginx_1.29.7.bb
+++ b/meta-webserver/recipes-httpd/nginx/nginx_1.29.7.bb
@@ -34,6 +34,7 @@  SRC_URI:append = " \
     file://CVE-2026-113425_p3.patch \
     file://CVE-2026-113425_p4.patch \
     file://CVE-2026-121810.patch \
+    file://CVE-2026-125283.patch \
 "
 
 # 1.28.x branch is the current stable branch, the recommended default