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

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