* [wrynose][PATCH 1/5] gnutls: fix CVE-2026-42012
@ 2026-09-09 13:35 Jakub Szczudlo (Nokia)
2026-09-09 13:35 ` [wrynose][PATCH 2/5] gnutls: fix CVE-2026-42013 Jakub Szczudlo (Nokia)
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Jakub Szczudlo (Nokia) @ 2026-09-09 13:35 UTC (permalink / raw)
To: openembedded-core@lists.openembedded.org
Cc: yoann.congal@smile.fr, Jakub Szczudlo (Nokia)
Backport patch to fix CVE-2026-42012.
References:
https://nvd.nist.gov/vuln/detail/CVE-2026-42012
Upstream fix:
https://gitlab.com/gnutls/gnutls/-/commit/8dcc6a1f48945997666ac9f10896819edd01a03b
Tested with ptest
Pre patches taken from upstream so CVE fix will land cleanly
Signed-off-by: Jakub Szczudlo <jakub.szczudlo@nokia.com>
---
.../gnutls/gnutls/CVE-2026-42012-pre1.patch | 70 ++++++++
.../gnutls/gnutls/CVE-2026-42012-pre2.patch | 153 ++++++++++++++++++
.../gnutls/gnutls/CVE-2026-42012.patch | 48 ++++++
meta/recipes-support/gnutls/gnutls_3.8.12.bb | 3 +
4 files changed, 274 insertions(+)
create mode 100644 meta/recipes-support/gnutls/gnutls/CVE-2026-42012-pre1.patch
create mode 100644 meta/recipes-support/gnutls/gnutls/CVE-2026-42012-pre2.patch
create mode 100644 meta/recipes-support/gnutls/gnutls/CVE-2026-42012.patch
diff --git a/meta/recipes-support/gnutls/gnutls/CVE-2026-42012-pre1.patch b/meta/recipes-support/gnutls/gnutls/CVE-2026-42012-pre1.patch
new file mode 100644
index 0000000000..1149dafef2
--- /dev/null
+++ b/meta/recipes-support/gnutls/gnutls/CVE-2026-42012-pre1.patch
@@ -0,0 +1,70 @@
+Backport of:
+
+From 6133fb459b74a9dcfa2d0ff010a4e03c56822d39 Mon Sep 17 00:00:00 2001
+From: Alexander Sosedkin <asosedkin@redhat.com>
+Date: Fri, 13 Mar 2026 17:00:03 +0100
+Subject: [PATCH] x509/hostname-verify: refactor and simplify CN fallback logic
+
+Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
+CVE: CVE-2026-42012
+Upstream-Status: Backport [https://gitlab.com/gnutls/gnutls/-/commit/6133fb459b74a9dcfa2d0ff010a4e03c56822d39]
+
+Signed-off-by: Jakub Szczudlo <jakub.szczudlo@nokia.com>
+---
+ lib/x509/hostname-verify.c | 15 ++++++---------
+ 1 file changed, 6 insertions(+), 9 deletions(-)
+
+--- a/lib/x509/hostname-verify.c
++++ b/lib/x509/hostname-verify.c
+@@ -108,7 +108,7 @@ unsigned gnutls_x509_crt_check_ip(gnutls
+ * that we do not fallback to CN-ID if we encounter a supported name
+ * type.
+ */
+-#define IS_SAN_SUPPORTED(san) \
++#define PRECLUDES_CN_FALLBACK(san) \
+ (san == GNUTLS_SAN_DNSNAME || san == GNUTLS_SAN_IPADDRESS)
+
+ /**
+@@ -151,13 +151,12 @@ unsigned gnutls_x509_crt_check_hostname2
+ {
+ char dnsname[MAX_CN];
+ size_t dnsnamesize;
+- int found_dnsname = 0;
+ int ret = 0;
+ int i = 0;
+ struct in_addr ipv4;
+ char *p = NULL;
+ char *a_hostname;
+- unsigned have_other_addresses = 0;
++ bool cn_fallback_allowed = true;
+ gnutls_datum_t out;
+
+ /* check whether @hostname is an ip address */
+@@ -213,9 +212,10 @@ hostname_fallback:
+ ret = gnutls_x509_crt_get_subject_alt_name(cert, i, dnsname,
+ &dnsnamesize, NULL);
+
+- if (ret == GNUTLS_SAN_DNSNAME) {
+- found_dnsname = 1;
++ if (PRECLUDES_CN_FALLBACK(ret))
++ cn_fallback_allowed = false;
+
++ if (ret == GNUTLS_SAN_DNSNAME) {
+ if (memchr(dnsname, '\0', dnsnamesize)) {
+ _gnutls_debug_log(
+ "certificate has %s with embedded null in name\n",
+@@ -236,13 +236,10 @@ hostname_fallback:
+ ret = 1;
+ goto cleanup;
+ }
+- } else {
+- if (IS_SAN_SUPPORTED(ret))
+- have_other_addresses = 1;
+ }
+ }
+
+- if (!have_other_addresses && !found_dnsname &&
++ if (cn_fallback_allowed &&
+ _gnutls_check_key_purpose(cert, GNUTLS_KP_TLS_WWW_SERVER, 0) != 0) {
+ /* did not get the necessary extension, use CN instead, if the
+ * certificate would have been acceptable for a TLS WWW server purpose.
diff --git a/meta/recipes-support/gnutls/gnutls/CVE-2026-42012-pre2.patch b/meta/recipes-support/gnutls/gnutls/CVE-2026-42012-pre2.patch
new file mode 100644
index 0000000000..c192a144c0
--- /dev/null
+++ b/meta/recipes-support/gnutls/gnutls/CVE-2026-42012-pre2.patch
@@ -0,0 +1,153 @@
+Backport of:
+
+From 5cc003b9688378f6c7934b1df0aa147e80006be4 Mon Sep 17 00:00:00 2001
+From: Alexander Sosedkin <asosedkin@redhat.com>
+Date: Fri, 13 Mar 2026 17:41:33 +0100
+Subject: [PATCH] x509: add bare-bones awareness of SRV virtual SAN
+
+There's no support for constraints, no certtool support, no nothing.
+Just added what's easy to add because I needed a virtual SAN for them.
+
+Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
+CVE: CVE-2026-42012
+Upstream-Status: Backport [https://gitlab.com/gnutls/gnutls/-/commit/5cc003b9688378f6c7934b1df0aa147e80006be4]
+
+Signed-off-by: Jakub Szczudlo <jakub.szczudlo@nokia.com>
+---
+ lib/includes/gnutls/gnutls.h.in | 4 +++-
+ lib/x509/common.h | 1 +
+ lib/x509/name_constraints.c | 3 ++-
+ lib/x509/output.c | 6 ++++++
+ lib/x509/virt-san.c | 23 +++++++++++++++++++++++
+ lib/x509/x509.c | 3 ++-
+ 6 files changed, 37 insertions(+), 3 deletions(-)
+
+--- a/lib/includes/gnutls/gnutls.h.in
++++ b/lib/includes/gnutls/gnutls.h.in
+@@ -2698,6 +2698,7 @@ void gnutls_psk_set_server_params_functi
+ * @GNUTLS_SAN_OTHERNAME_XMPP: Virtual SAN, used by certain functions for convenience.
+ * @GNUTLS_SAN_OTHERNAME_KRB5PRINCIPAL: Virtual SAN, used by certain functions for convenience.
+ * @GNUTLS_SAN_OTHERNAME_MSUSERPRINCIPAL: Virtual SAN, used by certain functions for convenience.
++ * @GNUTLS_SAN_OTHERNAME_SRV: Virtual SAN, used by certain functions for convenience.
+ *
+ * Enumeration of different subject alternative names types.
+ */
+@@ -2715,7 +2716,8 @@ typedef enum gnutls_x509_subject_alt_nam
+ Used by gnutls_x509_crt_get_subject_alt_othername_oid. */
+ GNUTLS_SAN_OTHERNAME_XMPP = 1000,
+ GNUTLS_SAN_OTHERNAME_KRB5PRINCIPAL,
+- GNUTLS_SAN_OTHERNAME_MSUSERPRINCIPAL
++ GNUTLS_SAN_OTHERNAME_MSUSERPRINCIPAL,
++ GNUTLS_SAN_OTHERNAME_SRV
+ } gnutls_x509_subject_alt_name_t;
+
+ struct gnutls_openpgp_crt_int;
+--- a/lib/x509/common.h
++++ b/lib/x509/common.h
+@@ -107,6 +107,7 @@
+ #define XMPP_OID "1.3.6.1.5.5.7.8.5"
+ #define KRB5_PRINCIPAL_OID "1.3.6.1.5.2.2"
+ #define MSUSER_PRINCIPAL_NAME_OID "1.3.6.1.4.1.311.20.2.3"
++#define SRV_OID "1.3.6.1.5.5.7.8.7"
+ #define PKIX1_RSA_PSS_MGF1_OID "1.2.840.113549.1.1.8"
+ #define PKIX1_RSA_OAEP_P_SPECIFIED_OID "1.9"
+
+--- a/lib/x509/name_constraints.c
++++ b/lib/x509/name_constraints.c
+@@ -516,7 +516,8 @@ static int validate_name_constraints_nod
+ if (type != GNUTLS_SAN_DNSNAME && type != GNUTLS_SAN_RFC822NAME &&
+ type != GNUTLS_SAN_DN && type != GNUTLS_SAN_URI &&
+ type != GNUTLS_SAN_IPADDRESS &&
+- type != GNUTLS_SAN_OTHERNAME_MSUSERPRINCIPAL) {
++ type != GNUTLS_SAN_OTHERNAME_MSUSERPRINCIPAL &&
++ type != GNUTLS_SAN_OTHERNAME_SRV) {
+ return gnutls_assert_val(GNUTLS_E_X509_UNKNOWN_SAN);
+ }
+
+--- a/lib/x509/output.c
++++ b/lib/x509/output.c
+@@ -121,6 +121,7 @@ static void print_name(gnutls_buffer_st
+ if ((type == GNUTLS_SAN_DNSNAME || type == GNUTLS_SAN_OTHERNAME_XMPP ||
+ type == GNUTLS_SAN_OTHERNAME_KRB5PRINCIPAL ||
+ type == GNUTLS_SAN_OTHERNAME_MSUSERPRINCIPAL ||
++ type == GNUTLS_SAN_OTHERNAME_SRV ||
+ type == GNUTLS_SAN_RFC822NAME || type == GNUTLS_SAN_URI) &&
+ sname != NULL && strlen(sname) != name->size) {
+ adds(str, _("warning: SAN contains an embedded NUL, "
+@@ -180,6 +181,11 @@ static void print_name(gnutls_buffer_st
+ name->size, NON_NULL(name->data));
+ break;
+
++ case GNUTLS_SAN_OTHERNAME_SRV:
++ addf(str, _("%sSRVName: %.*s\n"), prefix, name->size,
++ NON_NULL(name->data));
++ break;
++
+ default:
+ addf(str, _("%sUnknown name: "), prefix);
+ _gnutls_buffer_hexprint(str, name->data, name->size);
+--- a/lib/x509/virt-san.c
++++ b/lib/x509/virt-san.c
+@@ -45,6 +45,9 @@ static int san_othername_to_virtual(cons
+ memcmp(oid, MSUSER_PRINCIPAL_NAME_OID,
+ sizeof(MSUSER_PRINCIPAL_NAME_OID) - 1) == 0)
+ return GNUTLS_SAN_OTHERNAME_MSUSERPRINCIPAL;
++ else if ((unsigned)size == (sizeof(SRV_OID) - 1) &&
++ memcmp(oid, SRV_OID, sizeof(SRV_OID) - 1) == 0)
++ return GNUTLS_SAN_OTHERNAME_SRV;
+ }
+
+ return GNUTLS_SAN_OTHERNAME;
+@@ -59,6 +62,8 @@ static const char *virtual_to_othername_
+ return KRB5_PRINCIPAL_OID;
+ case GNUTLS_SAN_OTHERNAME_MSUSERPRINCIPAL:
+ return MSUSER_PRINCIPAL_NAME_OID;
++ case GNUTLS_SAN_OTHERNAME_SRV:
++ return SRV_OID;
+ default:
+ return NULL;
+ }
+@@ -126,6 +131,15 @@ int _gnutls_alt_name_assign_virt_type(st
+ name->type = GNUTLS_SAN_OTHERNAME;
+ break;
+
++ case GNUTLS_SAN_OTHERNAME_SRV:
++ ret = _gnutls_x509_encode_string(ASN1_ETYPE_IA5_STRING,
++ san->data, san->size,
++ &encoded);
++ if (ret < 0)
++ return gnutls_assert_val(ret);
++ name->san = _gnutls_steal_datum(&encoded);
++ break;
++
+ default:
+ return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST);
+ }
+@@ -187,6 +201,15 @@ int gnutls_x509_othername_to_virtual(con
+ othername->data,
+ othername->size, virt, 0);
+ if (ret < 0) {
++ gnutls_assert();
++ return ret;
++ }
++ return 0;
++ case GNUTLS_SAN_OTHERNAME_SRV:
++ ret = _gnutls_x509_decode_string(ASN1_ETYPE_IA5_STRING,
++ othername->data,
++ othername->size, virt, 0);
++ if (ret < 0) {
+ gnutls_assert();
+ return ret;
+ }
+--- a/lib/x509/x509.c
++++ b/lib/x509/x509.c
+@@ -1562,7 +1562,8 @@ inline static int is_type_printable(int
+ {
+ if (type == GNUTLS_SAN_DNSNAME || type == GNUTLS_SAN_RFC822NAME ||
+ type == GNUTLS_SAN_URI || type == GNUTLS_SAN_OTHERNAME_XMPP ||
+- type == GNUTLS_SAN_OTHERNAME || type == GNUTLS_SAN_REGISTERED_ID)
++ type == GNUTLS_SAN_OTHERNAME_SRV || type == GNUTLS_SAN_OTHERNAME ||
++ type == GNUTLS_SAN_REGISTERED_ID)
+ return 1;
+ else
+ return 0;
diff --git a/meta/recipes-support/gnutls/gnutls/CVE-2026-42012.patch b/meta/recipes-support/gnutls/gnutls/CVE-2026-42012.patch
new file mode 100644
index 0000000000..1f43efc122
--- /dev/null
+++ b/meta/recipes-support/gnutls/gnutls/CVE-2026-42012.patch
@@ -0,0 +1,48 @@
+From 8dcc6a1f48945997666ac9f10896819edd01a03b Mon Sep 17 00:00:00 2001
+From: Alexander Sosedkin <asosedkin@redhat.com>
+Date: Fri, 13 Mar 2026 17:02:07 +0100
+Subject: [PATCH] x509/hostname-verify: make URI/SRV SAN preclude CN fallback
+
+URI/SRV SAN did not suppress CN fallback as required by RFC 6125 6.4.4:
+> a client MUST NOT seek a match for a reference identifier of CN-ID
+> if the presented identifiers include a DNS-ID, *SRV-ID*, *URI-ID*,
+> or any application-specific identifier types supported by the client.
+
+With this change, certificates containing URI or SRV SAN
+no longer pass DNS hostname checks via CN fallback
+to avoid potential misuse of such certificates
+beyond their original purpose.
+
+Reported-by: Oleh Konko <security@1seal.org>
+Fixes: #1802
+Fixes: CVE-2026-42012
+Fixes: GNUTLS-SA-2026-04-29-7
+CVSS: 6.5 Medium CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:H/A:N
+Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
+CVE: CVE-2026-42012
+Upstream-Status: Backport [https://gitlab.com/gnutls/gnutls/-/commit/8dcc6a1f48945997666ac9f10896819edd01a03b]
+
+Signed-off-by: Jakub Szczudlo <jakub.szczudlo@nokia.com>
+---
+ lib/x509/hostname-verify.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/lib/x509/hostname-verify.c b/lib/x509/hostname-verify.c
+index e7597ad3b0..d989bb1abc 100644
+--- a/lib/x509/hostname-verify.c
++++ b/lib/x509/hostname-verify.c
+@@ -108,8 +108,9 @@ unsigned gnutls_x509_crt_check_ip(gnutls_x509_crt_t cert,
+ * that we do not fallback to CN-ID if we encounter a supported name
+ * type.
+ */
+-#define PRECLUDES_CN_FALLBACK(san) \
+- (san == GNUTLS_SAN_DNSNAME || san == GNUTLS_SAN_IPADDRESS)
++#define PRECLUDES_CN_FALLBACK(san) \
++ (san == GNUTLS_SAN_DNSNAME || san == GNUTLS_SAN_IPADDRESS || \
++ san == GNUTLS_SAN_URI || san == GNUTLS_SAN_OTHERNAME_SRV)
+
+ /**
+ * gnutls_x509_crt_check_hostname2:
+--
+GitLab
+
diff --git a/meta/recipes-support/gnutls/gnutls_3.8.12.bb b/meta/recipes-support/gnutls/gnutls_3.8.12.bb
index 3ad011742e..8716c929e7 100644
--- a/meta/recipes-support/gnutls/gnutls_3.8.12.bb
+++ b/meta/recipes-support/gnutls/gnutls_3.8.12.bb
@@ -37,6 +37,9 @@ SRC_URI = "https://www.gnupg.org/ftp/gcrypt/gnutls/v${SHRT_VER}/gnutls-${PV}.tar
file://CVE-2026-42009_p1.patch \
file://CVE-2026-42009_p2.patch \
file://CVE-2026-3833.patch \
+ file://CVE-2026-42012-pre1.patch \
+ file://CVE-2026-42012-pre2.patch \
+ file://CVE-2026-42012.patch \
"
SRC_URI[sha256sum] = "a7b341421bfd459acf7a374ca4af3b9e06608dcd7bd792b2bf470bea012b8e51"
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [wrynose][PATCH 2/5] gnutls: fix CVE-2026-42013
2026-09-09 13:35 [wrynose][PATCH 1/5] gnutls: fix CVE-2026-42012 Jakub Szczudlo (Nokia)
@ 2026-09-09 13:35 ` Jakub Szczudlo (Nokia)
2026-09-09 13:35 ` [wrynose][PATCH 3/5] gnutls: fix CVE-2026-42014 Jakub Szczudlo (Nokia)
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Jakub Szczudlo (Nokia) @ 2026-09-09 13:35 UTC (permalink / raw)
To: openembedded-core@lists.openembedded.org
Cc: yoann.congal@smile.fr, Jakub Szczudlo (Nokia)
Backport patch to fix CVE-2026-42013.
References:
https://nvd.nist.gov/vuln/detail/CVE-2026-42013
Upstream fix:
https://gitlab.com/gnutls/gnutls/-/commit/29801bef00ecc0f23c0bac4cd333b269cd2c1af4
Tested with ptest
Pre patch taken from upstream so CVE fix will land cleanly
Signed-off-by: Jakub Szczudlo <jakub.szczudlo@nokia.com>
---
.../gnutls/gnutls/CVE-2026-42013-pre1.patch | 56 ++++++++++++++
.../gnutls/gnutls/CVE-2026-42013.patch | 74 +++++++++++++++++++
meta/recipes-support/gnutls/gnutls_3.8.12.bb | 2 +
3 files changed, 132 insertions(+)
create mode 100644 meta/recipes-support/gnutls/gnutls/CVE-2026-42013-pre1.patch
create mode 100644 meta/recipes-support/gnutls/gnutls/CVE-2026-42013.patch
diff --git a/meta/recipes-support/gnutls/gnutls/CVE-2026-42013-pre1.patch b/meta/recipes-support/gnutls/gnutls/CVE-2026-42013-pre1.patch
new file mode 100644
index 0000000000..53687cb53b
--- /dev/null
+++ b/meta/recipes-support/gnutls/gnutls/CVE-2026-42013-pre1.patch
@@ -0,0 +1,56 @@
+From 3ee2cb707002f755e4bda3f75285caa0cb36c214 Mon Sep 17 00:00:00 2001
+From: Alexander Sosedkin <asosedkin@redhat.com>
+Date: Wed, 15 Apr 2026 15:35:59 +0200
+Subject: [PATCH] x509/email-verify: call fallback DN fallback
+
+A comment was inaccurately referring to DN email field fallback
+as CN fallback.
+Rename a few things as well to match x509/hostname-verify more closely.
+
+Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
+CVE: CVE-2026-42013
+Upstream-Status: Backport [https://gitlab.com/gnutls/gnutls/-/commit/3ee2cb707002f755e4bda3f75285caa0cb36c214]
+
+Signed-off-by: Jakub Szczudlo <jakub.szczudlo@nokia.com>
+---
+ lib/x509/email-verify.c | 12 +++++-------
+ 1 file changed, 5 insertions(+), 7 deletions(-)
+
+diff --git a/lib/x509/email-verify.c b/lib/x509/email-verify.c
+index dbef0bb86e..3c22ffed37 100644
+--- a/lib/x509/email-verify.c
++++ b/lib/x509/email-verify.c
+@@ -42,7 +42,7 @@ unsigned gnutls_x509_crt_check_email(gnutls_x509_crt_t cert, const char *email,
+ {
+ char rfc822name[MAX_CN];
+ size_t rfc822namesize;
+- int found_rfc822name = 0;
++ bool dn_fallback_allowed = true;
+ int ret = 0;
+ int i = 0;
+ char *a_email;
+@@ -76,7 +76,7 @@ unsigned gnutls_x509_crt_check_email(gnutls_x509_crt_t cert, const char *email,
+ cert, i, rfc822name, &rfc822namesize, NULL);
+
+ if (ret == GNUTLS_SAN_RFC822NAME) {
+- found_rfc822name = 1;
++ dn_fallback_allowed = false;
+
+ if (memchr(rfc822name, '\0', rfc822namesize)) {
+ _gnutls_debug_log(
+@@ -102,12 +102,10 @@ unsigned gnutls_x509_crt_check_email(gnutls_x509_crt_t cert, const char *email,
+ }
+ }
+
+- if (!found_rfc822name) {
+- /* did not get the necessary extension, use CN instead
+- */
++ if (dn_fallback_allowed) {
++ /* did not get the necessary extension, use DN email instead */
+
+- /* enforce the RFC6125 (§1.8) requirement that only
+- * a single CN must be present */
++ /* only a single one must be present */
+ rfc822namesize = sizeof(rfc822name);
+ ret = gnutls_x509_crt_get_dn_by_oid(cert,
+ GNUTLS_OID_PKCS9_EMAIL, 1,
diff --git a/meta/recipes-support/gnutls/gnutls/CVE-2026-42013.patch b/meta/recipes-support/gnutls/gnutls/CVE-2026-42013.patch
new file mode 100644
index 0000000000..c63e4d7039
--- /dev/null
+++ b/meta/recipes-support/gnutls/gnutls/CVE-2026-42013.patch
@@ -0,0 +1,74 @@
+From 29801bef00ecc0f23c0bac4cd333b269cd2c1af4 Mon Sep 17 00:00:00 2001
+From: Alexander Sosedkin <asosedkin@redhat.com>
+Date: Wed, 15 Apr 2026 16:02:19 +0200
+Subject: [PATCH] x509: prevent fallback on oversized SAN
+
+Passing oversized SAN did not preclude CN (or DN email) fallback
+during verification, which is an RFC 6125 6.4.4 violation.
+
+Now oversized SAN are skipped over,
+but prevent the fallback from happening.
+
+Reported-by: Haruto Kimura (Stella)
+Reported-by: Joshua Rogers of AISLE Research Team <joshua@joshua.hu>
+Fixes: #1825
+Fixes: #1849
+Fixes: CVE-2026-42013
+Fixes: GNUTLS-SA-2026-04-27-8
+CVSS: 6.5 Moderate CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:H/A:N
+Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
+CVE: CVE-2026-42013
+Upstream-Status: Backport [https://gitlab.com/gnutls/gnutls/-/commit/29801bef00ecc0f23c0bac4cd333b269cd2c1af4]
+
+Signed-off-by: Jakub Szczudlo <jakub.szczudlo@nokia.com>
+---
+ lib/x509/email-verify.c | 14 ++++++++++++++
+ lib/x509/hostname-verify.c | 14 ++++++++++++++
+ 2 files changed, 28 insertions(+)
+
+--- a/lib/x509/email-verify.c
++++ b/lib/x509/email-verify.c
+@@ -75,6 +75,20 @@ unsigned gnutls_x509_crt_check_email(gnu
+ ret = gnutls_x509_crt_get_subject_alt_name(
+ cert, i, rfc822name, &rfc822namesize, NULL);
+
++ if (ret < 0) {
++ if (ret == GNUTLS_E_SHORT_MEMORY_BUFFER) {
++ /* oversized SAN; proceed without DN fallback */
++ _gnutls_debug_log("oversized SAN ignored, "
++ "disabling DN fallback\n");
++ dn_fallback_allowed = false;
++ ret = 0;
++ continue;
++ }
++ if (ret != GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE)
++ gnutls_assert();
++ break;
++ }
++
+ if (ret == GNUTLS_SAN_RFC822NAME) {
+ dn_fallback_allowed = false;
+
+--- a/lib/x509/hostname-verify.c
++++ b/lib/x509/hostname-verify.c
+@@ -213,6 +213,20 @@ hostname_fallback:
+ ret = gnutls_x509_crt_get_subject_alt_name(cert, i, dnsname,
+ &dnsnamesize, NULL);
+
++ if (ret < 0) {
++ if (ret == GNUTLS_E_SHORT_MEMORY_BUFFER) {
++ /* oversized SAN; proceed without CN fallback */
++ _gnutls_debug_log("oversized SAN ignored, "
++ "disabling CN fallback\n");
++ cn_fallback_allowed = false;
++ ret = 0;
++ continue;
++ }
++ if (ret != GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE)
++ gnutls_assert();
++ break;
++ }
++
+ if (PRECLUDES_CN_FALLBACK(ret))
+ cn_fallback_allowed = false;
+
diff --git a/meta/recipes-support/gnutls/gnutls_3.8.12.bb b/meta/recipes-support/gnutls/gnutls_3.8.12.bb
index 8716c929e7..2f671c4886 100644
--- a/meta/recipes-support/gnutls/gnutls_3.8.12.bb
+++ b/meta/recipes-support/gnutls/gnutls_3.8.12.bb
@@ -40,6 +40,8 @@ SRC_URI = "https://www.gnupg.org/ftp/gcrypt/gnutls/v${SHRT_VER}/gnutls-${PV}.tar
file://CVE-2026-42012-pre1.patch \
file://CVE-2026-42012-pre2.patch \
file://CVE-2026-42012.patch \
+ file://CVE-2026-42013-pre1.patch \
+ file://CVE-2026-42013.patch \
"
SRC_URI[sha256sum] = "a7b341421bfd459acf7a374ca4af3b9e06608dcd7bd792b2bf470bea012b8e51"
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [wrynose][PATCH 3/5] gnutls: fix CVE-2026-42014
2026-09-09 13:35 [wrynose][PATCH 1/5] gnutls: fix CVE-2026-42012 Jakub Szczudlo (Nokia)
2026-09-09 13:35 ` [wrynose][PATCH 2/5] gnutls: fix CVE-2026-42013 Jakub Szczudlo (Nokia)
@ 2026-09-09 13:35 ` Jakub Szczudlo (Nokia)
2026-09-09 13:35 ` [wrynose][PATCH 4/5] gnutls: fix CVE-2026-42015 Jakub Szczudlo (Nokia)
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Jakub Szczudlo (Nokia) @ 2026-09-09 13:35 UTC (permalink / raw)
To: openembedded-core@lists.openembedded.org
Cc: yoann.congal@smile.fr, Jakub Szczudlo (Nokia)
Backport patch to fix CVE-2026-42014.
References:
https://nvd.nist.gov/vuln/detail/CVE-2026-42014
Upstream fix:
https://gitlab.com/gnutls/gnutls/-/commit/3957f136e2ed23caf176a594b54b3827f5cef701
Tested with ptest
Signed-off-by: Jakub Szczudlo <jakub.szczudlo@nokia.com>
---
.../gnutls/gnutls/CVE-2026-42014.patch | 60 +++++++++++++++++++
meta/recipes-support/gnutls/gnutls_3.8.12.bb | 1 +
2 files changed, 61 insertions(+)
create mode 100644 meta/recipes-support/gnutls/gnutls/CVE-2026-42014.patch
diff --git a/meta/recipes-support/gnutls/gnutls/CVE-2026-42014.patch b/meta/recipes-support/gnutls/gnutls/CVE-2026-42014.patch
new file mode 100644
index 0000000000..776733829a
--- /dev/null
+++ b/meta/recipes-support/gnutls/gnutls/CVE-2026-42014.patch
@@ -0,0 +1,60 @@
+From 3957f136e2ed23caf176a594b54b3827f5cef701 Mon Sep 17 00:00:00 2001
+From: Alexander Sosedkin <asosedkin@redhat.com>
+Date: Wed, 18 Mar 2026 18:19:06 +0100
+Subject: [PATCH] pkcs11_write: fix UAF and leak in gnutls_pkcs11_token_set_pin
+
+Changing Security Officer PIN with gnutls_pkcs11_token_set_pin() with
+oldpin == NULL for a token that lacks a protected authentication path
+led to a use-after-free.
+
+Reported-by: Luigino Camastra and Joshua Rogers of AISLE Research Team
+Fixes: #1766
+Fixes: #1809
+Fixes: CVE-2026-42014
+Fixes: GNUTLS-SA-2026-04-29-9
+CVSS: 4.0 Medium CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
+Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
+
+CVE: CVE-2026-42014
+Upstream-Status: Backport [https://gitlab.com/gnutls/gnutls/-/commit/3957f136e2ed23caf176a594b54b3827f5cef701]
+
+Signed-off-by: Jakub Szczudlo <jakub.szczudlo@nokia.com>
+---
+diff --git a/lib/pkcs11_write.c b/lib/pkcs11_write.c
+index 64b85a2..1dff578 100644
+--- a/lib/pkcs11_write.c
++++ b/lib/pkcs11_write.c
+@@ -1266,10 +1266,9 @@ int gnutls_pkcs11_token_set_pin(const char *token_url, const char *oldpin,
+ ses_flags = SESSION_WRITE | SESSION_LOGIN;
+
+ ret = pkcs11_open_session(&sinfo, NULL, info, ses_flags);
+- p11_kit_uri_free(info);
+-
+ if (ret < 0) {
+ gnutls_assert();
++ p11_kit_uri_free(info);
+ return ret;
+ }
+
+@@ -1290,9 +1289,11 @@ int gnutls_pkcs11_token_set_pin(const char *token_url, const char *oldpin,
+ oldpin_size = L(oldpin);
+
+ if (!(sinfo.tinfo.flags & CKF_PROTECTED_AUTHENTICATION_PATH)) {
+- if (newpin == NULL)
+- return gnutls_assert_val(
++ if (newpin == NULL) {
++ ret = gnutls_assert_val(
+ GNUTLS_E_INVALID_REQUEST);
++ goto finish;
++ }
+
+ if (oldpin == NULL) {
+ struct pin_info_st pin_info;
+@@ -1324,6 +1325,7 @@ int gnutls_pkcs11_token_set_pin(const char *token_url, const char *oldpin,
+ ret = 0;
+
+ finish:
++ p11_kit_uri_free(info);
+ pkcs11_close_session(&sinfo);
+ return ret;
+ }
diff --git a/meta/recipes-support/gnutls/gnutls_3.8.12.bb b/meta/recipes-support/gnutls/gnutls_3.8.12.bb
index 2f671c4886..b8f653d210 100644
--- a/meta/recipes-support/gnutls/gnutls_3.8.12.bb
+++ b/meta/recipes-support/gnutls/gnutls_3.8.12.bb
@@ -42,6 +42,7 @@ SRC_URI = "https://www.gnupg.org/ftp/gcrypt/gnutls/v${SHRT_VER}/gnutls-${PV}.tar
file://CVE-2026-42012.patch \
file://CVE-2026-42013-pre1.patch \
file://CVE-2026-42013.patch \
+ file://CVE-2026-42014.patch \
"
SRC_URI[sha256sum] = "a7b341421bfd459acf7a374ca4af3b9e06608dcd7bd792b2bf470bea012b8e51"
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [wrynose][PATCH 4/5] gnutls: fix CVE-2026-42015
2026-09-09 13:35 [wrynose][PATCH 1/5] gnutls: fix CVE-2026-42012 Jakub Szczudlo (Nokia)
2026-09-09 13:35 ` [wrynose][PATCH 2/5] gnutls: fix CVE-2026-42013 Jakub Szczudlo (Nokia)
2026-09-09 13:35 ` [wrynose][PATCH 3/5] gnutls: fix CVE-2026-42014 Jakub Szczudlo (Nokia)
@ 2026-09-09 13:35 ` Jakub Szczudlo (Nokia)
2026-09-09 13:35 ` [wrynose][PATCH 5/5] gnutls: fix CVE-2026-5260 Jakub Szczudlo (Nokia)
2026-09-15 18:46 ` [wrynose][PATCH 1/5] gnutls: fix CVE-2026-42012 Yoann Congal
4 siblings, 0 replies; 7+ messages in thread
From: Jakub Szczudlo (Nokia) @ 2026-09-09 13:35 UTC (permalink / raw)
To: openembedded-core@lists.openembedded.org
Cc: yoann.congal@smile.fr, Jakub Szczudlo (Nokia)
Backport patch to fix CVE-2026-42015.
References:
https://nvd.nist.gov/vuln/detail/CVE-2026-42015
Upstream fix:
https://gitlab.com/gnutls/gnutls/-/commit/a3e7c50d3e1761e5ef1d4b225507cab8f2b2c3ca
Tested with ptest
Signed-off-by: Jakub Szczudlo <jakub.szczudlo@nokia.com>
---
.../gnutls/gnutls/CVE-2026-42015.patch | 43 +++++++++++++++++++
meta/recipes-support/gnutls/gnutls_3.8.12.bb | 1 +
2 files changed, 44 insertions(+)
create mode 100644 meta/recipes-support/gnutls/gnutls/CVE-2026-42015.patch
diff --git a/meta/recipes-support/gnutls/gnutls/CVE-2026-42015.patch b/meta/recipes-support/gnutls/gnutls/CVE-2026-42015.patch
new file mode 100644
index 0000000000..1a2065371d
--- /dev/null
+++ b/meta/recipes-support/gnutls/gnutls/CVE-2026-42015.patch
@@ -0,0 +1,43 @@
+From a3e7c50d3e1761e5ef1d4b225507cab8f2b2c3ca Mon Sep 17 00:00:00 2001
+From: Alexander Sosedkin <asosedkin@redhat.com>
+Date: Mon, 20 Apr 2026 22:42:20 +0200
+Subject: [PATCH] x509/pkcs12_bag: fix off-by-one in bag element bounds check
+
+Appending elements to a PKCS#12 bag had a bounds check that
+prevented adding the 32nd element.
+On the other hand, it is possible to import one that already has 32.
+Subsequent appending then led to writing past the 32-element array,
+smashing its length.
+
+Tighten the check to reject any bag with 32 or more elements.
+
+We'll treat this vulnerability as a Low due to how contrived
+the requirements are: for the code to be vulnerable,
+it needs to append to an imported untrusted unencrypted PKCS#12 structure.
+
+Reported-by: Zou Dikai
+Fixes: #1840
+Fixes: CVE-2026-42015
+Fixes: GNUTLS-SA-2026-04-29-11
+CVSS: 6.1 Medium CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:H
+Severity: Low
+Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
+
+CVE: CVE-2026-42015
+Upstream-Status: Backport [https://gitlab.com/gnutls/gnutls/-/commit/a3e7c50d3e1761e5ef1d4b225507cab8f2b2c3ca]
+
+Signed-off-by: Jakub Szczudlo <jakub.szczudlo@nokia.com>
+---
+diff --git a/lib/x509/pkcs12_bag.c b/lib/x509/pkcs12_bag.c
+index 911aeff..3822861 100644
+--- a/lib/x509/pkcs12_bag.c
++++ b/lib/x509/pkcs12_bag.c
+@@ -375,7 +375,7 @@ int gnutls_pkcs12_bag_set_data(gnutls_pkcs12_bag_t bag,
+ return GNUTLS_E_INVALID_REQUEST;
+ }
+
+- if (bag->bag_elements == MAX_BAG_ELEMENTS - 1) {
++ if (bag->bag_elements >= MAX_BAG_ELEMENTS - 1) {
+ gnutls_assert();
+ /* bag is full */
+ return GNUTLS_E_MEMORY_ERROR;
diff --git a/meta/recipes-support/gnutls/gnutls_3.8.12.bb b/meta/recipes-support/gnutls/gnutls_3.8.12.bb
index b8f653d210..58acf4f1f5 100644
--- a/meta/recipes-support/gnutls/gnutls_3.8.12.bb
+++ b/meta/recipes-support/gnutls/gnutls_3.8.12.bb
@@ -43,6 +43,7 @@ SRC_URI = "https://www.gnupg.org/ftp/gcrypt/gnutls/v${SHRT_VER}/gnutls-${PV}.tar
file://CVE-2026-42013-pre1.patch \
file://CVE-2026-42013.patch \
file://CVE-2026-42014.patch \
+ file://CVE-2026-42015.patch \
"
SRC_URI[sha256sum] = "a7b341421bfd459acf7a374ca4af3b9e06608dcd7bd792b2bf470bea012b8e51"
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [wrynose][PATCH 5/5] gnutls: fix CVE-2026-5260
2026-09-09 13:35 [wrynose][PATCH 1/5] gnutls: fix CVE-2026-42012 Jakub Szczudlo (Nokia)
` (2 preceding siblings ...)
2026-09-09 13:35 ` [wrynose][PATCH 4/5] gnutls: fix CVE-2026-42015 Jakub Szczudlo (Nokia)
@ 2026-09-09 13:35 ` Jakub Szczudlo (Nokia)
2026-09-15 18:46 ` [wrynose][PATCH 1/5] gnutls: fix CVE-2026-42012 Yoann Congal
4 siblings, 0 replies; 7+ messages in thread
From: Jakub Szczudlo (Nokia) @ 2026-09-09 13:35 UTC (permalink / raw)
To: openembedded-core@lists.openembedded.org
Cc: yoann.congal@smile.fr, Jakub Szczudlo (Nokia)
Backport patch to fix CVE-2026-5260.
References:
https://nvd.nist.gov/vuln/detail/CVE-2026-5260
Upstream fix:
https://gitlab.com/gnutls/gnutls/-/commit/77228f2d1ac207d2f894e5a168fbb47e5378e42f
https://gitlab.com/gnutls/gnutls/-/commit/cf6bdc5e4df49e5583d3fb4d2296779785f10683
Tested with ptest
Signed-off-by: Jakub Szczudlo <jakub.szczudlo@nokia.com>
---
.../gnutls/gnutls/CVE-2026-5260_p1.patch | 69 +++++++++++++++++++
.../gnutls/gnutls/CVE-2026-5260_p2.patch | 33 +++++++++
meta/recipes-support/gnutls/gnutls_3.8.12.bb | 2 +
3 files changed, 104 insertions(+)
create mode 100644 meta/recipes-support/gnutls/gnutls/CVE-2026-5260_p1.patch
create mode 100644 meta/recipes-support/gnutls/gnutls/CVE-2026-5260_p2.patch
diff --git a/meta/recipes-support/gnutls/gnutls/CVE-2026-5260_p1.patch b/meta/recipes-support/gnutls/gnutls/CVE-2026-5260_p1.patch
new file mode 100644
index 0000000000..c5ab814031
--- /dev/null
+++ b/meta/recipes-support/gnutls/gnutls/CVE-2026-5260_p1.patch
@@ -0,0 +1,69 @@
+From 77228f2d1ac207d2f894e5a168fbb47e5378e42f Mon Sep 17 00:00:00 2001
+From: Alexander Sosedkin <asosedkin@redhat.com>
+Date: Mon, 30 Mar 2026 17:31:07 +0200
+Subject: [PATCH] lib/auth/rsa: check that ciphertext matches the modulus size
+
+A client sending extremely short premaster secret as part of an
+RSA key exchange could've theoretically triggered a short heap overread
+to nowhere when the RSA key was backed with a PKCS#11 token.
+With this fix, the internal decryption function will not be called
+with an mismatching plaintext length specified, avoiding the overread.
+
+Reported-by: Joshua Rogers of AISLE Research Team <joshua@joshua.hu>
+Fixes: #1814
+Fixes: CVE-2026-5260
+Fixes: GNUTLS-SA-2026-04-29-10
+CVSS: 5.9 Medium CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H
+Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
+
+CVE: CVE-2026-5260
+Upstream-Status: Backport [https://gitlab.com/gnutls/gnutls/-/commit/77228f2d1ac207d2f894e5a168fbb47e5378e42f]
+
+Signed-off-by: Jakub Szczudlo <jakub.szczudlo@nokia.com>
+---
+diff --git a/lib/auth/rsa.c b/lib/auth/rsa.c
+index 4d18132..496c378 100644
+--- a/lib/auth/rsa.c
++++ b/lib/auth/rsa.c
+@@ -158,6 +158,7 @@ static int proc_rsa_client_kx(gnutls_session_t session, uint8_t *data,
+ int ret, dsize;
+ ssize_t data_size = _data_size;
+ volatile uint8_t ver_maj, ver_min;
++ unsigned int key_bits;
+
+ #ifdef ENABLE_SSL3
+ if (get_num_version(session) == GNUTLS_SSL3) {
+@@ -180,6 +181,10 @@ static int proc_rsa_client_kx(gnutls_session_t session, uint8_t *data,
+ }
+ ciphertext.size = dsize;
+ }
++ gnutls_privkey_get_pk_algorithm(session->internals.selected_key,
++ &key_bits);
++ if (ciphertext.size != (key_bits + 7) / 8)
++ return gnutls_assert_val(GNUTLS_E_DECRYPTION_FAILED);
+
+ ver_maj = _gnutls_get_adv_version_major(session);
+ ver_min = _gnutls_get_adv_version_minor(session);
+diff --git a/lib/auth/rsa_psk.c b/lib/auth/rsa_psk.c
+index cc92b4a..dba4011 100644
+--- a/lib/auth/rsa_psk.c
++++ b/lib/auth/rsa_psk.c
+@@ -257,6 +257,7 @@ static int _gnutls_proc_rsa_psk_client_kx(gnutls_session_t session,
+ ssize_t data_size = _data_size;
+ gnutls_psk_server_credentials_t cred;
+ volatile uint8_t ver_maj, ver_min;
++ unsigned int rsa_key_bits;
+
+ cred = (gnutls_psk_server_credentials_t)_gnutls_get_cred(
+ session, GNUTLS_CRD_PSK);
+@@ -313,6 +314,10 @@ static int _gnutls_proc_rsa_psk_client_kx(gnutls_session_t session,
+ return GNUTLS_E_UNEXPECTED_PACKET_LENGTH;
+ }
+ ciphertext.size = dsize;
++ gnutls_privkey_get_pk_algorithm(session->internals.selected_key,
++ &rsa_key_bits);
++ if (ciphertext.size != (rsa_key_bits + 7) / 8)
++ return gnutls_assert_val(GNUTLS_E_DECRYPTION_FAILED);
+
+ ver_maj = _gnutls_get_adv_version_major(session);
+ ver_min = _gnutls_get_adv_version_minor(session);
diff --git a/meta/recipes-support/gnutls/gnutls/CVE-2026-5260_p2.patch b/meta/recipes-support/gnutls/gnutls/CVE-2026-5260_p2.patch
new file mode 100644
index 0000000000..67154164c5
--- /dev/null
+++ b/meta/recipes-support/gnutls/gnutls/CVE-2026-5260_p2.patch
@@ -0,0 +1,33 @@
+From cf6bdc5e4df49e5583d3fb4d2296779785f10683 Mon Sep 17 00:00:00 2001
+From: Alexander Sosedkin <asosedkin@redhat.com>
+Date: Mon, 30 Mar 2026 17:46:40 +0200
+Subject: [PATCH] lib/pkcs11_privkey: guard against overreading on short
+ ciphertexts
+
+This is an alternative fix for the callee side.
+
+Reported-by: Joshua Rogers of AISLE Research Team <joshua@joshua.hu>
+Fixes: #1814
+Fixes: CVE-2026-5260
+Fixes: GNUTLS-SA-2026-04-29-10
+CVSS: 5.9 Medium CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H
+Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
+
+CVE: CVE-2026-5260
+Upstream-Status: Backport [https://gitlab.com/gnutls/gnutls/-/commit/cf6bdc5e4df49e5583d3fb4d2296779785f10683]
+
+Signed-off-by: Jakub Szczudlo <jakub.szczudlo@nokia.com>
+---
+diff --git a/lib/pkcs11_privkey.c b/lib/pkcs11_privkey.c
+index 568474e..e133c49 100644
+--- a/lib/pkcs11_privkey.c
++++ b/lib/pkcs11_privkey.c
+@@ -838,7 +838,7 @@ int _gnutls_pkcs11_privkey_decrypt_data2(gnutls_pkcs11_privkey_t key,
+ if (ret != 0)
+ return gnutls_assert_val(GNUTLS_E_LOCKING_ERROR);
+
+- buffer = gnutls_malloc(siglen);
++ buffer = gnutls_malloc(MAX((size_t)siglen, plaintext_size));
+ if (!buffer) {
+ gnutls_assert();
+ return GNUTLS_E_MEMORY_ERROR;
diff --git a/meta/recipes-support/gnutls/gnutls_3.8.12.bb b/meta/recipes-support/gnutls/gnutls_3.8.12.bb
index 58acf4f1f5..203ecbc375 100644
--- a/meta/recipes-support/gnutls/gnutls_3.8.12.bb
+++ b/meta/recipes-support/gnutls/gnutls_3.8.12.bb
@@ -44,6 +44,8 @@ SRC_URI = "https://www.gnupg.org/ftp/gcrypt/gnutls/v${SHRT_VER}/gnutls-${PV}.tar
file://CVE-2026-42013.patch \
file://CVE-2026-42014.patch \
file://CVE-2026-42015.patch \
+ file://CVE-2026-5260_p1.patch \
+ file://CVE-2026-5260_p2.patch \
"
SRC_URI[sha256sum] = "a7b341421bfd459acf7a374ca4af3b9e06608dcd7bd792b2bf470bea012b8e51"
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [wrynose][PATCH 1/5] gnutls: fix CVE-2026-42012
2026-09-09 13:35 [wrynose][PATCH 1/5] gnutls: fix CVE-2026-42012 Jakub Szczudlo (Nokia)
` (3 preceding siblings ...)
2026-09-09 13:35 ` [wrynose][PATCH 5/5] gnutls: fix CVE-2026-5260 Jakub Szczudlo (Nokia)
@ 2026-09-15 18:46 ` Yoann Congal
2026-09-28 13:52 ` Jakub Szczudlo
4 siblings, 1 reply; 7+ messages in thread
From: Yoann Congal @ 2026-09-15 18:46 UTC (permalink / raw)
To: Jakub Szczudlo (Nokia), openembedded-core@lists.openembedded.org
Hello,
On Wed Sep 9, 2026 at 3:35 PM CEST, Jakub Szczudlo (Nokia) wrote:
> Backport patch to fix CVE-2026-42012.
>
> References:
> https://nvd.nist.gov/vuln/detail/CVE-2026-42012
>
> Upstream fix:
> https://gitlab.com/gnutls/gnutls/-/commit/8dcc6a1f48945997666ac9f10896819edd01a03b
>
> Tested with ptest
> Pre patches taken from upstream so CVE fix will land cleanly
>
> Signed-off-by: Jakub Szczudlo <jakub.szczudlo@nokia.com>
> ---
> .../gnutls/gnutls/CVE-2026-42012-pre1.patch | 70 ++++++++
> .../gnutls/gnutls/CVE-2026-42012-pre2.patch | 153 ++++++++++++++++++
> .../gnutls/gnutls/CVE-2026-42012.patch | 48 ++++++
> meta/recipes-support/gnutls/gnutls_3.8.12.bb | 3 +
> 4 files changed, 274 insertions(+)
> create mode 100644 meta/recipes-support/gnutls/gnutls/CVE-2026-42012-pre1.patch
> create mode 100644 meta/recipes-support/gnutls/gnutls/CVE-2026-42012-pre2.patch
> create mode 100644 meta/recipes-support/gnutls/gnutls/CVE-2026-42012.patch
>
> diff --git a/meta/recipes-support/gnutls/gnutls/CVE-2026-42012-pre1.patch b/meta/recipes-support/gnutls/gnutls/CVE-2026-42012-pre1.patch
> new file mode 100644
> index 0000000000..1149dafef2
> --- /dev/null
> +++ b/meta/recipes-support/gnutls/gnutls/CVE-2026-42012-pre1.patch
Hello,
While this patch does apply, it has some surprizing format
(CVE-2026-42012.patch looks fine, though):
> @@ -0,0 +1,70 @@
> +Backport of:
> +
^ Why this "Backport of"?
> +From 6133fb459b74a9dcfa2d0ff010a4e03c56822d39 Mon Sep 17 00:00:00 2001
> +From: Alexander Sosedkin <asosedkin@redhat.com>
> +Date: Fri, 13 Mar 2026 17:00:03 +0100
> +Subject: [PATCH] x509/hostname-verify: refactor and simplify CN fallback logic
> +
> +Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
> +CVE: CVE-2026-42012
> +Upstream-Status: Backport [https://gitlab.com/gnutls/gnutls/-/commit/6133fb459b74a9dcfa2d0ff010a4e03c56822d39]
> +
> +Signed-off-by: Jakub Szczudlo <jakub.szczudlo@nokia.com>
> +---
> + lib/x509/hostname-verify.c | 15 ++++++---------
> + 1 file changed, 6 insertions(+), 9 deletions(-)
> +
Very minor thing but here we usualy have a "diff ..." line
> +--- a/lib/x509/hostname-verify.c
> ++++ b/lib/x509/hostname-verify.c
> +@@ -108,7 +108,7 @@ unsigned gnutls_x509_crt_check_ip(gnutls
> + * that we do not fallback to CN-ID if we encounter a supported name
> + * type.
> + */
> +-#define IS_SAN_SUPPORTED(san) \
> ++#define PRECLUDES_CN_FALLBACK(san) \
> + (san == GNUTLS_SAN_DNSNAME || san == GNUTLS_SAN_IPADDRESS)
> +
> + /**
> +@@ -151,13 +151,12 @@ unsigned gnutls_x509_crt_check_hostname2
> + {
> + char dnsname[MAX_CN];
> + size_t dnsnamesize;
> +- int found_dnsname = 0;
> + int ret = 0;
> + int i = 0;
> + struct in_addr ipv4;
> + char *p = NULL;
> + char *a_hostname;
> +- unsigned have_other_addresses = 0;
> ++ bool cn_fallback_allowed = true;
> + gnutls_datum_t out;
> +
> + /* check whether @hostname is an ip address */
> +@@ -213,9 +212,10 @@ hostname_fallback:
> + ret = gnutls_x509_crt_get_subject_alt_name(cert, i, dnsname,
> + &dnsnamesize, NULL);
> +
> +- if (ret == GNUTLS_SAN_DNSNAME) {
> +- found_dnsname = 1;
> ++ if (PRECLUDES_CN_FALLBACK(ret))
> ++ cn_fallback_allowed = false;
> +
> ++ if (ret == GNUTLS_SAN_DNSNAME) {
> + if (memchr(dnsname, '\0', dnsnamesize)) {
> + _gnutls_debug_log(
> + "certificate has %s with embedded null in name\n",
> +@@ -236,13 +236,10 @@ hostname_fallback:
> + ret = 1;
> + goto cleanup;
> + }
> +- } else {
> +- if (IS_SAN_SUPPORTED(ret))
> +- have_other_addresses = 1;
> + }
> + }
> +
> +- if (!have_other_addresses && !found_dnsname &&
> ++ if (cn_fallback_allowed &&
> + _gnutls_check_key_purpose(cert, GNUTLS_KP_TLS_WWW_SERVER, 0) != 0) {
> + /* did not get the necessary extension, use CN instead, if the
> + * certificate would have been acceptable for a TLS WWW server purpose.
> diff --git a/meta/recipes-support/gnutls/gnutls/CVE-2026-42012-pre2.patch b/meta/recipes-support/gnutls/gnutls/CVE-2026-42012-pre2.patch
> new file mode 100644
> index 0000000000..c192a144c0
> --- /dev/null
> +++ b/meta/recipes-support/gnutls/gnutls/CVE-2026-42012-pre2.patch
> @@ -0,0 +1,153 @@
> +Backport of:
> +
> +From 5cc003b9688378f6c7934b1df0aa147e80006be4 Mon Sep 17 00:00:00 2001
> +From: Alexander Sosedkin <asosedkin@redhat.com>
> +Date: Fri, 13 Mar 2026 17:41:33 +0100
> +Subject: [PATCH] x509: add bare-bones awareness of SRV virtual SAN
> +
> +There's no support for constraints, no certtool support, no nothing.
> +Just added what's easy to add because I needed a virtual SAN for them.
> +
> +Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
> +CVE: CVE-2026-42012
> +Upstream-Status: Backport [https://gitlab.com/gnutls/gnutls/-/commit/5cc003b9688378f6c7934b1df0aa147e80006be4]
> +
> +Signed-off-by: Jakub Szczudlo <jakub.szczudlo@nokia.com>
> +---
> + lib/includes/gnutls/gnutls.h.in | 4 +++-
> + lib/x509/common.h | 1 +
> + lib/x509/name_constraints.c | 3 ++-
> + lib/x509/output.c | 6 ++++++
> + lib/x509/virt-san.c | 23 +++++++++++++++++++++++
> + lib/x509/x509.c | 3 ++-
> + 6 files changed, 37 insertions(+), 3 deletions(-)
> +
> +--- a/lib/includes/gnutls/gnutls.h.in
> ++++ b/lib/includes/gnutls/gnutls.h.in
> +@@ -2698,6 +2698,7 @@ void gnutls_psk_set_server_params_functi
> + * @GNUTLS_SAN_OTHERNAME_XMPP: Virtual SAN, used by certain functions for convenience.
> + * @GNUTLS_SAN_OTHERNAME_KRB5PRINCIPAL: Virtual SAN, used by certain functions for convenience.
> + * @GNUTLS_SAN_OTHERNAME_MSUSERPRINCIPAL: Virtual SAN, used by certain functions for convenience.
> ++ * @GNUTLS_SAN_OTHERNAME_SRV: Virtual SAN, used by certain functions for convenience.
> + *
> + * Enumeration of different subject alternative names types.
> + */
> +@@ -2715,7 +2716,8 @@ typedef enum gnutls_x509_subject_alt_nam
> + Used by gnutls_x509_crt_get_subject_alt_othername_oid. */
> + GNUTLS_SAN_OTHERNAME_XMPP = 1000,
> + GNUTLS_SAN_OTHERNAME_KRB5PRINCIPAL,
> +- GNUTLS_SAN_OTHERNAME_MSUSERPRINCIPAL
> ++ GNUTLS_SAN_OTHERNAME_MSUSERPRINCIPAL,
> ++ GNUTLS_SAN_OTHERNAME_SRV
> + } gnutls_x509_subject_alt_name_t;
> +
> + struct gnutls_openpgp_crt_int;
> +--- a/lib/x509/common.h
> ++++ b/lib/x509/common.h
> +@@ -107,6 +107,7 @@
> + #define XMPP_OID "1.3.6.1.5.5.7.8.5"
> + #define KRB5_PRINCIPAL_OID "1.3.6.1.5.2.2"
> + #define MSUSER_PRINCIPAL_NAME_OID "1.3.6.1.4.1.311.20.2.3"
> ++#define SRV_OID "1.3.6.1.5.5.7.8.7"
> + #define PKIX1_RSA_PSS_MGF1_OID "1.2.840.113549.1.1.8"
> + #define PKIX1_RSA_OAEP_P_SPECIFIED_OID "1.9"
> +
> +--- a/lib/x509/name_constraints.c
> ++++ b/lib/x509/name_constraints.c
> +@@ -516,7 +516,8 @@ static int validate_name_constraints_nod
> + if (type != GNUTLS_SAN_DNSNAME && type != GNUTLS_SAN_RFC822NAME &&
> + type != GNUTLS_SAN_DN && type != GNUTLS_SAN_URI &&
> + type != GNUTLS_SAN_IPADDRESS &&
> +- type != GNUTLS_SAN_OTHERNAME_MSUSERPRINCIPAL) {
> ++ type != GNUTLS_SAN_OTHERNAME_MSUSERPRINCIPAL &&
> ++ type != GNUTLS_SAN_OTHERNAME_SRV) {
> + return gnutls_assert_val(GNUTLS_E_X509_UNKNOWN_SAN);
> + }
> +
> +--- a/lib/x509/output.c
> ++++ b/lib/x509/output.c
> +@@ -121,6 +121,7 @@ static void print_name(gnutls_buffer_st
> + if ((type == GNUTLS_SAN_DNSNAME || type == GNUTLS_SAN_OTHERNAME_XMPP ||
> + type == GNUTLS_SAN_OTHERNAME_KRB5PRINCIPAL ||
> + type == GNUTLS_SAN_OTHERNAME_MSUSERPRINCIPAL ||
> ++ type == GNUTLS_SAN_OTHERNAME_SRV ||
> + type == GNUTLS_SAN_RFC822NAME || type == GNUTLS_SAN_URI) &&
> + sname != NULL && strlen(sname) != name->size) {
> + adds(str, _("warning: SAN contains an embedded NUL, "
> +@@ -180,6 +181,11 @@ static void print_name(gnutls_buffer_st
> + name->size, NON_NULL(name->data));
> + break;
> +
> ++ case GNUTLS_SAN_OTHERNAME_SRV:
> ++ addf(str, _("%sSRVName: %.*s\n"), prefix, name->size,
> ++ NON_NULL(name->data));
> ++ break;
> ++
> + default:
> + addf(str, _("%sUnknown name: "), prefix);
> + _gnutls_buffer_hexprint(str, name->data, name->size);
> +--- a/lib/x509/virt-san.c
> ++++ b/lib/x509/virt-san.c
> +@@ -45,6 +45,9 @@ static int san_othername_to_virtual(cons
> + memcmp(oid, MSUSER_PRINCIPAL_NAME_OID,
> + sizeof(MSUSER_PRINCIPAL_NAME_OID) - 1) == 0)
> + return GNUTLS_SAN_OTHERNAME_MSUSERPRINCIPAL;
> ++ else if ((unsigned)size == (sizeof(SRV_OID) - 1) &&
> ++ memcmp(oid, SRV_OID, sizeof(SRV_OID) - 1) == 0)
> ++ return GNUTLS_SAN_OTHERNAME_SRV;
> + }
> +
> + return GNUTLS_SAN_OTHERNAME;
> +@@ -59,6 +62,8 @@ static const char *virtual_to_othername_
> + return KRB5_PRINCIPAL_OID;
> + case GNUTLS_SAN_OTHERNAME_MSUSERPRINCIPAL:
> + return MSUSER_PRINCIPAL_NAME_OID;
> ++ case GNUTLS_SAN_OTHERNAME_SRV:
> ++ return SRV_OID;
> + default:
> + return NULL;
> + }
> +@@ -126,6 +131,15 @@ int _gnutls_alt_name_assign_virt_type(st
> + name->type = GNUTLS_SAN_OTHERNAME;
> + break;
> +
> ++ case GNUTLS_SAN_OTHERNAME_SRV:
> ++ ret = _gnutls_x509_encode_string(ASN1_ETYPE_IA5_STRING,
> ++ san->data, san->size,
> ++ &encoded);
> ++ if (ret < 0)
> ++ return gnutls_assert_val(ret);
> ++ name->san = _gnutls_steal_datum(&encoded);
^ This function call is not the same as upstream's patch.
Please document any non-trivial change in the patch file (just after
your signed-off-by).
Can you please send a v2 with the above fixed.
The format "issues" are minor and mainly an issue for me : I compare
upstream patches with the sent one and any format change creates noise.
Thanks!
--
Yoann Congal
Smile ECS
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [wrynose][PATCH 1/5] gnutls: fix CVE-2026-42012
2026-09-15 18:46 ` [wrynose][PATCH 1/5] gnutls: fix CVE-2026-42012 Yoann Congal
@ 2026-09-28 13:52 ` Jakub Szczudlo
0 siblings, 0 replies; 7+ messages in thread
From: Jakub Szczudlo @ 2026-09-28 13:52 UTC (permalink / raw)
To: openembedded-core
[-- Attachment #1: Type: text/plain, Size: 61 bytes --]
Hi,
thanks for looking on this. I will fix it and send v2.
[-- Attachment #2: Type: text/html, Size: 76 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-09-28 13:52 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-09 13:35 [wrynose][PATCH 1/5] gnutls: fix CVE-2026-42012 Jakub Szczudlo (Nokia)
2026-09-09 13:35 ` [wrynose][PATCH 2/5] gnutls: fix CVE-2026-42013 Jakub Szczudlo (Nokia)
2026-09-09 13:35 ` [wrynose][PATCH 3/5] gnutls: fix CVE-2026-42014 Jakub Szczudlo (Nokia)
2026-09-09 13:35 ` [wrynose][PATCH 4/5] gnutls: fix CVE-2026-42015 Jakub Szczudlo (Nokia)
2026-09-09 13:35 ` [wrynose][PATCH 5/5] gnutls: fix CVE-2026-5260 Jakub Szczudlo (Nokia)
2026-09-15 18:46 ` [wrynose][PATCH 1/5] gnutls: fix CVE-2026-42012 Yoann Congal
2026-09-28 13:52 ` Jakub Szczudlo
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.