diff mbox series

[meta-webserver,wrynose,07/11] nginx: fix CVE-2026-48142

Message ID 20261016032056.409095-8-hthakar@cisco.com
State New
Headers show
Series nginx: Security fixes | expand

Commit Message

From: Hetvi Thakar <hthakar@cisco.com>

This patch applies the upstream fix as referenced in [2],
using the commit shown in [1].

[1] https://github.com/nginx/nginx/commit/60c4243eb8775d51662a01def8a7dad5d9fb34a7
[2] https://nginx.org/en/security_advisories.html

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

Patch

diff --git a/meta-webserver/recipes-httpd/nginx/files/CVE-2026-48142.patch b/meta-webserver/recipes-httpd/nginx/files/CVE-2026-48142.patch
new file mode 100644
index 0000000000..1c39940fb7
--- /dev/null
+++ b/meta-webserver/recipes-httpd/nginx/files/CVE-2026-48142.patch
@@ -0,0 +1,42 @@ 
+From 60c4243eb8775d51662a01def8a7dad5d9fb34a7 Mon Sep 17 00:00:00 2001
+From: Sergey Kandaurov <pluknet@nginx.com>
+Date: Mon, 1 Jun 2026 21:46:48 +0400
+Subject: [PATCH] Charset: fixed another rare buffer overread in
+ recode_from_utf8()
+
+With prerequisites similar to 696a7f1b9, it was possible to gain 1-byte
+overread on invalid UTF-8 sequences.  The reason is ngx_utf8_decode()
+stops advancing the pointer position on the first encountered invalid
+byte.  The fix is to adjust the advanced pointer up to the whole saved
+sequence in this case.  Note that this may result in different output
+compared to complete invalid UTF-8 sequences, which we can disregard
+at this point.
+
+Reported by Han Yan of Xiaomi and p4p3r of CYBERONE.
+
+CVE: CVE-2026-48142
+Upstream-Status: Backport [https://github.com/nginx/nginx/commit/60c4243eb8775d51662a01def8a7dad5d9fb34a7]
+
+(cherry picked from commit 60c4243eb8775d51662a01def8a7dad5d9fb34a7)
+Signed-off-by: Hetvi Thakar <hthakar@cisco.com>
+---
+ src/http/modules/ngx_http_charset_filter_module.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/http/modules/ngx_http_charset_filter_module.c b/src/http/modules/ngx_http_charset_filter_module.c
+index edb2db568..e0115e1e4 100644
+--- a/src/http/modules/ngx_http_charset_filter_module.c
++++ b/src/http/modules/ngx_http_charset_filter_module.c
+@@ -855,6 +855,10 @@ ngx_http_charset_recode_from_utf8(ngx_pool_t *pool, ngx_buf_t *buf,
+         ngx_log_debug0(NGX_LOG_DEBUG_HTTP, pool->log, 0,
+                        "http charset invalid utf 1");
+ 
++        if (saved < &ctx->saved[ctx->saved_len]) {
++            saved = &ctx->saved[ctx->saved_len];
++        }
++
+     } else {
+         dst = ngx_sprintf(dst, "&#%uD;", n);
+     }
+-- 
+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 a47e398422..628e8f65b8 100644
--- a/meta-webserver/recipes-httpd/nginx/nginx_1.28.3.bb
+++ b/meta-webserver/recipes-httpd/nginx/nginx_1.28.3.bb
@@ -8,6 +8,7 @@  SRC_URI:append = " \
     file://CVE-2026-42945.patch \
     file://CVE-2026-9256.patch \
     file://CVE-2026-42055.patch \
+    file://CVE-2026-48142.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 bfd82d5e31..8ba04167c2 100644
--- a/meta-webserver/recipes-httpd/nginx/nginx_1.29.7.bb
+++ b/meta-webserver/recipes-httpd/nginx/nginx_1.29.7.bb
@@ -8,6 +8,7 @@  SRC_URI:append = " \
     file://CVE-2026-42945.patch \
     file://CVE-2026-9256.patch \
     file://CVE-2026-42055.patch \
+    file://CVE-2026-48142.patch \
 "
 
 # 1.28.x branch is the current stable branch, the recommended default