From nobody Wed Feb 21 13:43:12 2024 X-Original-To: dev-commits-src-branches@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 4TfyCN6HMKz5CCyX; Wed, 21 Feb 2024 13:43:12 +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 4TfyCN5lZ0z4cfB; Wed, 21 Feb 2024 13:43:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708522992; 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=dW/SaKMAx6lFa4eVnsACqKY+kWL5IygR58J30s/vR2I=; b=VXKOCLmfzVLCEfL4eKcPZMXAHIpnzJSNaZTSNvTSAwNVnLmf+sdkT/kT9N2NdjFSRWJMvG I9rJi36jkBkoIpFp3vLIOOZa/Va2Frg9mVgjTB8JUMT08mFKlEC5XO+ZedXRgRA9bvxara nFPvovqso2n4HrSkBnWz07iMA2q4y2i8ZjK7I/pS66yBR36lLezK9EzXdge2/WAFL5E/Nv w9UTSMbEXw6gzCccwTgdlgPNFOlEYcCqc5mSVE5W4lV0rjbdy7XQdxUE7OQLo+h547j7aQ 28lA4WOC2+uyHWUMynA5TT0azb3+qvNARwt41Al4fXHiAPG3GMSgPOq1Wl3SLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708522992; 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=dW/SaKMAx6lFa4eVnsACqKY+kWL5IygR58J30s/vR2I=; b=VuUxFbqI3UbTeQvlNBCPU16QbjsP0g0BWmRRW2Bw0k3k6JLMhCD+PHH+sD854vv+XsND6V RDzvLrw2WECEaAVBN0a/XQyTqShsPayjdLqb08dwDoM42HHkAJZRaiaqZ/X4ndu+N5LYLu RkinE0RmbvCmQ9wdEmm2MNJnXUH4O9uNL9pwhBIpyV2euGV1bkcTRGLfchMmPORYirRAd/ VUb8kWWYR4QLjXsHIbQT2lwYqcQU6nDsDB9IT4rVgUIDvl/JYRaRt3AxpDfDVWemvfbbGl lyxNLw/+jYXjNede5LfrqQ9wyG8mF5dR2gXqirqWnntHpHk+OoWILh/OgjuqCw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1708522992; a=rsa-sha256; cv=none; b=PKRcnzBqxg7BdNicwzzYcc6Nj+KEwh51JVDrIDr57Fcy98NOBxoTJ5plV6ca8pzEVW0rc8 meRJLEiyy+aI9eRylTAa9SsqfF+1f8wP4oA6Dz2V0xSKF1QCVCdA5WMwizp7PWEVC2l7rl lq3lhyg9BLusf3ZCL7QLl0WqdJSKmlHDdBGEzXrY/8kUzGIw4a1F5Pm117tkjN7pxgWCO3 Updw22wB9slSMNlAxdPAIVSPXkhcVZSJ1/Cm7dWK9P3REfXgGkypCMqLBC2R76fiVjEFi6 fwiJRmPY10HzDxk5sioNwOiADZ4nIBttPE+l22/6tT7AOLIpSji8cFjrAO1SMA== 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 4TfyCN4qLjz14cs; Wed, 21 Feb 2024 13:43:12 +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 41LDhCvi048281; Wed, 21 Feb 2024 13:43:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41LDhCaY048278; Wed, 21 Feb 2024 13:43:12 GMT (envelope-from git) Date: Wed, 21 Feb 2024 13:43:12 GMT Message-Id: <202402211343.41LDhCaY048278@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: 4712696c8f46 - stable/14 - Heimdal: Fix transit path validation CVE-2017-6594 List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/14 X-Git-Reftype: branch X-Git-Commit: 4712696c8f4697b4466407a3e1fa2318f7213eed Auto-Submitted: auto-generated The branch stable/14 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=4712696c8f4697b4466407a3e1fa2318f7213eed commit 4712696c8f4697b4466407a3e1fa2318f7213eed Author: Cy Schubert AuthorDate: 2024-02-14 19:56:18 +0000 Commit: Cy Schubert CommitDate: 2024-02-21 13:42:58 +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,