Skip to content

Commit 153028a

Browse files
[AUTO-CHERRYPICK] [AutoPR- Security] Patch gnutls for CVE-2025-6395 - branch 3.0-dev (microsoft#14298)
Co-authored-by: Azure Linux Security Servicing Account <[email protected]>
1 parent 6b08f71 commit 153028a

File tree

2 files changed

+78
-1
lines changed

2 files changed

+78
-1
lines changed

SPECS/gnutls/CVE-2025-6395.patch

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
From 001a6b04cfea193c4e3073d002a5cb7058d01714 Mon Sep 17 00:00:00 2001
2+
From: Azure Linux Security Servicing Account
3+
4+
Date: Tue, 15 Jul 2025 05:54:27 +0000
5+
Subject: [PATCH] Fix CVE CVE-2025-6395 in gnutls
6+
7+
Upstream Patch Reference: https://gitlab.com/gnutls/gnutls/-/commit/23135619773e6ec087ff2abc65405bd4d5676bad.patch
8+
---
9+
lib/handshake.c | 25 ++++++++++++++++++++++---
10+
lib/state.c | 4 +++-
11+
2 files changed, 25 insertions(+), 4 deletions(-)
12+
13+
diff --git a/lib/handshake.c b/lib/handshake.c
14+
index 722307b..489d021 100644
15+
--- a/lib/handshake.c
16+
+++ b/lib/handshake.c
17+
@@ -589,9 +589,28 @@ static int set_auth_types(gnutls_session_t session)
18+
/* Under TLS1.3 this returns a KX which matches the negotiated
19+
* groups from the key shares; if we are resuming then the KX seen
20+
* here doesn't match the original session. */
21+
- if (!session->internals.resumed)
22+
- kx = gnutls_kx_get(session);
23+
- else
24+
+ if (!session->internals.resumed) {
25+
+ const gnutls_group_entry_st *group = get_group(session);
26+
+
27+
+ if (session->internals.hsk_flags & HSK_PSK_SELECTED) {
28+
+ if (group) {
29+
+ kx = group->pk == GNUTLS_PK_DH ?
30+
+ GNUTLS_KX_DHE_PSK :
31+
+ GNUTLS_KX_ECDHE_PSK;
32+
+ } else {
33+
+ kx = GNUTLS_KX_PSK;
34+
+ }
35+
+ } else if (group) {
36+
+ /* Not necessarily be RSA, but just to
37+
+ * make _gnutls_map_kx_get_cred below
38+
+ * work.
39+
+ */
40+
+ kx = group->pk == GNUTLS_PK_DH ?
41+
+ GNUTLS_KX_DHE_RSA :
42+
+ GNUTLS_KX_ECDHE_RSA;
43+
+ } else
44+
+ kx = GNUTLS_KX_UNKNOWN;
45+
+ } else
46+
kx = GNUTLS_KX_UNKNOWN;
47+
} else {
48+
/* TLS1.2 or earlier, kx is associated with ciphersuite */
49+
diff --git a/lib/state.c b/lib/state.c
50+
index ec514c0..10ec0ea 100644
51+
--- a/lib/state.c
52+
+++ b/lib/state.c
53+
@@ -202,7 +202,8 @@ gnutls_kx_algorithm_t gnutls_kx_get(gnutls_session_t session)
54+
const gnutls_group_entry_st *group = get_group(session);
55+
56+
if (ver->tls13_sem) {
57+
- if (session->internals.hsk_flags & HSK_PSK_SELECTED) {
58+
+ if (gnutls_auth_client_get_type(session) ==
59+
+ GNUTLS_CRD_PSK) {
60+
if (group) {
61+
if (group->pk == GNUTLS_PK_DH)
62+
return GNUTLS_KX_DHE_PSK;
63+
@@ -349,6 +350,7 @@ void reset_binders(gnutls_session_t session)
64+
_gnutls_free_temp_key_datum(&session->key.binders[0].psk);
65+
_gnutls_free_temp_key_datum(&session->key.binders[1].psk);
66+
memset(session->key.binders, 0, sizeof(session->key.binders));
67+
+ session->internals.hsk_flags &= ~HSK_PSK_SELECTED;
68+
}
69+
70+
/* Check whether certificate credentials of type @cert_type are set
71+
--
72+
2.45.3
73+

SPECS/gnutls/gnutls.spec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Summary: The GnuTLS Transport Layer Security Library
22
Name: gnutls
33
Version: 3.8.3
4-
Release: 5%{?dist}
4+
Release: 6%{?dist}
55
License: GPLv3+ AND LGPLv2.1+
66
Vendor: Microsoft Corporation
77
Distribution: Azure Linux
@@ -17,6 +17,7 @@ Patch4: CVE-2024-12243.patch
1717
Patch5: CVE-2025-32990.patch
1818
Patch6: CVE-2025-32989.patch
1919
Patch7: CVE-2025-32988.patch
20+
Patch8: CVE-2025-6395.patch
2021
BuildRequires: autogen-libopts-devel
2122
BuildRequires: gc-devel
2223
BuildRequires: libtasn1-devel
@@ -98,6 +99,9 @@ sed -i 's/TESTS += test-ciphers-openssl.sh//' tests/slow/Makefile.am
9899
%{_mandir}/man3/*
99100

100101
%changelog
102+
* Tue Jul 15 2025 Azure Linux Security Servicing Account <[email protected]> - 3.8.3-6
103+
- Patch for CVE-2025-6395
104+
101105
* Mon Jul 14 2025 Azure Linux Security Servicing Account <[email protected]> - 3.8.3-5
102106
- Patch for CVE-2025-32990, CVE-2025-32989, CVE-2025-32988
103107

0 commit comments

Comments
 (0)