[packages/nginx] Up to 1.31.9

arekm arekm at pld-linux.org
Wed Nov 18 17:08:24 CET 2026


commit 78db5f9d8711d437be7fd92a2be9305780e4a64c
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Wed Nov 18 17:07:33 2026 +0100

    Up to 1.31.9
    
    Fixes CVE-2026-123634, CVE-2026-123007, CVE-2026-121810,
    CVE-2026-123633, CVE-2026-118899, CVE-2026-113425, CVE-2026-120993,
    CVE-2026-125283, CVE-2026-120967, CVE-2026-123640.
    
    Add upstream vts fix for a heap overflow when building keys of
    upstream peers with long names (unix sockets), vts#378.
    
    njs xml and crypto modules are always enabled and link through
    nginx's LIBXSLT and OPENSSL; add the missing BuildRequires.

 nginx-vts-upstream-key-overflow.patch | 138 ++++++++++++++++++++++++++++++++++
 nginx.spec                            |  12 ++-
 2 files changed, 146 insertions(+), 4 deletions(-)
---
diff --git a/nginx.spec b/nginx.spec
index 26b75c6..e491276 100644
--- a/nginx.spec
+++ b/nginx.spec
@@ -53,12 +53,12 @@ Summary:	High perfomance HTTP and reverse proxy server
 Summary(pl.UTF-8):	Serwer HTTP i odwrotne proxy o wysokiej wydajności
 # http://nginx.org/en/download.html
 Name:		nginx
-Version:	1.31.8
-Release:	2
+Version:	1.31.9
+Release:	1
 License:	BSD-like
 Group:		Networking/Daemons/HTTP
 Source0:	https://nginx.org/download/%{name}-%{version}.tar.gz
-# Source0-md5:	bb17043d54a75e82e261b258df163ecd
+# Source0-md5:	c6babcadfb410174fe640ae128635070
 Source1:	https://nginx.org/favicon.ico
 # Source1-md5:	72e228c3809db53da8a884b6676ed36a
 Source2:	proxy.conf
@@ -90,6 +90,7 @@ Source106:	https://github.com/bellard/quickjs/archive/%{quickjs_commit}/quickjs-
 # Source106-md5:	913c3fc48570d2660d5b243e9b6e6d7a
 Patch0:		%{name}-no-Werror.patch
 Patch1:		%{name}-modsecurity-pld.patch
+Patch2:		%{name}-vts-upstream-key-overflow.patch
 URL:		https://nginx.org/
 BuildRequires:	pcre2-8-devel
 BuildRequires:	rpmbuild(macros) >= 1.644
@@ -108,8 +109,10 @@ BuildRequires:	libmodsecurity >= 3.0.16-4
 BuildRequires:  libmodsecurity-devel
 %endif
 %if %{with njs}
-# njs autodetects libxml2 and builds its xml module only when it is found
+# nginx/config always enables njs crypto and xml, linked through nginx's OPENSSL and LIBXSLT
 BuildRequires:	libxml2-devel
+BuildRequires:	libxslt-devel
+BuildRequires:	openssl-devel
 %endif
 %if %{with perl}
 BuildRequires:	perl-devel
@@ -380,6 +383,7 @@ mv nginx-rtmp-module-%{rtmp_version} nginx-rtmp-module
 
 %if %{with vts}
 mv nginx-module-vts-%{vts_version} nginx-vts-module
+%patch -P2 -p1 -d nginx-vts-module
 %endif
 
 %if %{with headers_more}
