]> git.ipfire.org Git - thirdparty/gnutls.git/log
thirdparty/gnutls.git
2 weeks agoMerge branch 'wip/dueno/minor-fixes' into 'master' master
Daiki Ueno [Thu, 7 May 2026 10:00:06 +0000 (19:00 +0900)] 
Merge branch 'wip/dueno/minor-fixes' into 'master'

Minor fixes after 3.8.13 release

See merge request gnutls/gnutls!2107

2 weeks agobuild: remove MIN(...) macro in favor of Gnulib's minmax module 2107/head
Daiki Ueno [Thu, 7 May 2026 04:10:13 +0000 (13:10 +0900)] 
build: remove MIN(...) macro in favor of Gnulib's minmax module

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 weeks ago_gnutls_pkcs7_unpad: add missing declaration
Daiki Ueno [Thu, 7 May 2026 04:04:15 +0000 (13:04 +0900)] 
_gnutls_pkcs7_unpad: add missing declaration

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 weeks agodrbg-aes: pacify -Wzero-as-null-pointer-constant warning
Daiki Ueno [Thu, 7 May 2026 00:45:51 +0000 (09:45 +0900)] 
drbg-aes: pacify -Wzero-as-null-pointer-constant warning

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 weeks agotests/pkcs11/trust-list-fault: fix issues in linking
Daiki Ueno [Thu, 7 May 2026 00:42:09 +0000 (09:42 +0900)] 
tests/pkcs11/trust-list-fault: fix issues in linking

This fixes the use of automake variables and also adds the linked mock
library in .gitignore.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 weeks agotests/sanity-cpp: limit use of extern "C" { ... }
Daiki Ueno [Thu, 7 May 2026 00:40:44 +0000 (09:40 +0900)] 
tests/sanity-cpp: limit use of extern "C" { ... }

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 weeks agoMerge branch 'patch-1' into 'master'
Daiki Ueno [Fri, 1 May 2026 04:09:07 +0000 (13:09 +0900)] 
Merge branch 'patch-1' into 'master'

Fix CRAU_MAYBE_UNUSED definition for old compilers

Closes #1880

See merge request gnutls/gnutls!2106

2 weeks agoFix CRAU_MAYBE_UNUSED definition for old compilers 2106/head
Ryan Carsten Schmidt [Fri, 1 May 2026 02:38:43 +0000 (21:38 -0500)] 
Fix CRAU_MAYBE_UNUSED definition for old compilers

Fix behavior change that caused build failure with clang versions older
than 17, introduced in f5666f8f1f653cfe2bef808a9c9b61534f279ed1.

Also ensure CRAU_MAYBE_UNUSED is always defined to something, for even
older compilers.

Fixes #1880

Signed-off-by: Ryan Carsten Schmidt <git@ryandesign.com>
3 weeks agoMerge branch 'CVE-2025-61727-severity-NEWS' into 'master'
Alexander Sosedkin [Thu, 30 Apr 2026 13:21:57 +0000 (13:21 +0000)] 
Merge branch 'CVE-2025-61727-severity-NEWS' into 'master'

NEWS: change CVE-2026-3833 severity to Moderate...

See merge request gnutls/gnutls!2104

3 weeks agoNEWS: change CVE-2026-3833 severity to Moderate... 2104/head
Alexander Sosedkin [Thu, 30 Apr 2026 11:02:35 +0000 (13:02 +0200)] 
NEWS: change CVE-2026-3833 severity to Moderate...

... as discussed in #1803

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agoMerge branch 'tests-dtls-mini-fragments-gnulib' into 'master'
Alexander Sosedkin [Thu, 30 Apr 2026 11:41:56 +0000 (11:41 +0000)] 
Merge branch 'tests-dtls-mini-fragments-gnulib' into 'master'

tests/mini-dtls-framents: link to gnulib

See merge request gnutls/gnutls!2105

