Skip to contentSkip to conversation

nginx: backport fixes for CVE-2026-42533

PATCH New Joao Marcos Costa 1 participant 1 message Jul 27

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nginx: backport fixes for CVE-2026-42533

The fixes are all part of v1.30.4, as explained in the release notes [1].

I tested this with the configuration below:

BB_VERSION           = "2.8.1"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "fedora-39"
TARGET_SYS           = "x86_64-oe-linux"
MACHINE              = "qemux86-64"
DISTRO               = "nodistro"
DISTRO_VERSION       = "nodistro.0"
TUNE_FEATURES        = "m64 core2"
TARGET_FPU           = ""
meta                 = "scarthgap:3217490cc554069ae53aa54cf8ad7327ce85fa10"

For more details about the CVE: https://nvd.nist.gov/vuln/detail/CVE-2026-42533

[1] https://github.com/nginx/nginx/releases/tag/release-1.30.4

---
 .../nginx/nginx-1.24.0/CVE-2026-42533-1.patch | 126 ++++
 .../nginx/nginx-1.24.0/CVE-2026-42533-2.patch | 381 ++++++++++
 .../nginx/nginx-1.24.0/CVE-2026-42533-3.patch | 704 ++++++++++++++++++
 .../nginx/nginx-1.24.0/CVE-2026-42533-4.patch | 587 +++++++++++++++
 .../nginx/nginx-1.24.0/CVE-2026-42533-5.patch |  55 ++
 .../recipes-httpd/nginx/nginx_1.24.0.bb       |   5 +
 6 files changed, 1858 insertions(+)
 create mode 100644 meta-webserver/recipes-httpd/nginx/nginx-1.24.0/CVE-2026-42533-1.patch
 create mode 100644 meta-webserver/recipes-httpd/nginx/nginx-1.24.0/CVE-2026-42533-2.patch
 create mode 100644 meta-webserver/recipes-httpd/nginx/nginx-1.24.0/CVE-2026-42533-3.patch
 create mode 100644 meta-webserver/recipes-httpd/nginx/nginx-1.24.0/CVE-2026-42533-4.patch
 create mode 100644 meta-webserver/recipes-httpd/nginx/nginx-1.24.0/CVE-2026-42533-5.patch