diff --git a/nginx-vts-upstream-key-overflow.patch b/nginx-vts-upstream-key-overflow.patch
new file mode 100644
index 0000000..00611f4
--- /dev/null
+++ b/nginx-vts-upstream-key-overflow.patch
@@ -0,0 +1,138 @@
+Upstream https://github.com/vozlt/nginx-module-vts/commit/57107393f1f0b2f2526d4bff84933387e19e9d58
+heap overflow building peer keys for upstreams with long names (unix sockets), vts#378
+
+From 57107393f1f0b2f2526d4bff84933387e19e9d58 Mon Sep 17 00:00:00 2001
+From: "Y.Horie" <u5.horie at gmail.com>
+Date: Sun, 9 Aug 2026 21:30:05 +0900
+Subject: [PATCH] fix: give the key of an upstream peer the room its name needs
+
+The walk over the upstream groups built its keys in one buffer, taken once
+before the walk and sized for the longest group name plus an address and a
+port:
+
+  dst.len = len + sizeof("@[ffff:...:255.255.255.255]:65535") - 1;
+
+A peer is not always named by an address. A unix socket is named by its path,
+and anything past 53 characters runs off the end. #378 reports it as a crash,
+which is what it is under the sanitizers.
+
+It is worse than a crash on an ordinary build, where it is silent.
+node_generate_key() takes the key from the same pool with ngx_pcalloc, which
+zeroes a region overlapping the tail the overflow just wrote, so the name is
+cut short, the lookup misses, and the peer is displayed as though it had
+served nothing:
+
+  peer->name 24 characters   requestCounter 2
+  peer->name 88 characters   requestCounter 0
+
+Give each key the room it needs where it is built, in both the loop over the
+peers of a zone and the loop over the servers of a group. That is one more
+pool allocation per peer, in a walk that already takes one per peer for the
+key itself, and it removes the guess rather than widening it.
+---
+ ...x_http_vhost_traffic_status_display_json.c | 49 +++++++++++--------
+ 1 file changed, 29 insertions(+), 20 deletions(-)
+
+diff --git a/src/ngx_http_vhost_traffic_status_display_json.c b/src/ngx_http_vhost_traffic_status_display_json.c
+index e5c4b26..e44e7b9 100644
+--- a/src/ngx_http_vhost_traffic_status_display_json.c
++++ b/src/ngx_http_vhost_traffic_status_display_json.c
+@@ -611,7 +611,6 @@ u_char *
+ ngx_http_vhost_traffic_status_display_set_upstream_group(ngx_http_request_t *r,
+     u_char *buf)
+ {
+-    size_t                                 len;
+     u_char                                *p, *o, *s;
+     uint32_t                               hash;
+     unsigned                               type, zone;
+@@ -637,19 +636,19 @@ ngx_http_vhost_traffic_status_display_set_upstream_group(ngx_http_request_t *r,
+     umcf = ngx_http_get_module_main_conf(r, ngx_http_upstream_module);
+     uscfp = umcf->upstreams.elts;
+ 
+-    len = 0;
+-    for (i = 0; i < umcf->upstreams.nelts; i++) {
+-        uscf = uscfp[i];
+-        len = ngx_max(uscf->host.len, len);
+-    }
+-
+-    dst.len = len + sizeof("@[ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255]:65535") - 1;
+-    dst.data = ngx_pnalloc(r->pool, dst.len);
+-    if (dst.data == NULL) {
+-        return buf;
+-    }
+-
+-    p = dst.data;
++    /*
++     * The key of a peer is the name of its group, the separator and the name
++     * of the peer. This used to be built in one buffer held for the whole
++     * walk, sized for the longest group name and an address and a port, on
++     * the reading that a peer is never named anything longer. A unix socket
++     * is named by its path, which passes that easily, and the overflow did
++     * more than run off the end: node_generate_key() takes the key from the
++     * same pool with ngx_pcalloc, which zeroes a region overlapping the tail
++     * just written, so the name was cut short, the lookup missed, and the
++     * peer read as though it had served nothing (#378).
++     *
++     * Each key is now given the room it needs where it is built.
++     */
+ 
+ #if (NGX_HTTP_VHOST_TRAFFIC_STATUS_UPSTREAM_RESOLVE)
+     /*
+@@ -695,12 +694,18 @@ ngx_http_vhost_traffic_status_display_set_upstream_group(ngx_http_request_t *r,
+             ngx_http_upstream_rr_peers_rlock(peers);
+ 
+             for (peer = peers->peer; peer; peer = peer->next) {
++                dst.len = uscf->host.len + sizeof("@") - 1 + peer->name.len;
++                dst.data = ngx_pnalloc(r->pool, dst.len);
++                if (dst.data == NULL) {
++                    ngx_http_upstream_rr_peers_unlock(peers);
++                    return buf;
++                }
++
++                p = dst.data;
+                 p = ngx_cpymem(p, uscf->host.data, uscf->host.len);
+                 *p++ = NGX_HTTP_VHOST_TRAFFIC_STATUS_KEY_SEPARATOR;
+                 p = ngx_cpymem(p, peer->name.data, peer->name.len);
+ 
+-                dst.len = uscf->host.len + sizeof("@") - 1 + peer->name.len;
+-
+                 rc = ngx_http_vhost_traffic_status_node_generate_key(r->pool, &key, &dst, type);
+                 if (rc != NGX_OK) {
+                     ngx_http_upstream_rr_peers_unlock(peers);
+@@ -745,7 +750,6 @@ ngx_http_vhost_traffic_status_display_set_upstream_group(ngx_http_request_t *r,
+ #endif
+                 }
+ 
+-                p = dst.data;
+             }
+ 
+             ngx_http_upstream_rr_peers_unlock(peers);
+@@ -781,12 +785,18 @@ ngx_http_vhost_traffic_status_display_set_upstream_group(ngx_http_request_t *r,
+ 
+                 /* for all A records */
+                 for (k = 0; k < usn.naddrs; k++) {
++                    dst.len = uscf->host.len + sizeof("@") - 1
++                              + usn.addrs[k].name.len;
++                    dst.data = ngx_pnalloc(r->pool, dst.len);
++                    if (dst.data == NULL) {
++                        return buf;
++                    }
++
++                    p = dst.data;
+                     p = ngx_cpymem(p, uscf->host.data, uscf->host.len);
+                     *p++ = NGX_HTTP_VHOST_TRAFFIC_STATUS_KEY_SEPARATOR;
+                     p = ngx_cpymem(p, usn.addrs[k].name.data, usn.addrs[k].name.len);
+ 
+-                    dst.len = uscf->host.len + sizeof("@") - 1 + usn.addrs[k].name.len;
+-
+                     rc = ngx_http_vhost_traffic_status_node_generate_key(r->pool, &key, &dst, type);
+                     if (rc != NGX_OK) {
+                         return buf;
+@@ -815,7 +825,6 @@ ngx_http_vhost_traffic_status_display_set_upstream_group(ngx_http_request_t *r,
+ #endif
+                     }
+ 
+-                    p = dst.data;
+                 }
+             }
+ 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/nginx.git/commitdiff/78db5f9d8711d437be7fd92a2be9305780e4a64c



More information about the pld-cvs-commit mailing list