From nobody Wed Jun 21 06:22:11 2023 X-Original-To: freebsd-security@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 4QmD1b6fqGz4g8Xh for ; Wed, 21 Jun 2023 06:22:11 +0000 (UTC) (envelope-from security-advisories@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (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 "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QmD1b5TxGz3y5b; Wed, 21 Jun 2023 06:22:11 +0000 (UTC) (envelope-from security-advisories@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687328531; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc; bh=1uaIyn1QCyqBytQlvv2FAhcvVk2hFacet16Z6NqMGso=; b=COEUuBWtNz6rqg1HdpDNV2GolboT6B8ThvIen1r7htBcA69k7gPF+39Tx+RsE6kKlVNQMJ ONa0OyJIeGd8ypNOv6vc8hfu3t83GlSxp4tme4h3qZAPyog7qHncLLg5W40XOnD5eWIRYH TiFHFuFA9gZil0+pyNeJ85DjmkdA3WKG46Y7sIlCZ33Sst+IFXQkGmQgg5ajTU5G09pfmg vh0P/db1zW4F2MKVICFjG/ZZTjULWEkqrCGsF6snoMzSbxcaPs0/jBx7a2nogqfcONRzRX qPJXs2cZiP1DmT991N343UGrx86x/YBtA8GbLmGN/nCWMFQaB+FVvCbSu1iACw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687328531; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc; bh=1uaIyn1QCyqBytQlvv2FAhcvVk2hFacet16Z6NqMGso=; b=P66nNXK+Op6EXVWb4ibRnfnJxE/zPwYS81LYtYbB1hKMAqNjCtE6sJqHGsUEK4eV72zQw+ N8YJGaGdtVCkNRXLc8UGVuJAVzF75ls5xcHgj0Oa57E2QHLpzCpJ94qdArxBgRd6w+Blfk 75ughGV1ErOPxL+WB2AGtEy4UDY7mXsicjndYodBNVbqEDdaqsxCV1cSxU6MLimi5IGLW0 h6rHGNdUzWQ5PVCP3R7SY/FoJb5gRqHLYFXbDCGxw+u/aJEiEHn1bFiwF37uGx9Bk08uhs /KqI/5isQOiZh75afs6LRJzQwuBjCjuCZUTWSnShlG+Npd1hhE/+0UXz7jBhRQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1687328531; a=rsa-sha256; cv=none; b=uSz+2oGeHQqiVwI9a4wxiybTwwOFUiOxr+a+BoiXoeZGxnkNtzTkJgIeZumgkqWqPrErCN /V1z6XjdBo4+D9LGJoAxTGEX93ghvFk7FqpFM8H1ZMBcqFgL6IFJHKUnzhIxvK9g+1t0ZZ wIfZjXn8eddUjJ2wIn2odh5ljlK5+H0hq7hNaGxGi2vm8euTdhc6vllmd6W1MXLOaT/KK0 04SEBEUtP+MwW4EhMa3iMkbt657SzE+80LbE+UA1dGdYcKwEIU+dHN6wPVBdEv/HTa4rmW yILMi2WAq4rVQDK9lraqJb2Nlx6jWp9iFM5yYfBoA40r7TsVHiKWNSib/WcQ9w== Received: by freefall.freebsd.org (Postfix, from userid 945) id A80B3EE52; Wed, 21 Jun 2023 06:22:11 +0000 (UTC) From: FreeBSD Security Advisories To: FreeBSD Security Advisories Subject: FreeBSD Security Advisory FreeBSD-SA-23:04.pam_krb5 Reply-To: freebsd-security@freebsd.org Precedence: bulk Message-Id: <20230621062211.A80B3EE52@freefall.freebsd.org> Date: Wed, 21 Jun 2023 06:22:11 +0000 (UTC) X-ThisMailContainsUnwantedMimeParts: N List-Id: Security issues List-Archive: https://lists.freebsd.org/archives/freebsd-security List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-security@freebsd.org X-BeenThere: freebsd-security@freebsd.org -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 ============================================================================= FreeBSD-SA-23:04.pam_krb5 Security Advisory The FreeBSD Project Topic: Network authentication attack via pam_krb5 Category: core Module: pam_krb5 Announced: 2023-06-21 Credits: Taylor R Campbell Affects: All supported versions of FreeBSD Corrected: 2023-06-21 05:25:18 UTC (stable/13, 13.2-STABLE) 2023-06-21 05:27:12 UTC (releng/13.2, 13.2-RELEASE-p1) 2023-06-21 05:27:22 UTC (releng/13.1, 13.1-RELEASE-p8) 2023-06-21 05:27:27 UTC (stable/12, 12.4-STABLE) 2023-06-21 05:43:39 UTC (releng/12.4, 12.4-RELEASE-p3) CVE Name: CVE-2023-3326 For general information regarding FreeBSD Security Advisories, including descriptions of the fields above, security branches, and the following sections, please visit . I. Background Kerberos 5 (krb5) is a computer-network authentication protocol that works on the basis of tickets to allow nodes communicating over a non-secure network to prove their identity to one another in a secure manner. The PAM (Pluggable Authentication Modules) library provides a flexible framework for user authentication and session setup / teardown. pam_krb5 is a PAM module that allows using a Kerberos password to authenticate the user. pam_krb5 is disabled in the default FreeBSD installation. pam_krb5 uses passwords for authentication, which is distinct from Kerberos native protocols like GSSAPI, which allows for login without the exchange of passwords. GSSAPI is not affected by this issue. II. Problem Description pam_krb5 authenticates the user by essentially running kinit(1) with the password, getting a `ticket-granting ticket' (tgt) from the Kerberos KDC (Key Distribution Center) over the network, as a way to verify the password. Normally, the system running the pam_krb5 module will also have a keytab, a key provisioned by the KDC. The pam_krb5 module will use the tgt to get a service ticket and validate it against the keytab, ensuring the tgt is valid and therefore, the password is valid. However, if a keytab is not provisioned on the system, pam_krb5 has no way to validate the response from the KDC, and essentially trusts the tgt provided over the network as being valid. III. Impact In a non-default FreeBSD installation that leverages pam_krb5 for authentication and does not have a keytab provisioned, an attacker that is able to control both the password and the KDC responses can return a valid tgt, allowing authentication to occur for any user on the system. IV. Workaround If you are not using Kerberos at all, ensure /etc/krb5.conf is missing from your system. Additionally, ensure pam_krb5 is commented out of your PAM configuration located as documented in pam.conf(5), generally /etc/pam.d. Note, the default FreeBSD PAM configuration has pam_krb5 commented out. If you are using Kerberos, but not using pam_krb5, ensure pam_krb5 is commented out of your PAM configuration located as documented in pam.conf(5), generally /etc/pam.d. Note, the default FreeBSD PAM configuration has pam_krb5 commented out. If you are using pam_krb5, ensure you have a keytab on your system as provided by your Kerberos administrator. V. Solution Upgrade your vulnerable system to a supported FreeBSD stable or release / security branch (releng) dated after the correction date. Perform one of the following: 1) To update your vulnerable system via a binary patch: Systems running a RELEASE version of FreeBSD on the amd64, i386, or (on FreeBSD 13 and later) arm64 platforms can be updated via the freebsd-update(8) utility: # freebsd-update fetch # freebsd-update install 2) To update your vulnerable system via a source code patch: The following patches have been verified to apply to the applicable FreeBSD release branches. a) Download the relevant patch from the location below, and verify the detached PGP signature using your PGP utility. # fetch https://security.FreeBSD.org/patches/SA-23:04/pam_krb5.patch # fetch https://security.FreeBSD.org/patches/SA-23:04/pam_krb5.patch.asc # gpg --verify pam_krb5.patch.asc b) Apply the patch. Execute the following commands as root: # cd /usr/src # patch < /path/to/patch c) Recompile the operating system using buildworld and installworld as described in . Restart all daemons that use the PAM module, or reboot the system. VI. Correction details This issue is corrected by the corresponding Git commit hash or Subversion revision number in the following stable and release branches: Branch/path Hash Revision - ------------------------------------------------------------------------- stable/13/ 6322a6c9daaa stable/13-n255613 releng/13.2/ 58d21e3e8e56 releng/13.2-n254620 releng/13.1/ 07e3f54f2ea1 releng/13.1-n250186 stable/12/ r373100 releng/12.4/ r373103 - ------------------------------------------------------------------------- For FreeBSD 13 and later: Run the following command to see which files were modified by a particular commit: # git show --stat Or visit the following URL, replacing NNNNNN with the hash: To determine the commit count in a working tree (for comparison against nNNNNNN in the table above), run: # git rev-list --count --first-parent HEAD For FreeBSD 12 and earlier: Run the following command to see which files were modified by a particular revision, replacing NNNNNN with the revision number: # svn diff -cNNNNNN --summarize svn://svn.freebsd.org/base Or visit the following URL, replacing NNNNNN with the revision number: VII. References The latest revision of this advisory is available at -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEthUnfoEIffdcgYM7bljekB8AGu8FAmSSkl0ACgkQbljekB8A Gu/7pxAA5piBa4nYH+o+h2zGENXpWnKfGXpbWvxA1y9GCEhVAyq0xNK1voVbeLxO j0JriahVImk+JjYgbuFSqQ44viRVUssIn2+tCT/rzWxjCYOAN7E5tHHuomzBtM6O JSyeTT5Hk58iOjseTxCOy+FkLZ1daHyUiEGxURAJGf/KLg532xnYAgoXli48JBdA 3QwQ/q6hUEYS2KJpV3s8EI2oss2SI8+SW+5YjtPCHrs5JhVvRo4803Gwgxexu8Hv ZO8oBb+R0+C9Q30ediAmHTrWdb1/ir5T/4kE/dOYNo3yeHBkpb5hqXEiAareFMhP LvgFOFg8tNR6BEO3brRkgITvcLQOq48JSQlB1/ROE2+abSS0W1wEFlm/vyWen6as 0lMJYcO3+eTlKRkJ8fJyUZFntKk8s+ys8wNYYMoUr2AK89JvxtvIrL4kfZJ2SyHw OwRCXpDx+rT4EXrspDsU3ya9mlT/+GVvMDD0J7eRpY8T+TKhp9P5VtofYAidw+tP GafiRcuj8YLuHGTKlRQtmy3tE9jXsZ2p/R9bBt94ARPG0K/iJA7uR5gFs8PLXfpA GxIGJwif6jFEFUXg5pufwTDmW0g4BNL7rWzO2l7ZDxE7tdgSH0qr4D376VyI385d mzjiGNJZ07ng8R5MAXUDeqsZA1RvG5BV3toJawMzessvf55R1EI= =YOWz -----END PGP SIGNATURE-----