meta-webserver/recipes-httpd/nginx/nginx-1.24.0/CVE-2026-42533-1.patch new file +126 -0
new file mode 100644
index 0000000000..1a068ab2b1
@@ -0,0 +1,126 @@
+From 83c522aa1ee2e220bb0113314bd178d377fe5f32 Mon Sep 17 00:00:00 2001
+From: Maxim Dounin <[email protected]>
+Date: Fri, 19 Jun 2026 22:54:19 +0300
+Subject: [PATCH] Script: simplified copy capture codes.
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Roman Arutyunyan <[email protected]>
+Origin: <https://freenginx.org/hg/nginx/rev/0fd5e6155817>
+
+CVE: CVE-2026-42533
+Upstream-Status: Backport [https://github.com/nginx/nginx/commit/ea47fabf55e2bc9192ddc27f52486b4e58d5e007]
+Signed-off-by: João Marcos Costa (Schneider Electric) <[email protected]>
+---
+ src/http/ngx_http_script.c     | 22 ++++++++++++----------
+ src/stream/ngx_stream_script.c | 10 +++++++---
+ 2 files changed, 19 insertions(+), 13 deletions(-)
+
+diff --git a/src/http/ngx_http_script.c b/src/http/ngx_http_script.c
+index 8a28e23a6..6b33d01dd 100644
+--- a/src/http/ngx_http_script.c
++++ b/src/http/ngx_http_script.c
+@@ -1343,6 +1343,7 @@ ngx_http_script_copy_capture_len_code(ngx_http_script_engine_t *e)
+ {
+     int                                  *cap;
+     u_char                               *p;
++    size_t                                len;
+     ngx_uint_t                            n;
+     ngx_http_request_t                   *r;
+     ngx_http_script_copy_capture_code_t  *code;
+@@ -1358,17 +1359,17 @@ ngx_http_script_copy_capture_len_code(ngx_http_script_engine_t *e)
+     if (n < r->ncaptures) {
+ 
+         cap = r->captures;
++        len = cap[n + 1] - cap[n];
+ 
+         if ((e->is_args || e->quote)
+             && (e->request->quoted_uri || e->request->plus_in_uri))
+         {
+-            p = r->captures_data;
++            p = r->captures_data + cap[n];
++
++            return len + 2 * ngx_escape_uri(NULL, p, len, NGX_ESCAPE_ARGS);
+ 
+-            return cap[n + 1] - cap[n]
+-                   + 2 * ngx_escape_uri(NULL, &p[cap[n]], cap[n + 1] - cap[n],
+-                                        NGX_ESCAPE_ARGS);
+         } else {
+-            return cap[n + 1] - cap[n];
++            return len;
+         }
+     }
+ 
+@@ -1381,6 +1382,7 @@ ngx_http_script_copy_capture_code(ngx_http_script_engine_t *e)
+ {
+     int                                  *cap;
+     u_char                               *p, *pos;
++    size_t                                len;
+     ngx_uint_t                            n;
+     ngx_http_request_t                   *r;
+     ngx_http_script_copy_capture_code_t  *code;
+@@ -1398,16 +1400,16 @@ ngx_http_script_copy_capture_code(ngx_http_script_engine_t *e)
+     if (n < r->ncaptures) {
+ 
+         cap = r->captures;
+-        p = r->captures_data;
++        len = cap[n + 1] - cap[n];
++        p = r->captures_data + cap[n];
+ 
+         if ((e->is_args || e->quote)
+             && (e->request->quoted_uri || e->request->plus_in_uri))
+         {
+-            e->pos = (u_char *) ngx_escape_uri(pos, &p[cap[n]],
+-                                               cap[n + 1] - cap[n],
+-                                               NGX_ESCAPE_ARGS);
++            e->pos = (u_char *) ngx_escape_uri(pos, p, len, NGX_ESCAPE_ARGS);
++
+         } else {
+-            e->pos = ngx_copy(pos, &p[cap[n]], cap[n + 1] - cap[n]);
++            e->pos = ngx_copy(pos, p, len);
+         }
+     }
+ 
+diff --git a/src/stream/ngx_stream_script.c b/src/stream/ngx_stream_script.c
+index c447e152f..2cd8b08c7 100644
+--- a/src/stream/ngx_stream_script.c
++++ b/src/stream/ngx_stream_script.c
+@@ -894,6 +894,7 @@ size_t
+ ngx_stream_script_copy_capture_len_code(ngx_stream_script_engine_t *e)
+ {
+     int                                    *cap;
++    size_t                                  len;
+     ngx_uint_t                              n;
+     ngx_stream_session_t                   *s;
+     ngx_stream_script_copy_capture_code_t  *code;
+@@ -908,7 +909,8 @@ ngx_stream_script_copy_capture_len_code(ngx_stream_script_engine_t *e)
+ 
+     if (n < s->ncaptures) {
+         cap = s->captures;
+-        return cap[n + 1] - cap[n];
++        len = cap[n + 1] - cap[n];
++        return len;
+     }
+ 
+     return 0;
+@@ -920,6 +922,7 @@ ngx_stream_script_copy_capture_code(ngx_stream_script_engine_t *e)
+ {
+     int                                    *cap;
+     u_char                                 *p, *pos;
++    size_t                                  len;
+     ngx_uint_t                              n;
+     ngx_stream_session_t                   *s;
+     ngx_stream_script_copy_capture_code_t  *code;
+@@ -936,8 +939,9 @@ ngx_stream_script_copy_capture_code(ngx_stream_script_engine_t *e)
+ 
+     if (n < s->ncaptures) {
+         cap = s->captures;
+-        p = s->captures_data;
+-        e->pos = ngx_copy(pos, &p[cap[n]], cap[n + 1] - cap[n]);
++        len = cap[n + 1] - cap[n];
++        p = s->captures_data + cap[n];
++        e->pos = ngx_copy(pos, p, len);
+     }
+ 
+     ngx_log_debug2(NGX_LOG_DEBUG_STREAM, e->session->connection->log, 0,
meta-webserver/recipes-httpd/nginx/nginx-1.24.0/CVE-2026-42533-2.patch new file +381 -0

381 lines not on this page · raw message

meta-webserver/recipes-httpd/nginx/nginx-1.24.0/CVE-2026-42533-3.patch new file +704 -0

704 lines not on this page · raw message

meta-webserver/recipes-httpd/nginx/nginx-1.24.0/CVE-2026-42533-4.patch new file +587 -0

587 lines not on this page · raw message

meta-webserver/recipes-httpd/nginx/nginx-1.24.0/CVE-2026-42533-5.patch new file +55 -0

55 lines not on this page · raw message

meta-webserver/recipes-httpd/nginx/nginx_1.24.0.bb +5 -0
index f2216a5df4..f28a00df5b 100644
@@ -17,6 +17,11 @@ SRC_URI:append = " \
                   file://CVE-2026-9256.patch \
                   file://CVE-2026-48142.patch \
                   file://CVE-2026-42055.patch \
+                  file://CVE-2026-42533-1.patch \
+                  file://CVE-2026-42533-2.patch \
+                  file://CVE-2026-42533-3.patch \
+                  file://CVE-2026-42533-4.patch \
+                  file://CVE-2026-42533-5.patch \
 "
 
 SRC_URI[sha256sum] = "77a2541637b92a621e3ee76776c8b7b40cf6d707e69ba53a940283e30ff2f55d"
Signature · 1 line
2.47.0