Blame SOURCES/Fix-KDC-null-deref-on-TGS-inner-body-null-server.patch

f8ec8b
From 0a8dfc380fe3b210662ba1b1d452fcec2f84841b Mon Sep 17 00:00:00 2001
f8ec8b
From: Greg Hudson <ghudson@mit.edu>
f8ec8b
Date: Tue, 3 Aug 2021 01:15:27 -0400
f8ec8b
Subject: [PATCH] Fix KDC null deref on TGS inner body null server
f8ec8b
f8ec8b
After the KDC decodes a FAST inner body, it does not check for a null
f8ec8b
server.  Prior to commit 39548a5b17bbda9eeb63625a201cfd19b9de1c5b this
f8ec8b
would typically result in an error from krb5_unparse_name(), but with
f8ec8b
the addition of get_local_tgt() it results in a null dereference.  Add
f8ec8b
a null check.
f8ec8b
f8ec8b
Reported by Joseph Sutton of Catalyst.
f8ec8b
f8ec8b
CVE-2021-37750:
f8ec8b
f8ec8b
In MIT krb5 releases 1.14 and later, an authenticated attacker can
f8ec8b
cause a null dereference in the KDC by sending a FAST TGS request with
f8ec8b
no server field.
f8ec8b
f8ec8b
ticket: 9008 (new)
f8ec8b
tags: pullup
f8ec8b
target_version: 1.19-next
f8ec8b
target_version: 1.18-next
f8ec8b
f8ec8b
(cherry picked from commit d775c95af7606a51bf79547a94fa52ddd1cb7f49)
f8ec8b
(cherry picked from commit bb8fa495d00ccd931eec87a01b8920636cf7903e)
f8ec8b
(cherry picked from commit dfe383f8251d0edc7e5e08ec5e4fdd9b7f902b2a)
f8ec8b
---
f8ec8b
 src/kdc/do_tgs_req.c | 5 +++++
f8ec8b
 1 file changed, 5 insertions(+)
f8ec8b
f8ec8b
diff --git a/src/kdc/do_tgs_req.c b/src/kdc/do_tgs_req.c
f8ec8b
index 463a9c0dd..7c596a111 100644
f8ec8b
--- a/src/kdc/do_tgs_req.c
f8ec8b
+++ b/src/kdc/do_tgs_req.c
f8ec8b
@@ -208,6 +208,11 @@ process_tgs_req(krb5_kdc_req *request, krb5_data *pkt,
f8ec8b
         status = "FIND_FAST";
f8ec8b
         goto cleanup;
f8ec8b
     }
f8ec8b
+    if (sprinc == NULL) {
f8ec8b
+        status = "NULL_SERVER";
f8ec8b
+        errcode = KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN;
f8ec8b
+        goto cleanup;
f8ec8b
+    }
f8ec8b
 
f8ec8b
     errcode = get_local_tgt(kdc_context, &sprinc->realm, header_server,
f8ec8b
                             &local_tgt, &local_tgt_storage, &local_tgt_key);