summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorViktor Dukhovni <viktor@twosigma.com>2016-08-10 23:31:14 +0000
committerStefan Metzmacher <metze@samba.org>2021-10-20 10:58:37 +0000
commit7e961f3f7a815960ae25377d5b7515184d439690 (patch)
treeeb826ad869314ed70a9495884aff42fefa4b083d /source4
parent83a654a4efd39a6e792a6d49e0ecf586e9bc53ef (diff)
downloadsamba-7e961f3f7a815960ae25377d5b7515184d439690.tar.gz
HEIMDAL:kdc: Fix transit path validation CVE-2017-6594
Commit f469fc6 (2010-10-02) inadvertently caused the previous hop realm to not be added to the transit path of issued tickets. This may, in some cases, enable bypass of capath policy in Heimdal versions 1.5 through 7.2. Note, this may break sites that rely on the bug. With the bug some incomplete [capaths] worked, that should not have. These may now break authentication in some cross-realm configurations. (similar to heimdal commit b1e699103f08d6a0ca46a122193c9da65f6cf837) BUG: https://bugzilla.samba.org/show_bug.cgi?id=12998 Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Wed Oct 20 10:58:37 UTC 2021 on sn-devel-184
Diffstat (limited to 'source4')
-rw-r--r--source4/heimdal/kdc/krb5tgs.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/source4/heimdal/kdc/krb5tgs.c b/source4/heimdal/kdc/krb5tgs.c
index 2de3b099199..7e9379db64a 100644
--- a/source4/heimdal/kdc/krb5tgs.c
+++ b/source4/heimdal/kdc/krb5tgs.c
@@ -409,8 +409,12 @@ fix_transited_encoding(krb5_context context,
"Decoding transited encoding");
return ret;
}
+
+ /*
+ * If the realm of the presented tgt is neither the client nor the server
+ * realm, it is a transit realm and must be added to transited set.
+ */
if(strcmp(client_realm, tgt_realm) && strcmp(server_realm, tgt_realm)) {
- /* not us, so add the previous realm to transited set */
if (num_realms + 1 > UINT_MAX/sizeof(*realms)) {
ret = ERANGE;
goto free_realms;
@@ -492,6 +496,7 @@ tgs_make_reply(krb5_context context,
const char *server_name,
hdb_entry_ex *client,
krb5_principal client_principal,
+ const char *tgt_realm,
hdb_entry_ex *krbtgt,
krb5_pac mspac,
uint16_t rodc_id,
@@ -553,7 +558,7 @@ tgs_make_reply(krb5_context context,
&tgt->transited, &et,
krb5_principal_get_realm(context, client_principal),
krb5_principal_get_realm(context, server->entry.principal),
- krb5_principal_get_realm(context, krbtgt->entry.principal));
+ tgt_realm);
if(ret)
goto out;
@@ -1292,13 +1297,14 @@ tgs_build_reply(krb5_context context,
HDB *clientdb, *s4u2self_impersonated_clientdb;
krb5_realm ref_realm = NULL;
EncTicketPart *tgt = &ticket->ticket;
+ const char *tgt_realm = /* Realm of TGT issuer */
+ krb5_principal_get_realm(context, krbtgt->entry.principal);
const EncryptionKey *ekey;
krb5_keyblock sessionkey;
krb5_kvno kvno;
krb5_pac mspac = NULL;
uint16_t rodc_id;
krb5_boolean add_ticket_sig = FALSE;
-
hdb_entry_ex *krbtgt_out = NULL;
METHOD_DATA enc_pa_data;
@@ -2036,6 +2042,7 @@ server_lookup:
spn,
client,
cp,
+ tgt_realm,
krbtgt_out,
mspac,
rodc_id,