3 weeks agotests/mini-dtls-fragments: don't skip on WIN32 2105/head
Alexander Sosedkin [Thu, 30 Apr 2026 11:08:38 +0000 (13:08 +0200)] 
tests/mini-dtls-fragments: don't skip on WIN32

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agotests/mini-dtls-framents: link to gnulib
Alexander Sosedkin [Thu, 30 Apr 2026 11:08:01 +0000 (13:08 +0200)] 
tests/mini-dtls-framents: link to gnulib

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agoMerge branch 'release-3.8.13' into 'master' 3.8.13
Alexander Sosedkin [Wed, 29 Apr 2026 17:17:53 +0000 (17:17 +0000)] 
Merge branch 'release-3.8.13' into 'master'

Release 3.8.13

Closes #1820, #1817, #1823, #1822, #1819, #1854, #1808, #1815, #1801, #1812, #1840, #1814, #1766, #1809, #1825, #1849, #1802, #1824, #1223, #1803, #1852, #1864, #1850, #1811, #1848, #1839, #1816, and #1838

See merge request gnutls/gnutls!2102

3 weeks agoRelease 3.8.13 2102/head
Alexander Sosedkin [Mon, 27 Apr 2026 17:53:13 +0000 (19:53 +0200)] 
Release 3.8.13

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agoNEWS: add a couple more 3.8.13 entries
Alexander Sosedkin [Mon, 27 Apr 2026 17:26:19 +0000 (19:26 +0200)] 
NEWS: add a couple more 3.8.13 entries

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agolib/pkcs11: do not silently pass on unimplemented functionality
Alexander Sosedkin [Mon, 13 Apr 2026 11:42:52 +0000 (13:42 +0200)] 
lib/pkcs11: do not silently pass on unimplemented functionality

When the relevant PKCS#11 header macros were not defined,
several functions for FIPS PKCS#11 provider wrongfully reported success.
They have been modified to return GNUTLS_E_UNIMPLEMENTED_FEATURE instead.

Fixes: #1820
Reported-by: Joshua Rogers of AISLE Research Team <joshua@joshua.hu>
Co-authored-by: Joshua Rogers of AISLE Research Team <joshua@joshua.hu>
Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agosession_pack: validate session_id_size on unpacking
Alexander Sosedkin [Tue, 7 Apr 2026 08:16:03 +0000 (10:16 +0200)] 
session_pack: validate session_id_size on unpacking

A check for session_id_size not exceeding GNUTLS_MAX_SESSION_ID_SIZE
on loading persisted TLS session data was overlooked,
leading to a heap overflow
were the data corrupted in a malicious manner.

Reported-by: Haruto Kimura (Stella)
Fixes: #1817
Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agosrc/cfg: avoid a data leak in clear_options, on the error path
Alexander Sosedkin [Tue, 14 Apr 2026 16:25:13 +0000 (18:25 +0200)] 
src/cfg: avoid a data leak in clear_options, on the error path

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agosrc/cfg: fix iterating in clear_options, on the error path
Alexander Sosedkin [Tue, 14 Apr 2026 16:21:19 +0000 (18:21 +0200)] 
src/cfg: fix iterating in clear_options, on the error path

Calling testing tools bundled with GnuTLS with malformed arguments
could lead to crashing them.
This change makes the error path of option parsing more robust.

Fixes: #1823
Reported-by: Joshua Rogers of AISLE Research Team <joshua@joshua.hu>
Co-authored-by: Joshua Rogers of AISLE Research Team <joshua@joshua.hu>
Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agoNEWS: add an entry for #1841
Alexander Sosedkin [Wed, 29 Apr 2026 12:20:11 +0000 (14:20 +0200)] 
NEWS: add an entry for #1841

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agokey_share: zeroize derived shared secret after compositing
Daiki Ueno [Wed, 15 Apr 2026 12:21:46 +0000 (21:21 +0900)] 
key_share: zeroize derived shared secret after compositing

Signed-off-by: Daiki Ueno <ueno@gnu.org>
3 weeks agoNEWS: add an entry for #1822
Alexander Sosedkin [Wed, 29 Apr 2026 12:12:23 +0000 (14:12 +0200)] 
NEWS: add an entry for #1822

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agolib/x509/x509_ext: avoid a heap overread in SCT extension parser
Alexander Sosedkin [Mon, 13 Apr 2026 16:42:56 +0000 (18:42 +0200)] 
lib/x509/x509_ext: avoid a heap overread in SCT extension parser

Parsing a specially crafted SCT extension could previously lead to
a short heap overread.
The list-length validation didn't account for the 2-byte length field.

