From nobody Thu Feb 15 21:30:35 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 4TbSsR4Xmfz5BHGy; Thu, 15 Feb 2024 21:30:35 +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 4TbSsR3yjDz4SQM; Thu, 15 Feb 2024 21:30:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708032635; 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=SdQZCR3x40C7tkvC3XH2ill+wLRb9gnYRxIhgvN08zM=; b=Ct9/k2S/zDWzVJG1cFYpoRuiS7pimr8QpJGFTUGhUOAEvlvFHQQX5YMYwDQmA+A+ac96I4 /zycxbmsOeBJgtXmvZYrMhpp2gvmzied2Do0qBnT50zj+pNTZCKXCSqfsg8xS8sX+mV7FR c/99ZNwVVHwYet1/oHqggdj9+ZqjSdqt/yUnNWXSmI/V92wBWSlOzzviMUNg44qfe7eNXd DOkYFsopi/GQSDYkLWVUFtaFyRZWOwYslrPzKuDgPkhs/g6bOE+bHHQG6Is8RFVdMOXsJX ZnHoVsi1J0/BOvGB9UxphJQwmcF9wNfm4UnyDmTZKCILULDY5oe0CgTb3tIlCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708032635; 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=SdQZCR3x40C7tkvC3XH2ill+wLRb9gnYRxIhgvN08zM=; b=AyiOjY4qr/JaF0hDPDoj4+lj7IFctarmrUR/+ERFj7WheOmajfDw0tn6dKMXqL+JNVqgtl P5Rkz76cBZh5da7iHYnnMMm+W+EVGlv64kLxYyb9NH7t5qCrjKZyDSdJu3c1cQr5BDw9we Ts5Y8fKa1NuV7ChW05usIdVS4GCULS6/LBDHe1lXHBHfTCF+AW/D5Y5UOM+R10C9rqlupc +GetJF3I3aksJPaAaqGFECCiYIps015sgi5GJtorG0nbqqTZgFnhuww93ueJYfhLkBJIkA v4XAqyC8tQP0FMEYY45AvJHn+dv5vzcHWcIaM1TINTGikwPZVT2kkpAnFmMCQA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1708032635; a=rsa-sha256; cv=none; b=lDP8ViTOxO7tk8/H8tvVjpKQ4iLr3ytzquIkwKnIqc8yWWKDyIxZ3VgED2PGT3LxG8YSBI 13+9WkHB/JNhV6QzA2bIF3pMOrKFiP0mJoMXWj1t+z6B+VDqGSh7UGfvh5ex3qZTaQ9Z1/ 9EnQ4asrFqrnhLzBkWv2J5g6M18E3pNaH25gkU438zg9o5y00ntDH9mEeZfAcLEeJJlByU AqY8MgzElJVkKGagSu7F0cNx/1KUEV1YqftZ4T7htWTWjfZrGzXNnQljK4iRxhjVwa+sXO GUi8kCWmqgMyebwuyG7tW22p6w3SDLi79jiL0g7wTssS3cSHNAta4ekZNtABBg== 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 4TbSsR2kPJzyC5; Thu, 15 Feb 2024 21:30:35 +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 41FLUZo4063476; Thu, 15 Feb 2024 21:30:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41FLUZJA063473; Thu, 15 Feb 2024 21:30:35 GMT (envelope-from git) Date: Thu, 15 Feb 2024 21:30:35 GMT Message-Id: <202402152130.41FLUZJA063473@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: 24339377490f - main - Heimdal: CVE-2018-16860 Heimdal KDC: Reject PA-S4U2Self with unkeyed checksum 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/main X-Git-Reftype: branch X-Git-Commit: 24339377490f9e362d040712b534d2963decd2d7 Auto-Submitted: auto-generated The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=24339377490f9e362d040712b534d2963decd2d7 commit 24339377490f9e362d040712b534d2963decd2d7 Author: Cy Schubert AuthorDate: 2024-02-14 20:04:30 +0000 Commit: Cy Schubert CommitDate: 2024-02-15 21:27:54 +0000 Heimdal: CVE-2018-16860 Heimdal KDC: Reject PA-S4U2Self with unkeyed checksum Upstream's explanation of the problem: S4U2Self is an extension to Kerberos used in Active Directory to allow a service to request a kerberos ticket to itself from the Kerberos Key Distribution Center (KDC) for a non-Kerberos authenticated user (principal in Kerboros parlance). This is useful to allow internal code paths to be standardized around Kerberos. S4U2Proxy (constrained-delegation) is an extension of this mechanism allowing this impersonation to a second service over the network. It allows a privileged server that obtained a S4U2Self ticket to itself to then assert the identity of that principal to a second service and present itself as that principal to get services from the second service. There is a flaw in Samba's AD DC in the Heimdal KDC. When the Heimdal KDC checks the checksum that is placed on the S4U2Self packet by the server to protect the requested principal against modification, it does not confirm that the checksum algorithm that protects the user name (principal) in the request is keyed. This allows a man-in-the-middle attacker who can intercept the request to the KDC to modify the packet by replacing the user name (principal) in the request with any desired user name (principal) that exists in the KDC and replace the checksum protecting that name with a CRC32 checksum (which requires no prior knowledge to compute). This would allow a S4U2Self ticket requested on behalf of user name (principal) user@EXAMPLE.COM to any service to be changed to a S4U2Self ticket with a user name (principal) of Administrator@EXAMPLE.COM. This ticket would then contain the PAC of the modified user name (principal). Reported by: emaste Security: CVE-2018-16860 Obtained from: Upstream c6257cc2c MFC after: 1 week --- crypto/heimdal/kdc/krb5tgs.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crypto/heimdal/kdc/krb5tgs.c b/crypto/heimdal/kdc/krb5tgs.c index cde869522e23..cf1cd3dc1ad0 100644 --- a/crypto/heimdal/kdc/krb5tgs.c +++ b/crypto/heimdal/kdc/krb5tgs.c @@ -1892,6 +1892,13 @@ server_lookup: goto out; } + if (!krb5_checksum_is_keyed(context, self.cksum.cksumtype)) { + free_PA_S4U2Self(&self); + kdc_log(context, config, 0, "Reject PA-S4U2Self with unkeyed checksum"); + ret = KRB5KRB_AP_ERR_INAPP_CKSUM; + goto out; + } + ret = _krb5_s4u2self_to_checksumdata(context, &self, &datack); if (ret) goto out;