summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChangqing Li <changqing.li@windriver.com>2025-03-04 08:50:28 +0800
committerArmin Kuster <akuster808@gmail.com>2025-03-06 09:48:58 -0500
commitfedd8cf51d6f6a2846bc266a9934e6d218bc2de6 (patch)
treea5d981349c533d1a05c190dad6e5a4a3c9286151
parent6abfd35755938a30890e909854d39e379230571c (diff)
downloadmeta-openembedded-fedd8cf51d6f6a2846bc266a9934e6d218bc2de6.tar.gz
nginx: fix CVE-2025-23419
CVE-2025-23419: When multiple server blocks are configured to share the same IP address and port, an attacker can use session resumption to bypass client certificate authentication requirements on these servers. This vulnerability arises when TLS Session Tickets https://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_session_ticket_key are used and/or the SSL session cache https://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_session_cache are used in the default server and the default server is performing client certificate authentication. Note: Software versions which have reached End of Technical Support (EoTS) are not evaluated. Refer: https://nvd.nist.gov/vuln/detail/CVE-2025-23419 This partially cherry picked from commit 13935cf9fdc3c8d8278c70716417d3b71c36140e, the original patch had 2 parts. One fixed problem in `http/ngx_http_request` module and the second fixed problem in `stream/ngx_stream_ssl_module` module. The fix for `stream/ngx_stream_ssl_module can't be aplied because, the 'stream virtual servers' funcionality was added later in this commit: https://github.com/nginx/nginx/commit/d21675228a0ba8d4331e05c60660228a5d3326de. Therefore only `http/ngx_http_request` part was backported. Signed-off-by: Changqing Li <changqing.li@windriver.com> Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r--meta-webserver/recipes-httpd/nginx/files/CVE-2025-23419.patch87
-rw-r--r--meta-webserver/recipes-httpd/nginx/nginx_1.24.0.bb2
2 files changed, 89 insertions, 0 deletions
diff --git a/meta-webserver/recipes-httpd/nginx/files/CVE-2025-23419.patch b/meta-webserver/recipes-httpd/nginx/files/CVE-2025-23419.patch
new file mode 100644
index 0000000000..e42664f11a
--- /dev/null
+++ b/meta-webserver/recipes-httpd/nginx/files/CVE-2025-23419.patch
@@ -0,0 +1,87 @@
1From bc23d3cdf98e855a5409d3584a241d4d773ab306 Mon Sep 17 00:00:00 2001
2From: Sergey Kandaurov <pluknet@nginx.com>
3Date: Wed, 22 Jan 2025 18:55:44 +0400
4Subject: [PATCH] SNI: added restriction for TLSv1.3 cross-SNI session
5 resumption.
6
7In OpenSSL, session resumption always happens in the default SSL context,
8prior to invoking the SNI callback. Further, unlike in TLSv1.2 and older
9protocols, SSL_get_servername() returns values received in the resumption
10handshake, which may be different from the value in the initial handshake.
11Notably, this makes the restriction added in b720f650b insufficient for
12sessions resumed with different SNI server name.
13
14Considering the example from b720f650b, previously, a client was able to
15request example.org by presenting a certificate for example.org, then to
16resume and request example.com.
17
18The fix is to reject handshakes resumed with a different server name, if
19verification of client certificates is enabled in a corresponding server
20configuration.
21
22CVE: CVE-2025-23419
23Upstream-Status: Backport [https://github.com/nginx/nginx/commit/13935cf9fdc3c8d8278c70716417d3b71c36140e]
24
25This patch is partially cherry picked from commit
2613935cf9fdc3c8d8278c70716417d3b71c36140e, the original patch had 2
27parts. One fixed problem in `http/ngx_http_request` module and the
28second fixed problem in `stream/ngx_stream_ssl_module` module. The fix
29for `stream/ngx_stream_ssl_module can't be aplied because, the 'stream
30virtual servers' funcionality was added later in this commit:
31https://github.com/nginx/nginx/commit/d21675228a0ba8d4331e05c60660228a5d3326de.
32Therefore only `http/ngx_http_request` part was backported.
33
34Signed-off-by: Changqing Li <changqing.li@windriver.com>
35
36---
37 src/http/ngx_http_request.c | 27 +++++++++++++++++++++++++--
38 1 file changed, 25 insertions(+), 2 deletions(-)
39
40diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
41index 5e0340b..514c021 100644
42--- a/src/http/ngx_http_request.c
43+++ b/src/http/ngx_http_request.c
44@@ -907,6 +907,31 @@ ngx_http_ssl_servername(ngx_ssl_conn_t *ssl_conn, int *ad, void *arg)
45 goto done;
46 }
47
48+ sscf = ngx_http_get_module_srv_conf(cscf->ctx, ngx_http_ssl_module);
49+
50+#if (defined TLS1_3_VERSION \
51+ && !defined LIBRESSL_VERSION_NUMBER && !defined OPENSSL_IS_BORINGSSL)
52+
53+ /*
54+ * SSL_SESSION_get0_hostname() is only available in OpenSSL 1.1.1+,
55+ * but servername being negotiated in every TLSv1.3 handshake
56+ * is only returned in OpenSSL 1.1.1+ as well
57+ */
58+
59+ if (sscf->verify) {
60+ const char *hostname;
61+
62+ hostname = SSL_SESSION_get0_hostname(SSL_get0_session(ssl_conn));
63+
64+ if (hostname != NULL && ngx_strcmp(hostname, servername) != 0) {
65+ c->ssl->handshake_rejected = 1;
66+ *ad = SSL_AD_ACCESS_DENIED;
67+ return SSL_TLSEXT_ERR_ALERT_FATAL;
68+ }
69+ }
70+
71+#endif
72+
73 hc->ssl_servername = ngx_palloc(c->pool, sizeof(ngx_str_t));
74 if (hc->ssl_servername == NULL) {
75 goto error;
76@@ -920,8 +945,6 @@ ngx_http_ssl_servername(ngx_ssl_conn_t *ssl_conn, int *ad, void *arg)
77
78 ngx_set_connection_log(c, clcf->error_log);
79
80- sscf = ngx_http_get_module_srv_conf(hc->conf_ctx, ngx_http_ssl_module);
81-
82 c->ssl->buffer_size = sscf->buffer_size;
83
84 if (sscf->ssl.ctx) {
85--
862.34.1
87
diff --git a/meta-webserver/recipes-httpd/nginx/nginx_1.24.0.bb b/meta-webserver/recipes-httpd/nginx/nginx_1.24.0.bb
index 2e865e400e..e288b19da3 100644
--- a/meta-webserver/recipes-httpd/nginx/nginx_1.24.0.bb
+++ b/meta-webserver/recipes-httpd/nginx/nginx_1.24.0.bb
@@ -2,5 +2,7 @@ require nginx.inc
2 2
3LIC_FILES_CHKSUM = "file://LICENSE;md5=175abb631c799f54573dc481454c8632" 3LIC_FILES_CHKSUM = "file://LICENSE;md5=175abb631c799f54573dc481454c8632"
4 4
5SRC_URI:append = " file://CVE-2025-23419.patch"
6
5SRC_URI[sha256sum] = "77a2541637b92a621e3ee76776c8b7b40cf6d707e69ba53a940283e30ff2f55d" 7SRC_URI[sha256sum] = "77a2541637b92a621e3ee76776c8b7b40cf6d707e69ba53a940283e30ff2f55d"
6 8