The fix now accounts for the header field length,
ensuring the parsing stays within the buffer.

Fixes: #1822
Reported-by: Joshua Rogers of AISLE Research Team <joshua@joshua.hu>
Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agoNEWS: add an entry for #1819
Alexander Sosedkin [Wed, 29 Apr 2026 12:04:28 +0000 (14:04 +0200)] 
NEWS: add an entry for #1819

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agotests/pkcs11/trust-list-fault: test #1819 with libpkcs11mock5
Alexander Sosedkin [Fri, 10 Apr 2026 18:34:41 +0000 (20:34 +0200)] 
tests/pkcs11/trust-list-fault: test #1819 with libpkcs11mock5

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agolib/x509: fix cleanup when gnutls_x509_crt_list_import_pkcs11 fails
Alexander Sosedkin [Fri, 10 Apr 2026 18:30:27 +0000 (20:30 +0200)] 
lib/x509: fix cleanup when gnutls_x509_crt_list_import_pkcs11 fails

Previously gnutls_x509_trust_list_remove_trust_file tried to free
the entire xcrt_list, even though one source of failures is
gnutls_pkcs11_obj_list_import_url2 that deinits it up to the correct
position.

With this change, both functions zero unused entries.

Reported-by: Joshua Rogers of AISLE Research Team <joshua@joshua.hu>
Fixes: #1819
Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agotests/pkcs11/pkcs11-mock5: add a generic fault injector
Alexander Sosedkin [Thu, 9 Apr 2026 09:49:25 +0000 (11:49 +0200)] 
tests/pkcs11/pkcs11-mock5: add a generic fault injector

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agoNEWS: add an entry for #1818.1
Alexander Sosedkin [Wed, 29 Apr 2026 11:53:01 +0000 (13:53 +0200)] 
NEWS: add an entry for #1818.1

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agotests/key-openssl: add a test for #1818.4 OpenSSL PEM parsing
Alexander Sosedkin [Tue, 7 Apr 2026 18:31:49 +0000 (20:31 +0200)] 
tests/key-openssl: add a test for #1818.4 OpenSSL PEM parsing

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agolib/x509/privkey_openssl: mind header size more carefully
Alexander Sosedkin [Tue, 7 Apr 2026 18:23:29 +0000 (20:23 +0200)] 
lib/x509/privkey_openssl: mind header size more carefully

When parsing private keys in OpenSSL PEM format, GnuTLS did not perform
sufficient bounds checking for the length of the PEM header being parsed.
For specially crafted inputs, this could lead to heap overreads.
There was no confidentiality risk and
the crash potential was limited to instrumented builds in practice.
This change instates the overlooked bounds checking.

Reported-by: Kamil Frankowicz <kamil.frankowicz@cert.pl>
Reported-by: Joshua Rogers of AISLE Research Team <joshua@joshua.hu>
Related: #1818
Fixes: #1854
Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agoNEWS: add an entry for #1818.3
Alexander Sosedkin [Wed, 29 Apr 2026 11:51:54 +0000 (13:51 +0200)] 
NEWS: add an entry for #1818.3

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agonettle/pk: check RSA key coprimality in verify_params
Alexander Sosedkin [Tue, 7 Apr 2026 18:18:40 +0000 (20:18 +0200)] 
nettle/pk: check RSA key coprimality in verify_params

Previously, gnutls_privkey_verify_params has overlooked
the scenario of p and q not being co-prime,
and proceeded with undefined behaviour that was extremely likely
to error out in practice anyway.
Now it returns GNUTLS_E_PK_INVALID_PRIVKEY in this case.

