From nobody Wed Feb 21 14:01:53 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Tfycy0Ft3z5CF0N; Wed, 21 Feb 2024 14:01:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Tfycx6ky5z4gbB; Wed, 21 Feb 2024 14:01:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708524113; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AUHeoH+AqH5WVl/rCQaDGoRvZTtBu1MDDU4VzJZ1GyI=; b=wlfoPdLzf4bIoKp76FX9T9y4dvhdQhB1048I9DdfTGXEi7LjOBoiQmHG7B1uNI7dbjiSYA o+tw6WWzSch8tJtIiiafhiKL3JrpJd6XcohjzWkSw2ez1SZnlPI3c1RR+FVKFqn4dCNPX0 NV+CDLzEq/007Bo0fOBJ/DDRHPb3LSjN+1HLbRU/aDebp4palBpnPVbSdBbyiaO+7w/qC9 w9Vau5ye3eD74e90bgxEv9RehmY0RMNulD6y4HpQi9mnmN3pImYrOi9RDlF2GwWxua/vjf 0ujAl+VtFuLia4vJB75QbyX6hdHsSJRxbHaNMtDq5hY+4FqyHZw4b/4ax35BlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708524113; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AUHeoH+AqH5WVl/rCQaDGoRvZTtBu1MDDU4VzJZ1GyI=; b=iKS4hosWawY1auFNvzXuw9oTp0A1aLX3gc2w70pJQaVb97YOwlon3prpFQPfaLB6C4/oLt HhgKi1d7ic9ocZD65GI0ii/Pm0+ROM0qZ1U+zobhjZieoNL2Bqypob5NJ/0XJXAge/SWYL bSHZwjQSXSD9hAaRP0OI+1xVpKNrwLRpFJ8FSUlKp4ukrDuqkuDU9lvLMXTxObKo8eGXwQ CQ6RuYAenWr7U+fGbr2orTSDtJPHGvWFUZQIkr5aOddSiyq4apNpvAbLOtmNMsHuldPUdx hQm40cGl1XlWDwwOq2sDXkR9yUMe4S4sU42LvpdHODD8bhqUH8uUYv0+MqymXQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1708524113; a=rsa-sha256; cv=none; b=CRzuUJfBIkYhdp8VIwbPhQcmkBZ+k7JYt/xYpdCMHPN/e3mM/FO/nHMG+nHbMLObjEPoER FkV7XiuZXK2P5GSgqFIPCRQAnU7uiJuy7T+eTnmS9Bbzx804UoqmLS493/V2/2KpipdPoM /6qF2dxFQZRuTTnAgejYjl+hNP1Gcz+NmQ1MykUF59s9BG928vEv1SvFE9Ljg7Wmg2llwM 7VC/exW45GxE3jG8HgU+NzUVwl6IjyTZ7fabUCNCRks4bqti4lf2/mkqH2Gglf6LNpmWaZ jWsPgjVjQ7bc6S1xa+EAJUSlJRXUHXdamBKtkhNMZyYl6vOX8FaEsCm8hrJXcg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Tfycx5p7gz158T; Wed, 21 Feb 2024 14:01:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 41LE1rwR080196; Wed, 21 Feb 2024 14:01:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41LE1rde080193; Wed, 21 Feb 2024 14:01:53 GMT (envelope-from git) Date: Wed, 21 Feb 2024 14:01:53 GMT Message-Id: <202402211401.41LE1rde080193@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Cy Schubert Subject: git: aac9dda7f844 - releng/13.3 - Heimdal: Fix transit path validation CVE-2017-6594 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.3 X-Git-Reftype: branch X-Git-Commit: aac9dda7f8446c2c3badecb9fa3473ab008ee59b Auto-Submitted: auto-generated The branch releng/13.3 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=aac9dda7f8446c2c3badecb9fa3473ab008ee59b commit aac9dda7f8446c2c3badecb9fa3473ab008ee59b Author: Cy Schubert AuthorDate: 2024-02-14 19:56:18 +0000 Commit: Cy Schubert CommitDate: 2024-02-21 14:01:48 +0000 Heimdal: Fix transit path validation CVE-2017-6594 Apply upstream b1e699103. This fixes a bug introduced by upstream f469fc6 which may in some cases enable bypass of capath policy. Upstream writes in their commit log: 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. Reported by: emaste Security: CVE-2017-6594 Obtained from: upstream b1e699103 MFS requested by: re (cperciva Approved by: re (cperciva) (cherry picked from commit f8041e3628bd70cf5562a9c13eb3d6af8463e720) (cherry picked from commit 9a7121454dc0f68af2687699d5feabf736692fa6) --- crypto/heimdal/kdc/krb5tgs.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/crypto/heimdal/kdc/krb5tgs.c b/crypto/heimdal/kdc/krb5tgs.c index 19d669798830..cde869522e23 100644 --- a/crypto/heimdal/kdc/krb5tgs.c +++ b/crypto/heimdal/kdc/krb5tgs.c @@ -655,8 +655,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; @@ -737,6 +741,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_enctype krbtgt_etype, krb5_principals spp, @@ -798,7 +803,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; @@ -1494,6 +1499,8 @@ tgs_build_reply(krb5_context context, krb5_keyblock sessionkey; krb5_kvno kvno; krb5_data rspac; + const char *tgt_realm = /* Realm of TGT issuer */ + krb5_principal_get_realm(context, krbtgt->entry.principal); hdb_entry_ex *krbtgt_out = NULL; @@ -2240,6 +2247,7 @@ server_lookup: spn, client, cp, + tgt_realm, krbtgt_out, krbtgt_etype, spp,