gnutls: Fix CVE-2026-42009
PATCH 2/2 gnutls: Fix CVE-2026-42009
From: Sudhir Dumbhare <[email protected]>
This patch applies the upstream fix [1] and [2], as referenced in [3], to address a DTLS packet reordering flaw where duplicate sequence numbers could lead to unstable ordering or undefined behavior.
[1] https://gitlab.com/gnutls/gnutls/-/commit/f01e21441e29052a6f0963840794c41d3b3ee66d
[2] https://gitlab.com/gnutls/gnutls/-/commit/f341441fad91142897d83b44a175ffc8f925b76f
[3] https://security-tracker.debian.org/tracker/CVE-2026-42009
Reference:
https://nvd.nist.gov/vuln/detail/CVE-2026-42009
--- .../gnutls/gnutls/CVE-2026-42009_p1.patch | 67 +++++++++++++++++++ .../gnutls/gnutls/CVE-2026-42009_p2.patch | 48 +++++++++++++ meta/recipes-support/gnutls/gnutls_3.8.12.bb | 2 + 3 files changed, 117 insertions(+) create mode 100644 meta/recipes-support/gnutls/gnutls/CVE-2026-42009_p1.patch create mode 100644 meta/recipes-support/gnutls/gnutls/CVE-2026-42009_p2.patch
meta/recipes-support/gnutls/gnutls/CVE-2026-42009_p1.patch new file +67 -0
@@ -0,0 +1,67 @@ +From d1191b910e63149a10647a089995d3cd85e16400 Mon Sep 17 00:00:00 2001 +From: Alexander Sosedkin <[email protected]> +Date: Tue, 21 Apr 2026 16:52:48 +0200 +Subject: [PATCH] lib/buffers: ensure packets have differing sequence + numbers + +There should normally be no packets with same sequence number and +differing handshake type, unless an adversary crafts them. +Discarding them allows to get rid of packets +with duplicate sequence ID in the buffer, +relieving us from the question of how to sort them later. + +Reported-by: Joshua Rogers of AISLE Research Team <[email protected]> +Fixes: #1848 +Fixes: CVE-2026-42009 +Fixes: GNUTLS-SA-2026-04-29-2 +CVSS: 7.5 High CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H + +CVE: CVE-2026-42009 +Upstream-Status: Backport [https://gitlab.com/gnutls/gnutls/-/commit/f01e21441e29052a6f0963840794c41d3b3ee66d] + +Backport Changes: +- Adjusted the upstream hunk to match the GnuTLS 3.8.12 code layout. +- The upstream commit uses the local recv_buf alias introduced later + in v3.8.13 by commit; + https://gitlab.com/gnutls/gnutls/-/commit/9deffca528c23bbb218f5ec3bd4bb1bf4cbd1fc0. +- GnuTLS 3.8.12 does not have that local recv_buf alias in + merge_handshake_packet(), so the backport replaces recv_buf[i] with the + existing session->internals.handshake_recv_buffer[i] access pattern. + +Signed-off-by: Alexander Sosedkin <[email protected]> +(cherry picked from commit f01e21441e29052a6f0963840794c41d3b3ee66d) +Signed-off-by: Sudhir Dumbhare <[email protected]> +--- + lib/buffers.c | 16 ++++++++++++++-- + 1 file changed, 14 insertions(+), 2 deletions(-) + +diff --git a/lib/buffers.c b/lib/buffers.c +index 672380b054..e7f08b5625 100644 +--- a/lib/buffers.c ++++ b/lib/buffers.c +@@ -968,8 +968,20 @@ static int merge_handshake_packet(gnutls_session_t session, + int ret; + + for (i = 0; i < session->internals.handshake_recv_buffer_size; i++) { +- if (session->internals.handshake_recv_buffer[i].htype == +- hsk->htype) { ++ if (session->internals.handshake_recv_buffer[i].sequence == hsk->sequence) { ++ if (session->internals.handshake_recv_buffer[i].htype != hsk->htype) { ++ _gnutls_audit_log( ++ session, ++ "Discarded unexpected handshake packet " ++ "with duplicate sequence %d, but " ++ "mismatched type %s (previously %s)\n", ++ hsk->sequence, ++ _gnutls_handshake2str(hsk->htype), ++ _gnutls_handshake2str( ++ session->internals.handshake_recv_buffer[i].htype)); ++ _gnutls_handshake_buffer_clear(hsk); ++ return 0; ++ } + exists = 1; + pos = i; + break; +-- +2.51.0 +
meta/recipes-support/gnutls/gnutls/CVE-2026-42009_p2.patch new file +48 -0
48 lines not on this page · raw message
meta/recipes-support/gnutls/gnutls_3.8.12.bb +2 -0
@@ -26,6 +26,8 @@ SRC_URI = "https://www.gnupg.org/ftp/gcrypt/gnutls/v${SHRT_VER}/gnutls-${PV}.tar file://c99.patch \ file://CVE-2026-3832_p1.patch \ file://CVE-2026-3832_p2.patch \ + file://CVE-2026-42009_p1.patch \ + file://CVE-2026-42009_p2.patch \ " SRC_URI[sha256sum] = "a7b341421bfd459acf7a374ca4af3b9e06608dcd7bd792b2bf470bea012b8e51"
Signature · 1 line
2.51.0
Quoted 6 lines · Sudhir Dumbhare via lists.openembedded.org
From: Sudhir Dumbhare <[email protected]>
This patch applies the upstream fix [1] and [2], as referenced in [3], to address a DTLS packet reordering flaw where duplicate sequence numbers could lead to unstable ordering or undefined behavior.
Quoted 8 lines
[1] https://gitlab.com/gnutls/gnutls/-/commit/f01e21441e29052a6f0963840794c41d3b3ee66d
[2] https://gitlab.com/gnutls/gnutls/-/commit/f341441fad91142897d83b44a175ffc8f925b76f
[3] https://security-tracker.debian.org/tracker/CVE-2026-42009Reference:
https://nvd.nist.gov/vuln/detail/CVE-2026-42009Signed-off-by Sudhir Dumbhare <[email protected]>
Hello,
I guess a recent gnutls patch broke this series:
ERROR: gnutls-3.8.12-r0 do_patch: Applying patch '.../wrynose/bitbake-builds/poky-wrynose/layers/openembedded-core/meta/recipes-support/gnutls/gnutls/CVE-2026-42009_p1.patch' on target directory '.../wrynose/bitbake-builds/poky-wrynose/build/tmp/work/x86-64-v3-poky-linux/gnutls/3.8.12/sources/gnutls-3.8.12' CmdError('quilt --quiltrc .../wrynose/bitbake-builds/poky-wrynose/build/tmp/work/x86-64-v3-poky-linux/gnutls/3.8.12/recipe-sysroot-native/etc/quiltrc push', 0, 'stdout: Applying patch CVE-2026-42009_p1.patch
patching file lib/buffers.c
Hunk #1 FAILED at 968.
1 out of 1 hunk FAILED -- rejects in file lib/buffers.c
Patch CVE-2026-42009_p1.patch does not apply (enforce with -f)
stderr: ')
ERROR: Logfile of failure stored in: .../wrynose/bitbake-builds/poky-wrynose/build/tmp/work/x86-64-v3-poky-linux/gnutls/3.8.12/temp/log.do_patch.2529206
ERROR: Task (.../wrynose/bitbake-builds/poky-wrynose/layers/openembedded-core/meta/recipes-support/gnutls/gnutls_3.8.12.bb:do_patch) failed with exit code '1'
Can you rebase on the recently merged wrynose and resend?
Thanks!
Signature · 2 lines
Yoann Congal Smile ECS
Hi Yoann Congal,
I am working with Sudhir Dumbhare on these fixes. As Sudhir is currently unavailable due to a personal matter, I have taken over the follow-up and rebased the gnutls patches on top of the latest changes recently merged into the wrynose branch, as requested. The updated patches have been submitted to the upstream mailing list:
1.
[email protected] | [wrynose][PATCH 1/2] gnutls: Fix CVE-2026-3832<https://lists.openembedded.org/g/openembedded-core/topic/120356870>
2.
[email protected] | [wrynose][PATCH 2/2] gnutls: Fix CVE-2026-42009<https://lists.openembedded.org/g/openembedded-core/topic/120356873>
Thank you for pointing out the issue and reviewing the updates.
Best regards,
Deepak Rathore
________________________________
From: [email protected] <[email protected]> on behalf of Yoann Congal via lists.openembedded.org <[email protected]>
Sent: Friday, July 17, 2026 8:07 PM
To: Sudhir Dumbhare -X (sudumbha - E INFOCHIPS PRIVATE LIMITED at Cisco) <[email protected]>; [email protected] <[email protected]>
Subject: Re: [OE-core][wrynose][PATCH 2/2] gnutls: Fix CVE-2026-42009
Quoted 6 lines · Sudhir Dumbhare via lists.openembedded.org
From: Sudhir Dumbhare <[email protected]>
This patch applies the upstream fix [1] and [2], as referenced in [3], to address a DTLS packet reordering flaw where duplicate sequence numbers could lead to unstable ordering or undefined behavior.
Quoted 8 lines
[1] https://gitlab.com/gnutls/gnutls/-/commit/f01e21441e29052a6f0963840794c41d3b3ee66d
[2] https://gitlab.com/gnutls/gnutls/-/commit/f341441fad91142897d83b44a175ffc8f925b76f
[3] https://security-tracker.debian.org/tracker/CVE-2026-42009Reference:
https://nvd.nist.gov/vuln/detail/CVE-2026-42009Signed-off-by Sudhir Dumbhare <[email protected]>
Hello,
I guess a recent gnutls patch broke this series:
ERROR: gnutls-3.8.12-r0 do_patch: Applying patch '.../wrynose/bitbake-builds/poky-wrynose/layers/openembedded-core/meta/recipes-support/gnutls/gnutls/CVE-2026-42009_p1.patch' on target directory '.../wrynose/bitbake-builds/poky-wrynose/build/tmp/work/x86-64-v3-poky-linux/gnutls/3.8.12/sources/gnutls-3.8.12' CmdError('quilt --quiltrc .../wrynose/bitbake-builds/poky-wrynose/build/tmp/work/x86-64-v3-poky-linux/gnutls/3.8.12/recipe-sysroot-native/etc/quiltrc push', 0, 'stdout: Applying patch CVE-2026-42009_p1.patch
patching file lib/buffers.c
Hunk #1 FAILED at 968.
1 out of 1 hunk FAILED -- rejects in file lib/buffers.c
Patch CVE-2026-42009_p1.patch does not apply (enforce with -f)
stderr: ')
ERROR: Logfile of failure stored in: .../wrynose/bitbake-builds/poky-wrynose/build/tmp/work/x86-64-v3-poky-linux/gnutls/3.8.12/temp/log.do_patch.2529206
ERROR: Task (.../wrynose/bitbake-builds/poky-wrynose/layers/openembedded-core/meta/recipes-support/gnutls/gnutls_3.8.12.bb:do_patch) failed with exit code '1'
Can you rebase on the recently merged wrynose and resend?
Thanks!
--
Yoann Congal
Smile ECS