Reported-by: Kamil Frankowicz <kamil.frankowicz@cert.pl>
Related: #1818
Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agoNEWS: add an entry for #1813
Alexander Sosedkin [Wed, 29 Apr 2026 11:43:28 +0000 (13:43 +0200)] 
NEWS: add an entry for #1813

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agotests/pkcs11-provider: check for lingering token objects
Alexander Sosedkin [Wed, 25 Mar 2026 18:42:19 +0000 (19:42 +0100)] 
tests/pkcs11-provider: check for lingering token objects

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agopkcs11/p11_cipher: make AES keys ephemeral objects
Zoltan Fridrich [Wed, 25 Mar 2026 18:43:33 +0000 (19:43 +0100)] 
pkcs11/p11_cipher: make AES keys ephemeral objects

Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
3 weeks agoNEWS: add an entry for #1810
Alexander Sosedkin [Wed, 29 Apr 2026 10:27:48 +0000 (12:27 +0200)] 
NEWS: add an entry for #1810

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agotests/ocsp: do not exit(1), fail does that
Alexander Sosedkin [Thu, 23 Apr 2026 18:00:17 +0000 (20:00 +0200)] 
tests/ocsp: do not exit(1), fail does that

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agotests/ocsp: test against a truncated EKU OID
Alexander Sosedkin [Thu, 19 Mar 2026 19:12:19 +0000 (20:12 +0100)] 
tests/ocsp: test against a truncated EKU OID

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agox509/ocsp: check OCSP delegated signer EKU OID to full length
Alexander Sosedkin [Thu, 19 Mar 2026 18:33:02 +0000 (19:33 +0100)] 
x509/ocsp: check OCSP delegated signer EKU OID to full length

The retrieved certificate purpose OID was compared against the expected
1.3.6.1.5.5.7.3.9 value without checking if the lengths were identical,
allowing a value that constitutes a prefix to match.
The check now compares the length as well.

Reported-by: Joshua Rogers of AISLE Research Team <joshua@joshua.hu>
Co-authored-by: Joshua Rogers of AISLE Research Team <joshua@joshua.hu>
Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agoNEWS: add an entry for #1808
Alexander Sosedkin [Wed, 29 Apr 2026 10:20:20 +0000 (12:20 +0200)] 
NEWS: add an entry for #1808

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agotests/rehandshake-switch-psk-id: test usernames of varied length
Alexander Sosedkin [Wed, 18 Mar 2026 15:47:43 +0000 (16:47 +0100)] 
tests/rehandshake-switch-psk-id: test usernames of varied length

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agotests/rehandshake-switch-psk-id: refactor a bit
Alexander Sosedkin [Wed, 18 Mar 2026 15:08:51 +0000 (16:08 +0100)] 
tests/rehandshake-switch-psk-id: refactor a bit

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agohandshake-checks: fix username comparison during rehandshake
Joshua Rogers [Wed, 18 Mar 2026 16:08:03 +0000 (17:08 +0100)] 
handshake-checks: fix username comparison during rehandshake

This is definitely a security issue
subverting the GNUTLS_ALLOW_ID_CHANGE protection,
but its real-life exploitability is under question.

Reported-by: Joshua Rogers of AISLE Research Team <joshua@joshua.hu>
Fixes: #1808
Signed-off-by: Joshua Rogers <joshua@joshua.hu>
3 weeks agoNEWS: add an entry for CVE-2026-5419
Alexander Sosedkin [Wed, 29 Apr 2026 09:49:54 +0000 (11:49 +0200)] 
NEWS: add an entry for CVE-2026-5419

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agotests/cipher-padding: exercise invalid padding case
Daiki Ueno [Wed, 1 Apr 2026 10:01:50 +0000 (19:01 +0900)] 
tests/cipher-padding: exercise invalid padding case

This adds a negative test case, where a PKCS#7 padding is manipulated.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
3 weeks agognutls_cipher_decrypt3: make PKCS#7 unpadding branch free
Daiki Ueno [Wed, 1 Apr 2026 09:57:21 +0000 (18:57 +0900)] 
gnutls_cipher_decrypt3: make PKCS#7 unpadding branch free

This tries to make the logic of PKCS#7 padding removal constant-time,
by removing potential branching operations.

