From nobody Thu Feb 15 21:30:34 2024 X-Original-To: dev-commits-src-main@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 4TbSsQ3sqkz5BHXQ; Thu, 15 Feb 2024 21:30:34 +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 4TbSsQ2d9nz4Sjg; Thu, 15 Feb 2024 21:30:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708032634; 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=mpMuPGssXV7JWsR/yrhrwce2tDP+Ehb+Whzc+mKNl4U=; b=i5TU/dqJ6mT2gUDaos/ITYlg00iDEvSfjhppNfraaJj1dwRt/NJUpyScsanGBlmzEWFoKo 1lo3SWh/mZtnJb0GFWbzH6+FETGt7LcUVfUi3rUCyXnf0yMmxQV4QweAvWjlUey+oeXNeP 9qIX9osAZgFk+Mp1LigfKKrhk2iqAX9a0b2HCyCCGl/wRKm5OLe2y0mHmQ5jmRme5dR+Xb qS84C6eCZd2h/6IPbr+hxE8pzNMshR6zMjEYcZwz3tWo+3iCUgVy1o0batetdDKV/tpvB+ EIwVpjhKoOQ+I/SliqE7qXGgcf0RAQbenZxc5/jSL9bTGpTFPE7TeXMwbUO2SQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708032634; 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=mpMuPGssXV7JWsR/yrhrwce2tDP+Ehb+Whzc+mKNl4U=; b=Uq4QE605bolp8uTZ1z3LrOaQL5tlJ6Rbqr5lQqMw/nAjIEQDlp/B6AsuEUU8ccFrnJqsaA Ui9DmQTXyiQuATkibenIH4Dg1ohRniOYUM1A+vw9rfN0oZl+GSnOPdVyGpcJwWwHaJbAcy SgqdtysIPiiDJxWpwC4pqspuDHEIZ9Zq3s8EcplsJkRI/xzaShO2hBcplrBCWikSy31YA7 wZ85x8ytFKm9dakBPGEpXU93vh95q8Lh7iE+MNfqSkr7nWkYXKuAdFzhxgauD0fx1J2FrB TVGOiWWVK8XLRSB0tyWBVXjBx4ofVtZqzV/yUca/Ja8BFFMGZB9raHz1owyjzA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1708032634; a=rsa-sha256; cv=none; b=RIoqxphPRpTrR86A0eq43mm3mqYtTovubGzJ39REXI/jyT7C9eyY/I2pLbr+tspgjEUsxX Z+4QgO0WddXztYKqVq2LZGZZZu7/Xex7z2SUMoi3TWthxGt3ZumBGfLyRIYSnWHRsf+kVC DYiLS99rotE7Ki5SjWlaclTsN6EcsyZXffu0/iwiZ5YhCxYy/XBYy72YlmkxEES4jAqvdM oDesBvFA3xTyRJeCCv/YC+5/bKcbZw8xePDaH0dj0atK42peXr9YDfORThuk7dRooaxzLB Mr1wASfGX2HXOSC5DByuh6thZlOzPRfd+8+uiMnJxBGvjB83rXhTQD5dPmVKVg== 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 4TbSsQ1hSczy3V; Thu, 15 Feb 2024 21:30:34 +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 41FLUYIf063422; Thu, 15 Feb 2024 21:30:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41FLUYfZ063419; Thu, 15 Feb 2024 21:30:34 GMT (envelope-from git) Date: Thu, 15 Feb 2024 21:30:34 GMT Message-Id: <202402152130.41FLUYfZ063419@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cy Schubert Subject: git: f8041e3628bd - main - Heimdal: Fix transit path validation CVE-2017-6594 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: f8041e3628bd70cf5562a9c13eb3d6af8463e720 Auto-Submitted: auto-generated The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=f8041e3628bd70cf5562a9c13eb3d6af8463e720 commit f8041e3628bd70cf5562a9c13eb3d6af8463e720 Author: Cy Schubert AuthorDate: 2024-02-14 19:56:18 +0000 Commit: Cy Schubert CommitDate: 2024-02-15 21:27:54 +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 MFC after: 1 week --- 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,