[packages/nginx] Up to 1.31.10; headers-more 0.42, njs AES-CTR length fix

arekm arekm at pld-linux.org
Mon Nov 23 18:08:37 CET 2026


commit c3b4ea0d36ed39e1e07fdfa541a72bd62e513d35
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Mon Nov 23 18:07:11 2026 +0100

    Up to 1.31.10; headers-more 0.42, njs AES-CTR length fix
    
    Fixes CVE-2026-132779.

 nginx-njs-aes-ctr-length.patch | 44 ++++++++++++++++++++++++++++++++++++++++++
 nginx.spec                     | 11 +++++++----
 2 files changed, 51 insertions(+), 4 deletions(-)
---
diff --git a/nginx.spec b/nginx.spec
index e491276..58ea909 100644
--- a/nginx.spec
+++ b/nginx.spec
@@ -43,7 +43,7 @@
 %define		quic_ssl_version	1.1.1
 %define		rtmp_version	1.2.2
 %define		vts_version	0.2.7
-%define		headers_more_version	0.41
+%define		headers_more_version	0.42
 %define		modsecurity_version	1.0.4
 %define		http_cache_purge_version	3.0.4
 %define		njs_version		1.0.2
@@ -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.9
+Version:	1.31.10
 Release:	1
 License:	BSD-like
 Group:		Networking/Daemons/HTTP
 Source0:	https://nginx.org/download/%{name}-%{version}.tar.gz
-# Source0-md5:	c6babcadfb410174fe640ae128635070
+# Source0-md5:	85fa33da34c8a9e17bd036c604d67f9f
 Source1:	https://nginx.org/favicon.ico
 # Source1-md5:	72e228c3809db53da8a884b6676ed36a
 Source2:	proxy.conf
@@ -80,7 +80,7 @@ Source101:	https://github.com/arut/nginx-rtmp-module/archive/v%{rtmp_version}/%{
 Source102:	https://github.com/vozlt/nginx-module-vts/archive/v%{vts_version}.tar.gz
 # Source102-md5:	55c3ebaa6034081095cd5815034983e7
 Source103:	https://github.com/openresty/headers-more-nginx-module/archive/v%{headers_more_version}.tar.gz
-# Source103-md5:	6fd3dd1e5dc20abe1eeca9a2c6e12740
+# Source103-md5:	22c1bb1b987cfbf4cba1d9947c3e2097
 # https://github.com/nginx-modules/ngx_cache_purge
 Source104:	https://github.com/nginx-modules/ngx_cache_purge/archive/refs/tags/%{http_cache_purge_version}.tar.gz
 # Source104-md5:	14006973f52082819bdb2f14983efaff
@@ -91,6 +91,8 @@ Source106:	https://github.com/bellard/quickjs/archive/%{quickjs_commit}/quickjs-
 Patch0:		%{name}-no-Werror.patch
 Patch1:		%{name}-modsecurity-pld.patch
 Patch2:		%{name}-vts-upstream-key-overflow.patch
+# https://github.com/nginx/njs/commit/997957b3db (stack overflow via negative AES-CTR length)
+Patch3:		%{name}-njs-aes-ctr-length.patch
 URL:		https://nginx.org/
 BuildRequires:	pcre2-8-devel
 BuildRequires:	rpmbuild(macros) >= 1.644
@@ -394,6 +396,7 @@ mv ngx_cache_purge-* ngx_cache_purge
 
 %if %{with njs}
 mv njs-%{njs_version} nginx-njs
+%patch -P3 -p1 -d nginx-njs
 mv quickjs-%{quickjs_commit} quickjs
 %endif
 
diff --git a/nginx-njs-aes-ctr-length.patch b/nginx-njs-aes-ctr-length.patch
new file mode 100644
index 0000000..99ba1ef
--- /dev/null
+++ b/nginx-njs-aes-ctr-length.patch
@@ -0,0 +1,44 @@
+From 997957b3dbc7716344b8c9747e96bd04f3102a30 Mon Sep 17 00:00:00 2001
+From: basavaraj-sm05 <basavaraj at digiscrypt.com>
+Date: Fri, 20 Nov 2026 22:27:11 +0530
+Subject: [PATCH] WebCrypto: reject out-of-range AES-CTR counter length
+
+The AES-CTR counter length from algorithm.length was read as a signed
+integer and only rejected when it was zero or above 128, so a negative
+value passed the check.  It was then handed to njs_bn_counter128(),
+whose bits parameter is njs_uint_t (uintptr_t on 64-bit builds), so a
+negative length turned into a very large unsigned count.  The derived
+byte count then drove a memcpy() into a 16-byte stack buffer with an
+attacker-influenced size, overflowing it and reading past the counter
+block.  The value reaches here directly from crypto.subtle.encrypt()
+and decrypt() calls on both engines.
+
+Reject any length below 1 as well, matching the 1 to 128 range the
+error message already states and the WebCrypto specification requires.
+---
+diff --git a/external/njs_webcrypto_module.c b/external/njs_webcrypto_module.c
+index f6932832c..04e441fe7 100644
+--- a/external/njs_webcrypto_module.c
++++ b/external/njs_webcrypto_module.c
+@@ -1302,7 +1302,7 @@ njs_cipher_aes_ctr(njs_vm_t *vm, njs_str_t *data, njs_webcrypto_key_t *key,
+         return NJS_ERROR;
+     }
+ 
+-    if (njs_slow_path(length == 0 || length > 128)) {
++    if (njs_slow_path(length < 1 || length > 128)) {
+         njs_vm_type_error(vm, "AES-CTR algorithm.length must be between "
+                           "1 and 128");
+         return NJS_ERROR;
+diff --git a/external/qjs_webcrypto_module.c b/external/qjs_webcrypto_module.c
+index 23de3d71d..712a18ac7 100644
+--- a/external/qjs_webcrypto_module.c
++++ b/external/qjs_webcrypto_module.c
+@@ -1183,7 +1183,7 @@ qjs_cipher_aes_ctr(JSContext *cx, njs_str_t *data, qjs_webcrypto_key_t *key,
+         return JS_EXCEPTION;
+     }
+ 
+-    if (length == 0 || length > 128) {
++    if (length < 1 || length > 128) {
+         JS_ThrowTypeError(cx, "AES-CTR algorithm.length must be between "
+                           "1 and 128");
+         return JS_EXCEPTION;
================================================================

---- gitweb:

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



More information about the pld-cvs-commit mailing list