Reported-by: Doria Tang of Stony Brook University
Fixes: #1815
Fixes: CVE-2026-5419
Fixes: GNUTLS-SA-2026-04-29-13
CVSS: 3.7 Low CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N
Signed-off-by: Daiki Ueno <ueno@gnu.org>
3 weeks agoNEWS: add an entry for CVE-2026-3832
Alexander Sosedkin [Wed, 29 Apr 2026 09:36:08 +0000 (11:36 +0200)] 
NEWS: add an entry for CVE-2026-3832

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agotests/ocsp-tests/ocsp-must-staple-connection: no response case
Alexander Sosedkin [Thu, 12 Mar 2026 09:57:14 +0000 (10:57 +0100)] 
tests/ocsp-tests/ocsp-must-staple-connection: no response case

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agocert-session: log "no responses" case separately
Alexander Sosedkin [Thu, 12 Mar 2026 09:25:41 +0000 (10:25 +0100)] 
cert-session: log "no responses" case separately

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agotests/ocsp-tests/ocsp-must-staple-connection: grep for specific...
Alexander Sosedkin [Thu, 12 Mar 2026 09:42:49 +0000 (10:42 +0100)] 
tests/ocsp-tests/ocsp-must-staple-connection: grep for specific...

... error message: 'Got OCSP response with an unrelated certificate'.

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agotests/ocsp-tests/ocsp-must-staple-connection: test CVE-2026-3832
Alexander Sosedkin [Thu, 12 Mar 2026 14:25:24 +0000 (15:25 +0100)] 
tests/ocsp-tests/ocsp-must-staple-connection: test CVE-2026-3832

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agocert-session: fix multi-entry OCSP revocation bypass
Alexander Sosedkin [Thu, 12 Mar 2026 08:48:57 +0000 (09:48 +0100)] 
cert-session: fix multi-entry OCSP revocation bypass

In check_ocsp_response(), the code first searched
for the SingleResponse that matches the certificate being validated.
But later, the status was retrieved from entry 0 unconditionally,
rather than from the matched resp_indx.
As a result, if entry 0 corresponded to a different certificate and was good,
while the matched entry for the peer certificate is revoked,
the revocation check could've mistakenly accept the certificate.

Reported-by: Oleh Konko (1seal) <security@1seal.org>
Reported-by: Joshua Rogers of AISLE Research Team <joshua@joshua.hu>
Fixes: #1801
Fixes: #1812
Fixes: CVE-2026-3832
Fixes: GNUTLS-SA-2026-04-29-12
CVSS: 3.7 Low CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N
Introduced-in: ae404fe8488dee424876b5963c00d7e041672415 3.8.9
Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agoNEWS: add an entry for CVE-2026-42015
Alexander Sosedkin [Wed, 29 Apr 2026 09:23:47 +0000 (11:23 +0200)] 
NEWS: add an entry for CVE-2026-42015

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agox509/pkcs12_bag: fix off-by-one in bag element bounds check
Alexander Sosedkin [Mon, 20 Apr 2026 20:42:20 +0000 (22:42 +0200)] 
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>
3 weeks agoNEWS: add an entry for CVE-2026-5260
Alexander Sosedkin [Wed, 29 Apr 2026 09:02:58 +0000 (11:02 +0200)] 
NEWS: add an entry for CVE-2026-5260

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agolib/pkcs11_privkey: guard against overreading on short ciphertexts
Alexander Sosedkin [Mon, 30 Mar 2026 15:46:40 +0000 (17:46 +0200)] 
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>
3 weeks agolib/auth/rsa: check that ciphertext matches the modulus size
Alexander Sosedkin [Mon, 30 Mar 2026 15:31:07 +0000 (17:31 +0200)] 
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>
3 weeks agoNEWS: add an entry for CVE-2026-42014
Alexander Sosedkin [Wed, 29 Apr 2026 08:52:10 +0000 (10:52 +0200)] 
NEWS: add an entry for CVE-2026-42014

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agopkcs11_write: fix UAF and leak in gnutls_pkcs11_token_set_pin
Alexander Sosedkin [Wed, 18 Mar 2026 17:19:06 +0000 (18:19 +0100)] 
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>
3 weeks agoNEWS: add an entry for CVE-2026-42013
Alexander Sosedkin [Wed, 29 Apr 2026 08:30:37 +0000 (10:30 +0200)] 
NEWS: add an entry for CVE-2026-42013

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agotests/cert-tests: add tests for #1825
Alexander Sosedkin [Wed, 15 Apr 2026 16:02:31 +0000 (18:02 +0200)] 
tests/cert-tests: add tests for #1825

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agox509: prevent fallback on oversized SAN
Alexander Sosedkin [Wed, 15 Apr 2026 14:02:19 +0000 (16:02 +0200)] 
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>
3 weeks agox509/email-verify: call fallback DN fallback
Alexander Sosedkin [Wed, 15 Apr 2026 13:35:59 +0000 (15:35 +0200)] 
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>
3 weeks agoNEWS: add an entry for CVE-2026-42012
Alexander Sosedkin [Mon, 27 Apr 2026 11:31:36 +0000 (13:31 +0200)] 
NEWS: add an entry for CVE-2026-42012

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agotests/hostname-check: extend to exercise no-CN-fallback
Alexander Sosedkin [Fri, 13 Mar 2026 16:54:56 +0000 (17:54 +0100)] 
tests/hostname-check: extend to exercise no-CN-fallback

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agox509/hostname-verify: make URI/SRV SAN preclude CN fallback
Alexander Sosedkin [Fri, 13 Mar 2026 16:02:07 +0000 (17:02 +0100)] 
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>
3 weeks agox509/hostname-verify: refactor and simplify CN fallback logic
Alexander Sosedkin [Fri, 13 Mar 2026 16:00:03 +0000 (17:00 +0100)] 
x509/hostname-verify: refactor and simplify CN fallback logic

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agox509: add bare-bones awareness of SRV virtual SAN
Alexander Sosedkin [Fri, 13 Mar 2026 16:41:33 +0000 (17:41 +0100)] 
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>
3 weeks agox509/virt-san: a small OOM-correctness fix
Alexander Sosedkin [Tue, 28 Apr 2026 13:26:32 +0000 (15:26 +0200)] 
x509/virt-san: a small OOM-correctness fix

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agoNEWS: add an entry for CVE-2026-42011
Alexander Sosedkin [Wed, 29 Apr 2026 06:42:38 +0000 (08:42 +0200)] 
NEWS: add an entry for CVE-2026-42011

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agotests/name-constraints-merge: extend to cover #1824
Alexander Sosedkin [Tue, 14 Apr 2026 15:49:50 +0000 (17:49 +0200)] 
tests/name-constraints-merge: extend to cover #1824

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agox509/name_constraints: fix intersecting empty constraints
Alexander Sosedkin [Tue, 14 Apr 2026 15:41:30 +0000 (17:41 +0200)] 
x509/name_constraints: fix intersecting empty constraints

