[packages/krb5] Backport krb5-1.22 branch security fixes
arekm
arekm at pld-linux.org
Thu Oct 29 08:39:18 CET 2026
commit 65677b06b2536c1fc293c13946115adc0692cb25
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Wed Oct 28 23:52:02 2026 +0100
Backport krb5-1.22 branch security fixes
Fixes CVE-2026-107778, CVE-2026-107708.
CVE-2026-107708.patch | 39 +++
CVE-2026-107778.patch | 36 +++
krb5-gss-empty-forwarded-creds.patch | 126 ++++++++
krb5-gss-union-name-type-copy.patch | 53 ++++
krb5-gss_add_cred-fallback.patch | 47 +++
krb5-import_name-reachable-assert.patch | 32 ++
krb5-iprop-key_data_ver.patch | 37 +++
krb5-keytab-size-overflow.patch | 32 ++
krb5-ldap-tl_data2berval-double-free.patch | 58 ++++
krb5-rd_cred-optional-names.patch | 37 +++
krb5-ser-validate-lengths.patch | 456 +++++++++++++++++++++++++++++
krb5-spnego-mechlistmic-null-deref.patch | 33 +++
krb5.spec | 24 ++
13 files changed, 1010 insertions(+)
---
diff --git a/krb5.spec b/krb5.spec
index d4bf00a..8347218 100644
--- a/krb5.spec
+++ b/krb5.spec
@@ -54,6 +54,18 @@ Patch10: %{name}-keyring-test.patch
Patch11: CVE-2026-40355.patch
Patch12: CVE-2026-11850.patch
Patch13: %{name}-svc_auth_gssapi-overrun.patch
+Patch14: CVE-2026-107708.patch
+Patch15: CVE-2026-107778.patch
+Patch16: %{name}-rd_cred-optional-names.patch
+Patch17: %{name}-ser-validate-lengths.patch
+Patch18: %{name}-spnego-mechlistmic-null-deref.patch
+Patch19: %{name}-gss_add_cred-fallback.patch
+Patch20: %{name}-gss-union-name-type-copy.patch
+Patch21: %{name}-import_name-reachable-assert.patch
+Patch22: %{name}-iprop-key_data_ver.patch
+Patch23: %{name}-gss-empty-forwarded-creds.patch
+Patch24: %{name}-keytab-size-overflow.patch
+Patch25: %{name}-ldap-tl_data2berval-double-free.patch
URL: https://web.mit.edu/kerberos/www/
BuildRequires: /bin/csh
%{?with_audit:BuildRequires: audit-libs-devel}
@@ -397,6 +409,18 @@ Dokumentacja systemu MIT Kerberos V5 w formacie HTML.
%patch -P11 -p1
%patch -P12 -p1
%patch -P13 -p1
+%patch -P14 -p1
+%patch -P15 -p1
+%patch -P16 -p1
+%patch -P17 -p1
+%patch -P18 -p1
+%patch -P19 -p1
+%patch -P20 -p1
+%patch -P21 -p1
+%patch -P22 -p1
+%patch -P23 -p1
+%patch -P24 -p1
+%patch -P25 -p1
%build
cd src
diff --git a/CVE-2026-107708.patch b/CVE-2026-107708.patch
new file mode 100644
index 0000000..a9ce1d2
--- /dev/null
+++ b/CVE-2026-107708.patch
@@ -0,0 +1,39 @@
+From a88a18cafa1040a0c4f9c8d08288fc98831ec86d Mon Sep 17 00:00:00 2001
+From: TristanInSec <tristan.mtn at gmail.com>
+Date: Mon, 18 May 2026 11:56:34 -0400
+Subject: [PATCH] Fix error handling in KDC PAC processing
+
+When get_pac_princ_with_realm() detects the wrong number of '@'
+characters, return an error instead of 0. When it encounters an error
+from krb5_parse_name_flags(), do not leak client_str.
+
+[ghudson at mit.edu: fixed memory leak; rewrote commit message]
+
+(cherry picked from commit f6e2c397ceda6467ebbaab8ed66d4895c9f1d6a7)
+
+ticket: 9212
+version_fixed: 1.22.3
+---
+ src/kdc/kdc_util.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/kdc/kdc_util.c b/src/kdc/kdc_util.c
+index 6f88afa2d76..33b803fa9ef 100644
+--- a/src/kdc/kdc_util.c
++++ b/src/kdc/kdc_util.c
+@@ -665,13 +665,13 @@ get_pac_princ_with_realm(krb5_context context, krb5_pac pac,
+
+ ret = krb5_parse_name_flags(context, client_str, flags, princ_out);
+ if (ret)
+- return ret;
++ goto cleanup;
+
+ (*princ_out)->type = KRB5_NT_MS_PRINCIPAL;
+
+ cleanup:
+ free(client_str);
+- return 0;
++ return ret;
+ }
+
+ /* This probably wants to be updated if you support last_req stuff */
diff --git a/CVE-2026-107778.patch b/CVE-2026-107778.patch
new file mode 100644
index 0000000..1ef34f5
--- /dev/null
+++ b/CVE-2026-107778.patch
@@ -0,0 +1,36 @@
+From 62196e2b269159a5465f5b8d0ed7cf6f29c3282a Mon Sep 17 00:00:00 2001
+From: TristanInSec <tristan.mtn at gmail.com>
+Date: Mon, 18 May 2026 11:57:21 -0400
+Subject: [PATCH] Avoid null dereference in krb5_rd_cred()
+
+A malformed KRB-CRED message may have fewer entries in the encrypted
+ticket-info list than it has in the tickets list. In each loop
+iteration, check if we unexpectedly reached the end of the ticket-info
+list to avoid a null dereference.
+
+[ghudson at mit.edu: added comment; rewrote commit message]
+
+(cherry picked from commit 48afa9abb89ab2176bb20624d87d010b9984fc08)
+
+ticket: 9211
+version_fixed: 1.22.3
+---
+ src/lib/krb5/krb/rd_cred.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/src/lib/krb5/krb/rd_cred.c b/src/lib/krb5/krb/rd_cred.c
+index d89a98ae0fd..c341eba153d 100644
+--- a/src/lib/krb5/krb/rd_cred.c
++++ b/src/lib/krb5/krb/rd_cred.c
+@@ -98,6 +98,11 @@ make_cred_list(krb5_context context, krb5_cred *krbcred,
+ goto cleanup;
+
+ info = encpart->ticket_info[i];
++ if (info == NULL) {
++ /* We unexpectedly reached the end of the encrypted ticket info. */
++ ret = KRB5KRB_AP_ERR_MODIFIED;
++ goto cleanup;
++ }
+ ret = krb5_copy_principal(context, info->client, &list[i]->client);
+ if (ret)
+ goto cleanup;
diff --git a/krb5-gss-empty-forwarded-creds.patch b/krb5-gss-empty-forwarded-creds.patch
new file mode 100644
index 0000000..1378c3a
--- /dev/null
+++ b/krb5-gss-empty-forwarded-creds.patch
@@ -0,0 +1,126 @@
+From 71bac89803b614701491dbe52db556fc99a370fa Mon Sep 17 00:00:00 2001
+From: Greg Hudson <ghudson at mit.edu>
+Date: Sun, 14 Jun 2026 17:01:34 -0400
+Subject: [PATCH] Check for empty forwarded creds in krb5 GSS mech
+
+In rd_and_store_for_creds(), do not dereference the first element of
+the forwarded credential list if it is empty. In addition, if an
+application passes a null delegated_cred_handle to
+gss_accept_sec_context(), do not call krb5_rd_cred() in the krb5 GSS
+mech.
+
+(cherry picked from commit 690cbe7d9b6d095cbeb77fe3e4d0c910f97bbb3e)
+
+ticket: 9220
+version_fixed: 1.22.3
+---
+ src/lib/gssapi/krb5/accept_sec_context.c | 70 ++++++++++--------------
+ 1 file changed, 29 insertions(+), 41 deletions(-)
+
+diff --git a/src/lib/gssapi/krb5/accept_sec_context.c b/src/lib/gssapi/krb5/accept_sec_context.c
+index c9987b757b3..3a7fb4e89fa 100644
+--- a/src/lib/gssapi/krb5/accept_sec_context.c
++++ b/src/lib/gssapi/krb5/accept_sec_context.c
+@@ -170,6 +170,10 @@ rd_and_store_for_creds(krb5_context context, krb5_auth_context auth_context,
+ krb5_auth_context new_auth_ctx = NULL;
+ krb5_int32 flags_org;
+
++ /* Ignore the forwarded creds if the application doesn't want them. */
++ if (out_cred == NULL)
++ return 0;
++
+ if ((retval = krb5_auth_con_getflags(context, auth_context, &flags_org)))
+ return retval;
+ krb5_auth_con_setflags(context, auth_context,
+@@ -205,6 +209,9 @@ rd_and_store_for_creds(krb5_context context, krb5_auth_context auth_context,
+ goto cleanup;
+ }
+
++ if (creds[0] == NULL)
++ goto cleanup;
++
+ if ((retval = krb5_cc_new_unique(context, "MEMORY", NULL, &ccache))) {
+ ccache = NULL;
+ goto cleanup;
+@@ -216,50 +223,32 @@ rd_and_store_for_creds(krb5_context context, krb5_auth_context auth_context,
+ if ((retval = k5_cc_store_primary_cred(context, ccache, creds[0])))
+ goto cleanup;
+
+- /* generate a delegated credential handle */
+- if (out_cred) {
+- /* allocate memory for a cred_t... */
+- if (!(cred =
+- (krb5_gss_cred_id_t) xmalloc(sizeof(krb5_gss_cred_id_rec)))) {
+- retval = ENOMEM; /* out of memory? */
+- goto cleanup;
+- }
++ cred = k5alloc(sizeof(*cred), &retval);
++ if (cred == NULL)
++ goto cleanup;
+
+- /* zero it out... */
+- memset(cred, 0, sizeof(krb5_gss_cred_id_rec));
++ retval = k5_mutex_init(&cred->lock);
++ if (retval)
++ goto cleanup;
+
+- retval = k5_mutex_init(&cred->lock);
+- if (retval) {
+- xfree(cred);
+- cred = NULL;
+- goto cleanup;
+- }
++ retval = kg_init_name(context, creds[0]->client, NULL, NULL, NULL, 0,
++ &cred->name);
++ if (retval) {
++ k5_mutex_destroy(&cred->lock);
++ goto cleanup;
++ }
+
+- /* copy the client principle into it... */
+- if ((retval =
+- kg_init_name(context, creds[0]->client, NULL, NULL, NULL, 0,
+- &cred->name))) {
+- k5_mutex_destroy(&cred->lock);
+- retval = ENOMEM; /* out of memory? */
+- xfree(cred); /* clean up memory on failure */
+- cred = NULL;
+- goto cleanup;
+- }
++ cred->usage = GSS_C_INITIATE;
++ cred->keytab = NULL;
++ cred->expire = creds[0]->times.endtime;
++ /* Transfer ownership of ccache to cred. */
++ cred->ccache = ccache;
++ cred->destroy_ccache = 1;
++ ccache = NULL;
+
+- cred->usage = GSS_C_INITIATE; /* we can't accept with this */
+- /* cred->name already set */
+- cred->keytab = NULL; /* no keytab associated with this... */
+- cred->expire = creds[0]->times.endtime; /* store the end time */
+- cred->ccache = ccache; /* the ccache containing the credential */
+- cred->destroy_ccache = 1;
+- ccache = NULL; /* cred takes ownership so don't destroy */
+- }
++ *out_cred = cred;
++ cred = NULL;
+
+- /* If there were errors, there might have been a memory leak
+- if (!cred)
+- if ((retval = krb5_cc_close(context, ccache)))
+- goto cleanup;
+- */
+ cleanup:
+ if (creds)
+ krb5_free_tgt_creds(context, creds);
+@@ -267,8 +256,7 @@ rd_and_store_for_creds(krb5_context context, krb5_auth_context auth_context,
+ if (ccache)
+ (void)krb5_cc_destroy(context, ccache);
+
+- if (out_cred)
+- *out_cred = cred; /* return credential */
++ free(cred);
+
+ if (new_auth_ctx)
+ krb5_auth_con_free(context, new_auth_ctx);
diff --git a/krb5-gss-union-name-type-copy.patch b/krb5-gss-union-name-type-copy.patch
new file mode 100644
index 0000000..db052ba
--- /dev/null
+++ b/krb5-gss-union-name-type-copy.patch
@@ -0,0 +1,53 @@
+From eb6c0b3a6f6233a5ace983ff043f635823ffcac8 Mon Sep 17 00:00:00 2001
+From: Greg Hudson <ghudson at mit.edu>
+Date: Sat, 23 May 2026 17:07:10 -0400
+Subject: [PATCH] Always copy mech name_type for GSS union names
+
+In gssint_convert_name_to_union_name(), make a copy of the name_type
+OID yielded by the mechanism's gss_display_name(), as it will later be
+released with gss_release_oid(). We usually get away with not copying
+the name type because gss_release_oid() usually ignores static
+mechanism OIDs, but this property is fragile (it relies on mechanisms
+implementing gss_internal_release_oid()).
+
+Reported by Daniel Sands.
+
+(cherry picked from commit 15a8dea777012268311c106e08d324acdfd8b13c)
+
+ticket: 9216
+version_fixed: 1.22.3
+---
+ src/lib/gssapi/mechglue/g_glue.c | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/src/lib/gssapi/mechglue/g_glue.c b/src/lib/gssapi/mechglue/g_glue.c
+index 76da8a83c1d..9a6671e0a4f 100644
+--- a/src/lib/gssapi/mechglue/g_glue.c
++++ b/src/lib/gssapi/mechglue/g_glue.c
+@@ -372,6 +372,7 @@ gssint_convert_name_to_union_name(OM_uint32 *minor_status, gss_mechanism mech,
+ {
+ OM_uint32 major_status,tmp;
+ gss_union_name_t union_name;
++ gss_OID name_type;
+
+ union_name = (gss_union_name_t) malloc (sizeof(gss_union_name_desc));
+ if (!union_name) {
+@@ -404,11 +405,17 @@ gssint_convert_name_to_union_name(OM_uint32 *minor_status, gss_mechanism mech,
+ major_status = mech->gss_display_name(minor_status,
+ internal_name,
+ union_name->external_name,
+- &union_name->name_type);
++ &name_type);
+ if (major_status != GSS_S_COMPLETE) {
+ map_error(minor_status, mech);
+ goto allocation_failure;
+ }
++ major_status = generic_gss_copy_oid(minor_status, name_type,
++ &union_name->name_type);
++ if (major_status != GSS_S_COMPLETE) {
++ map_errcode(minor_status);
++ goto allocation_failure;
++ }
+
+ union_name->loopback = union_name;
+ *external_name = /*(gss_name_t) CHECK */union_name;
diff --git a/krb5-gss_add_cred-fallback.patch b/krb5-gss_add_cred-fallback.patch
new file mode 100644
index 0000000..942985f
--- /dev/null
+++ b/krb5-gss_add_cred-fallback.patch
@@ -0,0 +1,47 @@
+From e4d263f9e22221d7354631bcbbd0e27fae8515bd Mon Sep 17 00:00:00 2001
+From: Greg Hudson <ghudson at mit.edu>
+Date: Thu, 21 May 2026 17:34:27 -0400
+Subject: [PATCH] Fix gss_add_cred() extension fallback path
+
+In copy_mech_cred(), if we fall back to using the mechanism's
+gss_inquire_cred() and gss_acquire_cred(), correctly release the
+mechanism name, and map the minor status if a mechanism call fails.
+Reported by Daniel Sands.
+
+This helper function is only reached if an application calls
+gss_add_cred() with non-null input_cred_handle and output_cred_handle.
+It was introduced in commit 288cbada833dc6af7d43dd308563b48b73347dfb
+(ticket 8734).
+
+(cherry picked from commit d4c96c2279855b2064ebef192434382118d101e8)
+
+ticket: 9214
+version_fixed: 1.22.3
+---
+ src/lib/gssapi/mechglue/g_acquire_cred.c | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/src/lib/gssapi/mechglue/g_acquire_cred.c b/src/lib/gssapi/mechglue/g_acquire_cred.c
+index 2fc9c5c7860..eaae67d544a 100644
+--- a/src/lib/gssapi/mechglue/g_acquire_cred.c
++++ b/src/lib/gssapi/mechglue/g_acquire_cred.c
+@@ -306,13 +306,17 @@ copy_mech_cred(OM_uint32 *minor_status, gss_cred_id_t cred_in,
+ mech->gss_acquire_cred != NULL) {
+ status = mech->gss_inquire_cred(minor_status, cred_in, &name, &life,
+ &usage, NULL);
+- if (status != GSS_S_COMPLETE)
++ if (status != GSS_S_COMPLETE) {
++ map_error(minor_status, mech);
+ return (status);
++ }
+ oidset.count = 1;
+ oidset.elements = gssint_get_public_oid(mech_oid);
+ status = mech->gss_acquire_cred(minor_status, name, life, &oidset,
+ usage, cred_out, NULL, NULL);
+- gss_release_name(&tmpmin, &name);
++ if (status != GSS_S_COMPLETE)
++ map_error(minor_status, mech);
++ (void) gssint_release_internal_name(&tmpmin, &mech->mech_type, &name);
+ } else {
+ status = GSS_S_UNAVAILABLE;
+ }
diff --git a/krb5-import_name-reachable-assert.patch b/krb5-import_name-reachable-assert.patch
new file mode 100644
index 0000000..0cb62c4
--- /dev/null
+++ b/krb5-import_name-reachable-assert.patch
@@ -0,0 +1,32 @@
+From 74f3cc6a79d5c2058af59025a148588c05fb8c8e Mon Sep 17 00:00:00 2001
+From: Greg Hudson <ghudson at mit.edu>
+Date: Mon, 1 Jun 2026 08:59:34 -0400
+Subject: [PATCH] Fix reachable assert when importing krb5 names
+
+If a name token contains trailing garbage, error out from
+krb5_gss_import_name() instead of crashing the process with an
+assertion failure. Reported by Aisle Research (Ze Sheng, Dmitrijs
+Trizna, Luigino Camastra, Guido Vranken).
+
+(cherry picked from commit 07818f1fd34560dbfd87c2f65bf8cd705be0e1d2)
+
+ticket: 9217
+version_fixed: 1.22.3
+---
+ src/lib/gssapi/krb5/import_name.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/lib/gssapi/krb5/import_name.c b/src/lib/gssapi/krb5/import_name.c
+index a067d07423..9a27b1468a 100644
+--- a/src/lib/gssapi/krb5/import_name.c
++++ b/src/lib/gssapi/krb5/import_name.c
+@@ -297,7 +297,8 @@ import_name(OM_uint32 *minor_status, gss_buffer_t input_name_buffer,
+ goto fail_name;
+ cp += length;
+ }
+- assert(cp == end);
++ if (cp != end)
++ goto fail_name;
+ } else {
+ status = GSS_S_BAD_NAMETYPE;
+ goto cleanup;
diff --git a/krb5-iprop-key_data_ver.patch b/krb5-iprop-key_data_ver.patch
new file mode 100644
index 0000000..4041e42
--- /dev/null
+++ b/krb5-iprop-key_data_ver.patch
@@ -0,0 +1,37 @@
+From a42fb6d76ecc7b45fd5cac6025204ae883b0d0a5 Mon Sep 17 00:00:00 2001
+From: Greg Hudson <ghudson at mit.edu>
+Date: Thu, 4 Jun 2026 13:46:34 -0400
+Subject: [PATCH] Better validate key_data_ver in iprop decoding
+
+In ulog_conv_2dbentry(), when decoding an update's AT_KEYDATA
+attribute, the decoded key_data_ver value is used as a bound on the
+enctype and contents fields. Verify that this value does not exceed
+the sizes of the update's enctype and contents XDR arrays, to prevent
+reading past the end of those arrays. Also check against the expected
+lower bound. Reported by Haruki Oyama.
+
+(cherry picked from commit 7262b0f49e3c37b7237280a1b2e38228831a795d)
+
+ticket: 9218
+version_fixed: 1.22.3
+---
+ src/lib/kdb/kdb_convert.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/src/lib/kdb/kdb_convert.c b/src/lib/kdb/kdb_convert.c
+index 59952f55e39..1231abc4ffb 100644
+--- a/src/lib/kdb/kdb_convert.c
++++ b/src/lib/kdb/kdb_convert.c
+@@ -677,8 +677,10 @@ ulog_conv_2dbentry(krb5_context context, krb5_db_entry **entry,
+ kdbe_key_t *kv = &ULOG_ENTRY_KEYVAL(update, i, j);
+ kp->key_data_ver = (krb5_int16)kv->k_ver;
+ kp->key_data_kvno = (krb5_ui_2)kv->k_kvno;
+- if (kp->key_data_ver > 2) {
+- ret = EINVAL; /* XXX ? */
++ if (kp->key_data_ver < 1 || kp->key_data_ver > 2 ||
++ (u_int)kp->key_data_ver > kv->k_enctype.k_enctype_len ||
++ (u_int)kp->key_data_ver > kv->k_contents.k_contents_len) {
++ ret = EINVAL;
+ goto cleanup;
+ }
+
diff --git a/krb5-keytab-size-overflow.patch b/krb5-keytab-size-overflow.patch
new file mode 100644
index 0000000..058ee82
--- /dev/null
+++ b/krb5-keytab-size-overflow.patch
@@ -0,0 +1,32 @@
+From 8eab516421b6b1fee2482194cd4bedcfc552bfeb Mon Sep 17 00:00:00 2001
+From: Greg Hudson <ghudson at mit.edu>
+Date: Sat, 11 Jul 2026 19:43:08 -0400
+Subject: [PATCH] Prevent integer overrun in keytab parsing
+
+In krb5_ktfileint_internal_read_entry(), once we have read the size
+and determined the starting point of a keytab record, bounds-check the
+size to prevent an integer overflow when we seek to the next record.
+
+(Discovered by OSS-Fuzz.)
+
+(cherry picked from commit c5629fdffee70a296429d580a890e21c6fa17665)
+
+ticket: 9224
+version_fixed: 1.22.3
+---
+ src/lib/krb5/keytab/kt_file.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/lib/krb5/keytab/kt_file.c b/src/lib/krb5/keytab/kt_file.c
+index 993f902c7cf..ff9fa230936 100644
+--- a/src/lib/krb5/keytab/kt_file.c
++++ b/src/lib/krb5/keytab/kt_file.c
+@@ -935,6 +935,8 @@ krb5_ktfileint_internal_read_entry(krb5_context context, krb5_keytab id, krb5_ke
+ }
+
+ start_pos = ftell(KTFILEP(id));
++ if (size > INT32_MAX - start_pos)
++ return KRB5_KT_FORMAT;
+
+ /* deal with guts of parsing... */
+
diff --git a/krb5-ldap-tl_data2berval-double-free.patch b/krb5-ldap-tl_data2berval-double-free.patch
new file mode 100644
index 0000000..f0b7ce1
--- /dev/null
+++ b/krb5-ldap-tl_data2berval-double-free.patch
@@ -0,0 +1,58 @@
+From 5dbd6ba425eecf76396d2f78b79738983b255c20 Mon Sep 17 00:00:00 2001
+From: Greg Hudson <ghudson at mit.edu>
+Date: Mon, 31 Aug 2026 17:56:46 -0400
+Subject: [PATCH] Prevent dangling result in tl_data2berval()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+If the second malloc() fails in tl_data2berval(), do not leave a
+dangling freed pointer in *out, or the caller will free it a second
+time. Reported by Vidal Segura García.
+
+(cherry picked from commit 6a880f5a629ccdfe9e5ecefc46b2186ba69bcc6d)
+
+ticket: 9232
+version_fixed: 1.22.3
+---
+ .../kdb/ldap/libkdb_ldap/ldap_principal2.c | 22 +++++++++++--------
+ 1 file changed, 13 insertions(+), 9 deletions(-)
+
+diff --git a/src/plugins/kdb/ldap/libkdb_ldap/ldap_principal2.c b/src/plugins/kdb/ldap/libkdb_ldap/ldap_principal2.c
+index 525e8d0277..251da025bd 100644
+--- a/src/plugins/kdb/ldap/libkdb_ldap/ldap_principal2.c
++++ b/src/plugins/kdb/ldap/libkdb_ldap/ldap_principal2.c
+@@ -628,20 +628,24 @@ krb5_encode_histkey(osa_princ_ent_rec *princ_ent)
+ static krb5_error_code
+ tl_data2berval (krb5_tl_data *in, struct berval **out)
+ {
+- *out = (struct berval *) malloc (sizeof (struct berval));
+- if (*out == NULL)
+- return ENOMEM;
++ struct berval *bv;
+
+- (*out)->bv_len = in->tl_data_length + 2;
+- (*out)->bv_val = (char *) malloc ((*out)->bv_len);
+- if ((*out)->bv_val == NULL) {
+- free (*out);
++ *out = NULL;
++
++ bv = malloc(sizeof(*bv));
++ if (bv == NULL)
++ return ENOMEM;
++ bv->bv_len = in->tl_data_length + 2;
++ bv->bv_val = malloc(bv->bv_len);
++ if (bv->bv_val == NULL) {
++ free(bv);
+ return ENOMEM;
+ }
+
+- STORE16_INT((*out)->bv_val, in->tl_data_type);
+- memcpy ((*out)->bv_val + 2, in->tl_data_contents, in->tl_data_length);
++ STORE16_INT(bv->bv_val, in->tl_data_type);
++ memcpy(bv->bv_val + 2, in->tl_data_contents, in->tl_data_length);
+
++ *out = bv;
+ return 0;
+ }
+
diff --git a/krb5-rd_cred-optional-names.patch b/krb5-rd_cred-optional-names.patch
new file mode 100644
index 0000000..a04c9d4
--- /dev/null
+++ b/krb5-rd_cred-optional-names.patch
@@ -0,0 +1,37 @@
+From 09ede2e5ca56695d3e4a9ef4b9e48208d47574c7 Mon Sep 17 00:00:00 2001
+From: Rahul Hoysala <rahulhoysala07 at gmail.com>
+Date: Thu, 4 Jun 2026 13:14:45 +0530
+Subject: [PATCH] Avoid another null dereference in krb5_rd_cred()
+
+In RFC 4120, the ticket client and server principal names are optional
+in KrbCredInfo, but we have always required them to be present. Add
+checks to prevent null dereferences in krb5_rd_cred() if either name
+is not specified.
+
+[ghudson at mit.edu: folded check in with the end-of-list check; rewrote
+comment and commit message]
+
+(cherry picked from commit 5031b854ad8ba6cce20cdd8c991f81dbc3f924bd)
+
+ticket: 9219
+version_fixed: 1.22.3
+---
+ src/lib/krb5/krb/rd_cred.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/src/lib/krb5/krb/rd_cred.c b/src/lib/krb5/krb/rd_cred.c
+index c341eba153..80d49fd8b1 100644
+--- a/src/lib/krb5/krb/rd_cred.c
++++ b/src/lib/krb5/krb/rd_cred.c
+@@ -98,8 +98,9 @@ make_cred_list(krb5_context context, krb5_cred *krbcred,
+ goto cleanup;
+
+ info = encpart->ticket_info[i];
+- if (info == NULL) {
+- /* We unexpectedly reached the end of the encrypted ticket info. */
++ if (info == NULL || info->client == NULL || info->server == NULL) {
++ /* We unexpectedly reached the end of the encrypted ticket info,
++ * or the ticket info is unexpectedly missing a principal name. */
+ ret = KRB5KRB_AP_ERR_MODIFIED;
+ goto cleanup;
+ }
diff --git a/krb5-ser-validate-lengths.patch b/krb5-ser-validate-lengths.patch
new file mode 100644
index 0000000..fadd70e
--- /dev/null
+++ b/krb5-ser-validate-lengths.patch
@@ -0,0 +1,456 @@
+From 0ee8617c6f789a2221b5305149c7633edd4c3935 Mon Sep 17 00:00:00 2001
+From: TristanInSec <tristan.mtn at gmail.com>
+Date: Tue, 12 May 2026 05:42:36 -0400
+Subject: [PATCH] Validate lengths when deserializing
+
+When unmarshalling data structures using the krb5_ser_ functions,
+bound-check lengths (including array counts) against the remaining
+number of bytes to prevent large allocations, integer overflows, and a
+potential read overrun in mspac_internalize(). Add an internal helper
+function k5_ser_unpack_len() for this purpose.
+
+[ghudson at mit.edu: added helper; added bounds checks for additional
+lengths; rewrote commit message]
+
+(cherry picked from commit 63ae6a8d99ce89258d732f7561233f60df533fa9)
+
+ticket: 9209
+version_fixed: 1.22.3
+---
+ src/include/k5-int.h | 3 +++
+ src/lib/gssapi/krb5/ser_sctx.c | 6 ++++++
+ src/lib/krb5/krb/authdata.c | 5 ++---
+ src/lib/krb5/krb/pac.c | 13 ++++++-------
+ src/lib/krb5/krb/ser_actx.c | 5 ++---
+ src/lib/krb5/krb/ser_adata.c | 13 ++++++-------
+ src/lib/krb5/krb/ser_addr.c | 12 ++++++------
+ src/lib/krb5/krb/ser_auth.c | 15 +++++----------
+ src/lib/krb5/krb/ser_cksum.c | 14 ++++++--------
+ src/lib/krb5/krb/ser_ctx.c | 18 +++++++++---------
+ src/lib/krb5/krb/ser_key.c | 11 +++++------
+ src/lib/krb5/krb/ser_princ.c | 11 +++++------
+ src/lib/krb5/krb/serialize.c | 18 ++++++++++++++++++
+ src/lib/krb5/libkrb5.exports | 1 +
+ src/plugins/authdata/greet_client/greet.c | 2 ++
+ 15 files changed, 82 insertions(+), 65 deletions(-)
+
+diff --git a/src/include/k5-int.h b/src/include/k5-int.h
+index cfd2cc9393d..5b2e9e6a1ec 100644
+--- a/src/include/k5-int.h
++++ b/src/include/k5-int.h
+@@ -1882,6 +1882,9 @@ krb5_ser_pack_int64(int64_t, krb5_octet **, size_t *);
+ krb5_error_code KRB5_CALLCONV
+ krb5_ser_unpack_int64(int64_t *, krb5_octet **, size_t *);
+
++krb5_error_code
++k5_ser_unpack_len(size_t *len_out, krb5_octet **bufp, size_t *remainp);
++
+ /* [De]serialize byte string */
+ krb5_error_code KRB5_CALLCONV
+ krb5_ser_pack_bytes(krb5_octet *, size_t, krb5_octet **, size_t *);
+diff --git a/src/lib/gssapi/krb5/ser_sctx.c b/src/lib/gssapi/krb5/ser_sctx.c
+index 1129b6a1aaa..2e82be903db 100644
+--- a/src/lib/gssapi/krb5/ser_sctx.c
++++ b/src/lib/gssapi/krb5/ser_sctx.c
+@@ -84,6 +84,10 @@ kg_oid_internalize(gss_OID *argp, krb5_octet **buffer, size_t *lenremain)
+ free(oid);
+ return EINVAL;
+ }
++ if (ibuf < 0 || (size_t)ibuf > remain) {
++ free(oid);
++ return EINVAL;
++ }
+ oid->length = ibuf;
+ oid->elements = malloc((size_t)ibuf);
+ if (oid->elements == 0) {
+@@ -632,6 +636,8 @@ kg_ctx_internalize(krb5_context kcontext, krb5_gss_ctx_id_t *argp,
+ /* authdata */
+ if (!kret)
+ kret = krb5_ser_unpack_int32(&ibuf, &bp, &remain);
++ if (!kret && (ibuf < 0 || (size_t)ibuf > remain))
++ kret = ENOMEM;
+ if (!kret) {
+ krb5_int32 nadata = ibuf, i;
+
+diff --git a/src/lib/krb5/krb/authdata.c b/src/lib/krb5/krb/authdata.c
+index b5659c2ebdc..9b61ef185e5 100644
+--- a/src/lib/krb5/krb/authdata.c
++++ b/src/lib/krb5/krb/authdata.c
+@@ -314,14 +314,13 @@ k5_ad_internalize(krb5_context kcontext,
+ size_t *lenremain)
+ {
+ krb5_error_code code = 0;
+- krb5_int32 i, count;
+ krb5_octet *bp;
+- size_t remain;
++ size_t remain, count, i;
+
+ bp = *buffer;
+ remain = *lenremain;
+
+- code = krb5_ser_unpack_int32(&count, &bp, &remain);
++ code = k5_ser_unpack_len(&count, &bp, &remain);
+ if (code != 0)
+ return code;
+
+diff --git a/src/lib/krb5/krb/pac.c b/src/lib/krb5/krb/pac.c
+index 7e333874546..51c4b6a1c94 100644
+--- a/src/lib/krb5/krb/pac.c
++++ b/src/lib/krb5/krb/pac.c
+@@ -1196,24 +1196,23 @@ mspac_internalize(krb5_context context, krb5_authdata_context actx,
+ krb5_error_code ret;
+ int32_t ibuf;
+ uint8_t *bp;
+- size_t remain;
++ size_t remain, len;
+ krb5_pac pac = NULL;
+
+ bp = *buffer;
+ remain = *lenremain;
+
+- /* length */
+- ret = krb5_ser_unpack_int32(&ibuf, &bp, &remain);
++ ret = k5_ser_unpack_len(&len, &bp, &remain);
+ if (ret)
+ return ret;
+
+- if (ibuf != 0) {
+- ret = krb5_pac_parse(context, bp, ibuf, &pac);
++ if (len > 0) {
++ ret = krb5_pac_parse(context, bp, len, &pac);
+ if (ret)
+ return ret;
+
+- bp += ibuf;
+- remain -= ibuf;
++ bp += len;
++ remain -= len;
+ }
+
+ /* verified */
+diff --git a/src/lib/krb5/krb/ser_actx.c b/src/lib/krb5/krb/ser_actx.c
+index ed8e25596b5..f35894a1021 100644
+--- a/src/lib/krb5/krb/ser_actx.c
++++ b/src/lib/krb5/krb/ser_actx.c
+@@ -255,8 +255,7 @@ k5_internalize_auth_context(krb5_auth_context *argp,
+ krb5_auth_context auth_context;
+ krb5_int32 ibuf;
+ krb5_octet *bp;
+- size_t remain;
+- krb5_int32 cstate_len;
++ size_t remain, cstate_len;
+ krb5_int32 tag;
+
+ bp = *buffer;
+@@ -294,7 +293,7 @@ k5_internalize_auth_context(krb5_auth_context *argp,
+ auth_context->safe_cksumtype = (krb5_cksumtype) ibuf;
+
+ /* Get length of cstate */
+- (void) krb5_ser_unpack_int32(&cstate_len, &bp, &remain);
++ (void) k5_ser_unpack_len(&cstate_len, &bp, &remain);
+
+ if (cstate_len) {
+ kret = alloc_data(&auth_context->cstate, cstate_len);
+diff --git a/src/lib/krb5/krb/ser_adata.c b/src/lib/krb5/krb/ser_adata.c
+index 2c0094df26e..9a6237f7070 100644
+--- a/src/lib/krb5/krb/ser_adata.c
++++ b/src/lib/krb5/krb/ser_adata.c
+@@ -102,7 +102,7 @@ k5_internalize_authdata(krb5_authdata **argp,
+ krb5_authdata *authdata;
+ krb5_int32 ibuf;
+ krb5_octet *bp;
+- size_t remain;
++ size_t remain, len;
+
+ bp = *buffer;
+ remain = *lenremain;
+@@ -122,14 +122,13 @@ k5_internalize_authdata(krb5_authdata **argp,
+ authdata->ad_type = (krb5_authdatatype) ibuf;
+
+ /* Get the length */
+- (void) krb5_ser_unpack_int32(&ibuf, &bp, &remain);
+- authdata->length = (int) ibuf;
++ (void) k5_ser_unpack_len(&len, &bp, &remain);
++ authdata->length = len;
+
+ /* Get the string */
+- if ((authdata->contents = (krb5_octet *)
+- malloc((size_t) (ibuf))) &&
+- !(kret = krb5_ser_unpack_bytes(authdata->contents,
+- (size_t) ibuf,
++ authdata->contents = malloc(len);
++ if (authdata->contents != NULL &&
++ !(kret = krb5_ser_unpack_bytes(authdata->contents, len,
+ &bp, &remain))) {
+ if ((kret = krb5_ser_unpack_int32(&ibuf, &bp, &remain)))
+ ibuf = 0;
+diff --git a/src/lib/krb5/krb/ser_addr.c b/src/lib/krb5/krb/ser_addr.c
+index 52aa6f2a8f8..ed849b31464 100644
+--- a/src/lib/krb5/krb/ser_addr.c
++++ b/src/lib/krb5/krb/ser_addr.c
+@@ -103,7 +103,7 @@ k5_internalize_address(krb5_address **argp,
+ krb5_address *address;
+ krb5_int32 ibuf;
+ krb5_octet *bp;
+- size_t remain;
++ size_t remain, len;
+
+ bp = *buffer;
+ remain = *lenremain;
+@@ -125,13 +125,13 @@ k5_internalize_address(krb5_address **argp,
+ address->addrtype = (krb5_addrtype) ibuf;
+
+ /* Get the length */
+- (void) krb5_ser_unpack_int32(&ibuf, &bp, &remain);
+- address->length = (int) ibuf;
++ (void) k5_ser_unpack_len(&len, &bp, &remain);
++ address->length = len;
+
+ /* Get the string */
+- if ((address->contents = (krb5_octet *) malloc((size_t) (ibuf))) &&
+- !(kret = krb5_ser_unpack_bytes(address->contents,
+- (size_t) ibuf,
++ address->contents = malloc(len);
++ if (address->contents != NULL &&
++ !(kret = krb5_ser_unpack_bytes(address->contents, len,
+ &bp, &remain))) {
+ /* Get the trailer */
+ if ((kret = krb5_ser_unpack_int32(&ibuf, &bp, &remain)))
+diff --git a/src/lib/krb5/krb/ser_auth.c b/src/lib/krb5/krb/ser_auth.c
+index f835a793b78..27d5d87e728 100644
+--- a/src/lib/krb5/krb/ser_auth.c
++++ b/src/lib/krb5/krb/ser_auth.c
+@@ -168,10 +168,7 @@ k5_internalize_authenticator(krb5_authenticator **argp,
+ krb5_authenticator *authenticator;
+ krb5_int32 ibuf;
+ krb5_octet *bp;
+- size_t remain;
+- int i;
+- krb5_int32 nadata;
+- size_t len;
++ size_t remain, len, i;
+
+ bp = *buffer;
+ remain = *lenremain;
+@@ -224,14 +221,12 @@ k5_internalize_authenticator(krb5_authenticator **argp,
+ }
+
+ /* Attempt to read in the authorization data count */
+- if (!(kret = krb5_ser_unpack_int32(&ibuf, &bp, &remain))) {
+- nadata = ibuf;
+- len = (size_t) (nadata + 1);
+-
++ kret = k5_ser_unpack_len(&len, &bp, &remain);
++ if (!kret) {
+ /* Get memory for the authorization data pointers */
+ if ((authenticator->authorization_data = (krb5_authdata **)
+- calloc(len, sizeof(krb5_authdata *)))) {
+- for (i=0; !kret && (i<nadata); i++) {
++ calloc(len + 1, sizeof(krb5_authdata *)))) {
++ for (i = 0; !kret && i < len; i++) {
+ kret = k5_internalize_authdata(&authenticator->
+ authorization_data[i],
+ &bp, &remain);
+diff --git a/src/lib/krb5/krb/ser_cksum.c b/src/lib/krb5/krb/ser_cksum.c
+index de8cb2b9e0c..3bba753ae6f 100644
+--- a/src/lib/krb5/krb/ser_cksum.c
++++ b/src/lib/krb5/krb/ser_cksum.c
+@@ -103,7 +103,7 @@ k5_internalize_checksum(krb5_checksum **argp,
+ krb5_checksum *checksum;
+ krb5_int32 ibuf;
+ krb5_octet *bp;
+- size_t remain;
++ size_t remain, len;
+
+ bp = *buffer;
+ remain = *lenremain;
+@@ -122,15 +122,13 @@ k5_internalize_checksum(krb5_checksum **argp,
+ checksum->checksum_type = (krb5_cksumtype) ibuf;
+
+ /* Get the length */
+- (void) krb5_ser_unpack_int32(&ibuf, &bp, &remain);
+- checksum->length = (int) ibuf;
++ (void) k5_ser_unpack_len(&len, &bp, &remain);
++ checksum->length = len;
+
+ /* Get the string */
+- if (!ibuf ||
+- ((checksum->contents = (krb5_octet *)
+- malloc((size_t) (ibuf))) &&
+- !(kret = krb5_ser_unpack_bytes(checksum->contents,
+- (size_t) ibuf,
++ if (!len ||
++ ((checksum->contents = malloc(len)) &&
++ !(kret = krb5_ser_unpack_bytes(checksum->contents, len,
+ &bp, &remain)))) {
+
+ /* Get the trailer */
+diff --git a/src/lib/krb5/krb/ser_ctx.c b/src/lib/krb5/krb/ser_ctx.c
+index 5f266a3dfa2..aab1920836f 100644
+--- a/src/lib/krb5/krb/ser_ctx.c
++++ b/src/lib/krb5/krb/ser_ctx.c
+@@ -211,8 +211,7 @@ k5_internalize_context(krb5_context *argp,
+ krb5_context context;
+ krb5_int32 ibuf;
+ krb5_octet *bp;
+- size_t remain;
+- unsigned int i, count;
++ size_t remain, len, count, i;
+
+ bp = *buffer;
+ remain = *lenremain;
+@@ -230,28 +229,29 @@ k5_internalize_context(krb5_context *argp,
+ return (ENOMEM);
+
+ /* Get the size of the default realm */
+- if ((kret = krb5_ser_unpack_int32(&ibuf, &bp, &remain)))
++ kret = k5_ser_unpack_len(&len, &bp, &remain);
++ if (kret)
+ goto cleanup;
+
+- if (ibuf) {
+- context->default_realm = (char *) malloc((size_t) ibuf+1);
++ if (len > 0) {
++ context->default_realm = malloc(len + 1);
+ if (!context->default_realm) {
+ kret = ENOMEM;
+ goto cleanup;
+ }
+
+ kret = krb5_ser_unpack_bytes((krb5_octet *) context->default_realm,
+- (size_t) ibuf, &bp, &remain);
++ len, &bp, &remain);
+ if (kret)
+ goto cleanup;
+
+- context->default_realm[ibuf] = '\0';
++ context->default_realm[len] = '\0';
+ }
+
+ /* Get the tgs_etypes */
+- if ((kret = krb5_ser_unpack_int32(&ibuf, &bp, &remain)))
++ kret = k5_ser_unpack_len(&count, &bp, &remain);
++ if (kret)
+ goto cleanup;
+- count = ibuf;
+ if (count > 0) {
+ context->tgs_etypes = calloc(count + 1, sizeof(krb5_enctype));
+ if (!context->tgs_etypes) {
+diff --git a/src/lib/krb5/krb/ser_key.c b/src/lib/krb5/krb/ser_key.c
+index 7a294d680f2..49526cd62b7 100644
+--- a/src/lib/krb5/krb/ser_key.c
++++ b/src/lib/krb5/krb/ser_key.c
+@@ -99,7 +99,7 @@ k5_internalize_keyblock(krb5_keyblock **argp,
+ krb5_keyblock *keyblock;
+ krb5_int32 ibuf;
+ krb5_octet *bp;
+- size_t remain;
++ size_t remain, len;
+
+ bp = *buffer;
+ remain = *lenremain;
+@@ -118,13 +118,12 @@ k5_internalize_keyblock(krb5_keyblock **argp,
+ keyblock->enctype = (krb5_enctype) ibuf;
+
+ /* Get the length */
+- (void) krb5_ser_unpack_int32(&ibuf, &bp, &remain);
+- keyblock->length = (int) ibuf;
++ (void) k5_ser_unpack_len(&len, &bp, &remain);
++ keyblock->length = len;
+
+ /* Get the string */
+- if ((keyblock->contents = (krb5_octet *) malloc((size_t) (ibuf)))&&
+- !(kret = krb5_ser_unpack_bytes(keyblock->contents,
+- (size_t) ibuf,
++ if ((keyblock->contents = malloc(len)) &&
++ !(kret = krb5_ser_unpack_bytes(keyblock->contents, len,
+ &bp, &remain))) {
+ kret = krb5_ser_unpack_int32(&ibuf, &bp, &remain);
+ if (!kret && (ibuf == KV5M_KEYBLOCK)) {
+diff --git a/src/lib/krb5/krb/ser_princ.c b/src/lib/krb5/krb/ser_princ.c
+index fc564997984..c2f7d7b28e7 100644
+--- a/src/lib/krb5/krb/ser_princ.c
++++ b/src/lib/krb5/krb/ser_princ.c
+@@ -92,7 +92,7 @@ k5_internalize_principal(krb5_principal *argp,
+ krb5_principal principal = NULL;
+ krb5_int32 ibuf;
+ krb5_octet *bp;
+- size_t remain;
++ size_t remain, len;
+ char *tmpname = NULL;
+
+ *argp = NULL;
+@@ -104,15 +104,14 @@ k5_internalize_principal(krb5_principal *argp,
+ return EINVAL;
+
+ /* Read the principal name */
+- kret = krb5_ser_unpack_int32(&ibuf, &bp, &remain);
++ kret = k5_ser_unpack_len(&len, &bp, &remain);
+ if (kret)
+ return kret;
+- tmpname = malloc(ibuf + 1);
+- kret = krb5_ser_unpack_bytes((krb5_octet *) tmpname, (size_t) ibuf,
+- &bp, &remain);
++ tmpname = malloc(len + 1);
++ kret = krb5_ser_unpack_bytes((krb5_octet *) tmpname, len, &bp, &remain);
+ if (kret)
+ goto cleanup;
+- tmpname[ibuf] = '\0';
++ tmpname[len] = '\0';
+
+ /* Parse the name to a principal structure */
+ kret = krb5_parse_name_flags(NULL, tmpname,
+diff --git a/src/lib/krb5/krb/serialize.c b/src/lib/krb5/krb/serialize.c
+index 8934cf1548a..75ec6959157 100644
+--- a/src/lib/krb5/krb/serialize.c
++++ b/src/lib/krb5/krb/serialize.c
+@@ -108,6 +108,24 @@ krb5_ser_unpack_int64(int64_t *intp, krb5_octet **bufp, size_t *remainp)
+ return(ENOMEM);
+ }
+
++/* Unpack a 4-byte integer and verify that it is no larger than the number of
++ * remaining bytes. */
++krb5_error_code
++k5_ser_unpack_len(size_t *len_out, krb5_octet **bufp, size_t *remainp)
++{
++ krb5_error_code ret;
++ int32_t n;
++
++ *len_out = 0;
++ ret = krb5_ser_unpack_int32(&n, bufp, remainp);
++ if (ret)
++ return ret;
++ if (n < 0 || (size_t)n > *remainp)
++ return ENOMEM;
++ *len_out = n;
++ return 0;
++}
++
+ /*
+ * krb5_ser_unpack_bytes() - Unpack a byte string if it's there.
+ */
+diff --git a/src/lib/krb5/libkrb5.exports b/src/lib/krb5/libkrb5.exports
+index 1e7076d3ce2..107e139e255 100644
+--- a/src/lib/krb5/libkrb5.exports
++++ b/src/lib/krb5/libkrb5.exports
+@@ -177,6 +177,7 @@ k5_rc_close
+ k5_rc_get_name
+ k5_rc_resolve
+ k5_rc_store
++k5_ser_unpack_len
+ k5_size_auth_context
+ k5_size_authdata
+ k5_size_authdata_context
+diff --git a/src/plugins/authdata/greet_client/greet.c b/src/plugins/authdata/greet_client/greet.c
+index 2aae2ddd63b..bafff837c63 100644
+--- a/src/plugins/authdata/greet_client/greet.c
++++ b/src/plugins/authdata/greet_client/greet.c
+@@ -319,6 +319,8 @@ greet_internalize(krb5_context kcontext,
+ code = krb5_ser_unpack_int32(&length, &bp, &remain);
+ if (code != 0)
+ return code;
++ if (length < 0 || (size_t)length > remain)
++ return ENOMEM;
+
+ /* Greeting Contents */
+ if (length != 0) {
diff --git a/krb5-spnego-mechlistmic-null-deref.patch b/krb5-spnego-mechlistmic-null-deref.patch
new file mode 100644
index 0000000..cb0a754
--- /dev/null
+++ b/krb5-spnego-mechlistmic-null-deref.patch
@@ -0,0 +1,33 @@
+From 67b499d637014365fb13621285db88e89b8ddafb Mon Sep 17 00:00:00 2001
+From: Jeremy Hitt <jeremy.hitt at isilon.com>
+Date: Fri, 13 Feb 2026 00:58:14 +0000
+Subject: [PATCH] Fix null dereference in SPNEGO token processing
+
+Commit fdceb225f881e2b1337eebcb9a9443fa4a9be3fd erroneously removed a
+check from get_negTokenResp() for successful decoding of the
+mechListMIC field. Restore the check to prevent a null pointer
+dereference.
+
+[ghudson at mit.edu: rewrote commit message]
+
+(cherry picked from commit 4ae75cded0fbeb1def4c82e352759089d80d40ab)
+
+ticket: 9213
+version_fixed: 1.22.3
+---
+ src/lib/gssapi/spnego/spnego_mech.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/lib/gssapi/spnego/spnego_mech.c b/src/lib/gssapi/spnego/spnego_mech.c
+index 4a77836433..1dd0f17065 100644
+--- a/src/lib/gssapi/spnego/spnego_mech.c
++++ b/src/lib/gssapi/spnego/spnego_mech.c
+@@ -3517,6 +3517,8 @@ get_negTokenResp(OM_uint32 *minor_status, struct k5input *in,
+
+ if (k5_der_get_value(&seq, CONTEXT | 0x03, &field)) {
+ *mechListMIC = get_octet_string(&field);
++ if (*mechListMIC == GSS_C_NO_BUFFER)
++ return GSS_S_DEFECTIVE_TOKEN;
+
+ /* Handle Windows 2000 duplicate response token */
+ if (*responseToken &&
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/krb5.git/commitdiff/65677b06b2536c1fc293c13946115adc0692cb25
More information about the pld-cvs-commit
mailing list