1From d775c95af7606a51bf79547a94fa52ddd1cb7f49 Mon Sep 17 00:00:00 2001 2From: Greg Hudson <ghudson@mit.edu> 3Date: Tue, 3 Aug 2021 01:15:27 -0400 4Subject: [PATCH] Fix KDC null deref on TGS inner body null server 5 6After the KDC decodes a FAST inner body, it does not check for a null 7server. Prior to commit 39548a5b17bbda9eeb63625a201cfd19b9de1c5b this 8would typically result in an error from krb5_unparse_name(), but with 9the addition of get_local_tgt() it results in a null dereference. Add 10a null check. 11 12Reported by Joseph Sutton of Catalyst. 13 14CVE-2021-37750: 15 16In MIT krb5 releases 1.14 and later, an authenticated attacker can 17cause a null dereference in the KDC by sending a FAST TGS request with 18no server field. 19 20ticket: 9008 (new) 21tags: pullup 22target_version: 1.19-next 23target_version: 1.18-next 24 25[Retrieved from: 26https://github.com/krb5/krb5/commit/d775c95af7606a51bf79547a94fa52ddd1cb7f49] 27Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> 28--- 29 src/kdc/do_tgs_req.c | 5 +++++ 30 1 file changed, 5 insertions(+) 31 32diff --git a/src/kdc/do_tgs_req.c b/src/kdc/do_tgs_req.c 33index 582e497cc9..32dc65fa8e 100644 34--- a/src/kdc/do_tgs_req.c 35+++ b/src/kdc/do_tgs_req.c 36@@ -204,6 +204,11 @@ process_tgs_req(krb5_kdc_req *request, krb5_data *pkt, 37 status = "FIND_FAST"; 38 goto cleanup; 39 } 40+ if (sprinc == NULL) { 41+ status = "NULL_SERVER"; 42+ errcode = KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN; 43+ goto cleanup; 44+ } 45 46 errcode = get_local_tgt(kdc_context, &sprinc->realm, header_server, 47 &local_tgt, &local_tgt_storage, &local_tgt_key); 48