Permitted name constraints were wrongfully ignored
when prior CAs only had excluded name constraints,
resulting in a name constraint bypass.

With this change, they are taken into account and propagate.

Reported-by: Haruto Kimura (Stella)
Fixes: #1824
Fixes: CVE-2026-42011
Fixes: GNUTLS-SA-2026-04-29-6
CVSS: 4.8 Medium CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N
Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agoNEWS: add an entry for CVE-2026-3833
Alexander Sosedkin [Wed, 29 Apr 2026 06:58:03 +0000 (08:58 +0200)] 
NEWS: add an entry for CVE-2026-3833

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agotests/name-constraints: add case-sensitivity check
Alexander Sosedkin [Mon, 16 Mar 2026 14:48:57 +0000 (15:48 +0100)] 
tests/name-constraints: add case-sensitivity check

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agox509/name-constraints: compare domain names case-insensitive
Alexander Sosedkin [Mon, 16 Mar 2026 14:29:40 +0000 (15:29 +0100)] 
x509/name-constraints: compare domain names case-insensitive

RFC 5280 7.2:
> When comparing DNS names for equality, conforming implementations
> MUST perform a case-insensitive exact match on the entire DNS name.
> When evaluating name constraints, conforming implementations MUST
> perform a case-insensitive exact match on a label-by-label basis.

Domain name comparison during name constraints processing
was case-sensitive. For excluded name constraints, this could lead to
incorrectly accepting domain names that should've been rejected.
The code for comparing domain names and domain name parts of emails
has been modified to perform case-insensitive comparison instead.

Reported-by: Oleh Konko <security@1seal.org>
Reported-by: Joshua Rogers of AISLE Research Team <joshua@joshua.hu>
Fixes: #1223
Fixes: #1803
Fixes: #1852
Fixes: CVE-2026-3833
Fixes: GNUTLS-SA-2026-04-29-5
CVSS: 7.4 High CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N
Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agoNEWS: add an entry for CVE-2026-42010
Alexander Sosedkin [Fri, 24 Apr 2026 09:17:26 +0000 (11:17 +0200)] 
NEWS: add an entry for CVE-2026-42010

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agolib/auth/psk_passwd: limit the length of the comparison
Alexander Sosedkin [Mon, 27 Apr 2026 15:16:25 +0000 (17:16 +0200)] 
lib/auth/psk_passwd: limit the length of the comparison

