From nobody Wed Feb 21 13:44:19 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 4TfyDh0rSSz5CCyk; Wed, 21 Feb 2024 13:44:20 +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 4TfyDh0HGbz4dcB; Wed, 21 Feb 2024 13:44:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708523060; 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=q6STD5yAN0Fvr/MnVsSowGXLjF6mt2UwpTlMfM9S0zs=; b=AHv5od/OMelFnI2cTfp5r++hM6FMwvvDubLzocdZap4PAdnT90atSawVjXZ/uJ8xuHJPlZ +KxlBEyJajkXX0NqtQRcfLq9fomzE2rZq1ykcMboFfW6T6rYElX/3rz0nr9UdPycccOF5u +aVj3BbTDlbc9di6Lvb0paboJqneDwJRb4maOa0cy+izaYb8Tw243fedRkZDUaOG8qyZ76 leI5ObcaZbtlKEis9KxD+0k6/y/ISiyit6xtiREcbBG2AAOKslYLLIGAtpBZjYRwJlv39r Ghhmiv11VMjKhheiyM1BYKAHfqYk1z3TZPrJLPE09Qb2/ZkwfS1vqxww1iPLNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708523060; 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=q6STD5yAN0Fvr/MnVsSowGXLjF6mt2UwpTlMfM9S0zs=; b=AjlkI1CJBqoAtaLwIDoV25pQV61rRcqknImj6hSNeLvGL9bt0NenzNggw8pCmoATUaxxT0 vts2ay4/spXR+fxz4i0zcvOVTMF4XBMqYsBooYgoSh2rOyEGL4eYNm9ZXEPAXVlJAkRXy2 Rjlz4+I83+DkcnR4GTjfsTROfk0WzvKI+OPSJ7yyIVpNYmuKErnf+zxxotN7TuCiDcghi8 +VsFag9+QPiM3kOljNkRg/28ePWc+Iivwu/Jynfr/V1Nr7j+FOzQD8uxQYKKZDUtJeRgqr xpQt5w53NYH05hdKXrdb7J1P0IeC8ApoBpdyrSH8uN5jdyepx+gi/Fvo7mIEfw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1708523060; a=rsa-sha256; cv=none; b=AIHj8XaOr6OtEWlgV24GY2w2D5QxkgNdtKawJLd8btSgs2up9COuVzqG/i7JISgx00f9w4 1TBCoXImG9uhQiSc7wqdDBnNCqbVHe+v17JjzOImsTt3AKhfCW1opjL8FJ+l2WFv6LxZpo WZ2t3V8anetu6e+NsuCZs4IM3CflH4MHpte9v0SEU0dwUNhLViTgRzVo24O3JVhQ+68ogA BMT9+hxZ2UBT+YUIyPxyTBIUl8/vCrY+G+Bbnr/e5tcOR/6kO+F7b4rBAhk5V9ePNAp4pX M9NDegAkGh8Cqj92FyRD5rF5Nem0OLHXmiusi+82bp0hlIwnG1gqqmc6DkfI1A== 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 4TfyDg6Spqz14L4; Wed, 21 Feb 2024 13:44:19 +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 41LDiJh6048752; Wed, 21 Feb 2024 13:44:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41LDiJSG048749; Wed, 21 Feb 2024 13:44:19 GMT (envelope-from git) Date: Wed, 21 Feb 2024 13:44:19 GMT Message-Id: <202402211344.41LDiJSG048749@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: 9a7121454dc0 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 9a7121454dc0f68af2687699d5feabf736692fa6 Auto-Submitted: auto-generated The branch stable/13 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=9a7121454dc0f68af2687699d5feabf736692fa6 commit 9a7121454dc0f68af2687699d5feabf736692fa6 Author: Cy Schubert AuthorDate: 2024-02-14 19:56:18 +0000 Commit: Cy Schubert CommitDate: 2024-02-21 13:44:08 +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 (cherry picked from commit f8041e3628bd70cf5562a9c13eb3d6af8463e720) --- 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,