Comparing a long username from a password file
to a short username from the wire
could lead to a heap overread up to the difference in their lengths.

Fixes: #1864
Reported-by: Joshua Rogers of AISLE Research Team <joshua@joshua.hu>
Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agotests/pskself2: sprinkle NUL into key for good measure
Alexander Sosedkin [Tue, 21 Apr 2026 17:49:47 +0000 (19:49 +0200)] 
tests/pskself2: sprinkle NUL into key for good measure

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agotests/pskself2: test username with NUL in the middle (#1850)
Alexander Sosedkin [Tue, 21 Apr 2026 17:19:42 +0000 (19:19 +0200)] 
tests/pskself2: test username with NUL in the middle (#1850)

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agolib/auth/rsa_psk: fix binary PSK identity lookup
Alexander Sosedkin [Tue, 21 Apr 2026 17:26:10 +0000 (19:26 +0200)] 
lib/auth/rsa_psk: fix binary PSK identity lookup

A server looking up PSK username with a NUL-character in it
was wrongfully matching username truncated at a NUL-character.
Fix the check to compare up to the full username length.

Reported-by: Joshua Rogers of AISLE Research Team <joshua@joshua.hu>
Fixes: #1850
Fixes: CVE-2026-42010
Fixes: GNUTLS-SA-2026-04-29-4
CVSS: 7.1 High CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:L/A:N
Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agotests/pskself2: extend with RSA-PSK support
Alexander Sosedkin [Tue, 21 Apr 2026 17:02:43 +0000 (19:02 +0200)] 
tests/pskself2: extend with RSA-PSK support

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agoNEWS: add an entry for CVE-2026-33845
Alexander Sosedkin [Fri, 24 Apr 2026 08:15:01 +0000 (10:15 +0200)] 
NEWS: add an entry for CVE-2026-33845

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agotests/mini-dtls-fragments: test #1811 crashing datagram
Alexander Sosedkin [Mon, 23 Mar 2026 19:24:26 +0000 (20:24 +0100)] 
tests/mini-dtls-fragments: test #1811 crashing datagram

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agotests/mini-dtls-fragments: test injecting 0-length ones
Alexander Sosedkin [Fri, 20 Mar 2026 15:55:10 +0000 (16:55 +0100)] 
tests/mini-dtls-fragments: test injecting 0-length ones

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agobuffers: simplify and tighten parse_handshake_header checks
Alexander Sosedkin [Mon, 23 Mar 2026 14:57:39 +0000 (15:57 +0100)] 
buffers: simplify and tighten parse_handshake_header checks

* frag_size > data_size is now rejected even when length == 0
* length == 0 && frag_size > 0 is now rejected even when start_offset == 0
* start_offset > length is now rejected even when frag_size == 0

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agobuffers: switch from end_offset over to frag_length
Alexander Sosedkin [Mon, 23 Mar 2026 14:09:43 +0000 (15:09 +0100)] 
buffers: switch from end_offset over to frag_length

Instead of maintaining an inclusive [start_offset, end_offset] range
when reassembling DTLS handshake,
track start_offset and a relative frag_length instead.

You'd think it'd be a no-op, but it fixes:

* 0-length fragments triggering completion if message was 1 byte long
* a remotely triggerable underflow and an ensuing heap overrun

Reported-by: Joshua Rogers of AISLE Research Team <joshua@joshua.hu>
Fixes: #1811
Fixes: CVE-2026-33845
Fixes: GNUTLS-SA-2026-04-29-3
CVSS: 7.5 High CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agobuffers: rename a variable in parse_handshake_header
Alexander Sosedkin [Wed, 22 Apr 2026 12:19:57 +0000 (14:19 +0200)] 
buffers: rename a variable in parse_handshake_header

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agoNEWS: add an entry for CVE-2026-42009
Alexander Sosedkin [Fri, 24 Apr 2026 08:06:14 +0000 (10:06 +0200)] 
NEWS: add an entry for CVE-2026-42009

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agobuffers: fix handshake_compare when sequence numbers match
Joshua Rogers [Tue, 21 Apr 2026 16:11:39 +0000 (18:11 +0200)] 
buffers: fix handshake_compare when sequence numbers match

The comparator function used for ordering DTLS packets
by sequence numbers did not follow qsort comparator contracts
in case of packets with duplicate sequence numbers,
which could lead to unstable ordering or undefined behaviour.
Returning 0 in such cases makes the sorting stable.

Reported-by: Joshua Rogers of AISLE Research Team <joshua@joshua.hu>
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
Signed-off-by: Joshua Rogers <joshua@joshua.hu>
3 weeks agolib/buffers: ensure packets have differing sequence numbers
Alexander Sosedkin [Tue, 21 Apr 2026 14:52:48 +0000 (16:52 +0200)] 
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 <joshua@joshua.hu>
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
Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agoNEWS: add an entry for CVE-2026-33846
Alexander Sosedkin [Fri, 24 Apr 2026 07:53:07 +0000 (09:53 +0200)] 
NEWS: add an entry for CVE-2026-33846

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agotests/mini-dtls-fragments: #1839 mismatching message_seq
Alexander Sosedkin [Mon, 20 Apr 2026 14:36:08 +0000 (16:36 +0200)] 
tests/mini-dtls-fragments: #1839 mismatching message_seq

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agobuffers: match DTLS datagrams by sequence number
Alexander Sosedkin [Mon, 20 Apr 2026 14:32:02 +0000 (16:32 +0200)] 
buffers: match DTLS datagrams by sequence number

DTLS handshake fragment reassembly previously matched incoming fragments
by handshake type only, without checking the sequence number.
This allowed fragments from different handshake messages
to be merged into the same reassembly buffer.

Now sequence number is accounted for during reassembly,
ensuring fragments are only merged when they belong
to the same handshake message.

Reported-by: Zou Dikai
Fixes: #1839
Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agotests/mini-dtls-fragments: extend with fragmenting ClientHello
Alexander Sosedkin [Mon, 20 Apr 2026 14:08:11 +0000 (16:08 +0200)] 
tests/mini-dtls-fragments: extend with fragmenting ClientHello

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agotests/mini-dtls-fragments: extend with a #1816 reproducer
Alexander Sosedkin [Wed, 1 Apr 2026 17:51:45 +0000 (19:51 +0200)] 
tests/mini-dtls-fragments: extend with a #1816 reproducer

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agobuffers: add more checks to DTLS reassembly
Alexander Sosedkin [Fri, 17 Apr 2026 16:21:36 +0000 (18:21 +0200)] 
buffers: add more checks to DTLS reassembly

Previously, gnutls didn't check that DTLS fragments claimed
a consistent message_length value.
Additionally, a crucial array size check was missing,
enabling an attacker to cause a heap overwrite.
The updated version rejects fragments with mismatching length
and adds a missing boundary check.

Reported-by: Haruto Kimura (Stella)
Reported-by: Oscar Reparaz
Reported-by: Zou Dikai
Fixes: #1816
Fixes: #1838
Fixes: #1839
Fixes: CVE-2026-33846
Fixes: GNUTLS-SA-2026-04-29-1
CVSS: 7.4 High CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:H
CVSS: 7.5 High CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agobuffers: shorten merge_handshake_packet using recv_buf
Alexander Sosedkin [Fri, 17 Apr 2026 15:49:31 +0000 (17:49 +0200)] 
buffers: shorten merge_handshake_packet using recv_buf

I had vague concerns about thread-safety of this,
but then this pattern already exists within the file.

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agotests/mini-dtls-fragments: implement a basic DTLS test
Alexander Sosedkin [Fri, 20 Mar 2026 15:09:40 +0000 (16:09 +0100)] 
tests/mini-dtls-fragments: implement a basic DTLS test

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 weeks agoMerge branch 'typo-test-fix' into 'master'
Daiki Ueno [Mon, 27 Apr 2026 23:38:52 +0000 (08:38 +0900)] 
Merge branch 'typo-test-fix' into 'master'

tests: fix typo in skip message

See merge request gnutls/gnutls!2101