From nobody Mon Jul 1 08:58:40 2024 X-Original-To: freebsd-security-notifications@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 4WCKhc27RJz5Pfy7 for ; Mon, 01 Jul 2024 08:58:40 +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 4WCKhc1fPkz5615; Mon, 1 Jul 2024 08:58:40 +0000 (UTC) (envelope-from security-advisories@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1719824320; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc; bh=XM+yGdhbBRRmcUUAPeJufqrOY4S6WBLi2SSOKjq/aMA=; b=mS+ma+2oZlxLlBpluw5NuHewF+qCtEzWsgGYmdRSLoMwzLTJzj8tU/1sYO2et7/V5qmKj5 rXl782zZe6fOsBOp2qasFk4scDFSkS2ZAEa6ufXka/CHINc7ms1XStDosSDt8hcjmfTJn6 4+v0Z2PgclpdKol4M6ueisUgjM+jAdFYi9q+A/QV8KgQf27ek2F7roVCG3kFfzs2TELbBY VcyAnckSv8T9ffiBGhOzt7Hqnh6l2jh8GyV8V5veabeGKEgGqIwiuKJmEXopllkilmHpk4 PqcckEZTogOYV11rfWWXbavI2AjRkj0t0tVtby8Nd2S7EtLBvhArAbk/De3KRw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1719824320; a=rsa-sha256; cv=none; b=vUHn9QRlOSjHh/b64hTNZt3UNtJekGsX/S5AbdChmpqQw+IAfdMCXB419ewKBwxRm53DN0 5iH9UqsqdBXhg1zRHUfXh9YpUDovgzaCr+es9zDM27w8Atg3cXFnJ//bBAGIRJHKBPwVNL 7Zl2Cjl+RWV05tuWcYUobuj0nd2+VPFfRFOCTsXvTy0EZh+LLt+jdwMakqgvDvx6j8zofO lrPZB1n9ms7Gz+YATj8xPZ3Yt/JZI+2TJV/MiLPYstAKN3hkhqDv1Vd1aOWY3PzG2O7rjf pUj6B7+1sP40XXMTRUN6lmXhgmrJ1qtB+ZeBYvoqzzD+ot1rKHn0Cy93/rf5NQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1719824320; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc; bh=XM+yGdhbBRRmcUUAPeJufqrOY4S6WBLi2SSOKjq/aMA=; b=nF794cIYFhNh3aq1aaSnS2NsvrhiAYP/IrdXCyVsVfmCRR4ocoZvyqWUlMpKhWEjXU8mLv Y+Woha82lLR3nSUr6/5eOn2HSabrGcLq7Jy2r52rJeqhB96tekpc9nqh/OrVmabe6e+fRs btx3LOFROwoEMcRF9iZlzYTQ2ok3zQg+3xhL3OOzbY3ppSyyRB+vWe+R4qxn1N3TIIBY3y mfNsBhxLQw2t5Z3N23sx7vP1w0d9K1S2kxbM6Rbqr0tD/QiwbdpIta4pcgndwdy+2Xw1fM QruAT5JivNfjpG7Ev6jtrawnGz6BEggWpE6o2daHrll1q/r6TlmGOAYrZ6FTeQ== Received: by freefall.freebsd.org (Postfix, from userid 945) id 14AB4BCE; Mon, 01 Jul 2024 08:58:40 +0000 (UTC) From: FreeBSD Security Advisories To: FreeBSD Security Advisories Subject: FreeBSD Security Advisory FreeBSD-SA-24:04.openssh Reply-To: freebsd-security@freebsd.org Precedence: bulk Message-Id: <20240701085840.14AB4BCE@freefall.freebsd.org> Date: Mon, 01 Jul 2024 08:58:40 +0000 (UTC) List-Id: Moderated Security Notifications [moderated, low volume] List-Archive: https://lists.freebsd.org/archives/freebsd-security-notifications List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: freebsd-security-notifications@freebsd.org Sender: owner-freebsd-security-notifications@FreeBSD.org -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 ============================================================================= FreeBSD-SA-24:04.openssh Security Advisory The FreeBSD Project Topic: OpenSSH pre-authentication remote code execution Category: contrib Module: openssh Announced: 2024-07-01 Credits: Qualys Threat Research Unit (TRU) Affects: All supported versions of FreeBSD. Corrected: 2024-07-01 08:22:13 UTC (stable/14, 14.1-STABLE) 2024-07-01 08:24:48 UTC (releng/14.1, 14.1-RELEASE-p2) 2024-07-01 08:26:05 UTC (releng/14.0, 14.0-RELEASE-p8) 2024-07-01 08:23:16 UTC (stable/13, 13.3-STABLE) 2024-07-01 08:27:10 UTC (releng/13.3, 13.3-RELEASE-p4) 2024-07-01 08:27:53 UTC (releng/13.2, 13.2-RELEASE-p12) CVE Name: CVE-2024-6387 Note: Due to the fact this advisory is being released the day after 13.2-RELEASE is going out of support, the Security Team has decided to include 13.2-RELEASE in the response for this issue. For general information regarding FreeBSD Security Advisories, including descriptions of the fields above, security branches, and the following sections, please visit . I. Background OpenSSH is an implementation of the SSH protocol suite, providing an encrypted and authenticated transport for a variety of services, including remote shell access. II. Problem Description A signal handler in sshd(8) calls a function that is not async-signal-safe. The signal handler is invoked when a client does not authenticate within the LoginGraceTime seconds (120 by default). This signal handler executes in the context of the sshd(8)'s privileged code, which is not sandboxed and runs with full root privileges. This issue is a regression of CVE-2006-5051 originally reported by Mark Dowd and accidentally reintroduced in OpenSSH 8.5p1. III. Impact As a result of calling functions that are not async-signal-safe in the privileged sshd(8) context, a race condition exists that a determined attacker may be able to exploit to allow an unauthenticated remote code execution as root. IV. Workaround If sshd(8) cannot be updated, this signal handler race condition can be mitigated by setting LoginGraceTime to 0 in /etc/ssh/sshd_config and restarting sshd(8). This makes sshd(8) vulnerable to a denial of service (the exhaustion of all MaxStartups connections), but makes it safe from the remote code execution presented in this advisory. 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 or arm64 platforms, or the i386 platform on FreeBSD 13, can be updated via the freebsd-update(8) utility: # freebsd-update fetch # freebsd-update install # service sshd restart 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. [FreeBSD 14.1] # fetch https://security.FreeBSD.org/patches/SA-24:04/openssh-14.1.patch # fetch https://security.FreeBSD.org/patches/SA-24:04/openssh-14.1.patch.asc # gpg --verify openssh-14.1.patch.asc [FreeBSD 14.0] # fetch https://security.FreeBSD.org/patches/SA-24:04/openssh-14.0.patch # fetch https://security.FreeBSD.org/patches/SA-24:04/openssh-14.0.patch.asc # gpg --verify openssh-14.0.patch.asc [FreeBSD 13.3] # fetch https://security.FreeBSD.org/patches/SA-24:04/openssh-13.3.patch # fetch https://security.FreeBSD.org/patches/SA-24:04/openssh-13.3.patch.asc # gpg --verify openssh-13.3.patch.asc [FreeBSD 13.2] # fetch https://security.FreeBSD.org/patches/SA-24:04/openssh-13.2.patch # fetch https://security.FreeBSD.org/patches/SA-24:04/openssh-13.2.patch.asc # gpg --verify openssh-13.2.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 the applicable daemons, or reboot the system. VI. Correction details This issue is corrected as of the corresponding Git commit hash in the following stable and release branches: Branch/path Hash Revision - ------------------------------------------------------------------------- stable/14/ 620a6a54bb7b stable/14-n268045 releng/14.1/ 8f80def8aa08 releng/14.1-n267683 releng/14.0/ 70eb00f17b31 releng/14.0-n265420 stable/13/ 25cf430cd551 stable/13-n258037 releng/13.3/ e3e0912f2977 releng/13.3-n257437 releng/13.2/ 99ad94894edf releng/13.2-n254666 - ------------------------------------------------------------------------- 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 VII. References The latest revision of this advisory is available at -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEthUnfoEIffdcgYM7bljekB8AGu8FAmaCa5QACgkQbljekB8A Gu8E9hAA2tYE3vcgDNMnsy9Rw5CR8uJWkCAPk4Pd1RvJlYlCFmC4XASukA6DHdv5 Zym13OwC7wO3ak4u819y052Iia7fOCzkdg/MWODvao3v8BOjXcOZjtSCgCsh50Om NNStF5Bhl4l7FwggZqYgo5+6XafjzjU4NbdiCH4Y4qN8VkQwCoHLozfl7X6/XwyE 0LRCL9IzS2lpoqsMvOBOYkS1U1/arEsjWrY0XrDtA30r1zGkkZQ2DKLPWhxGM2wR /ImPpWiINxfVq0u55ubZCm9g3JqnXJVBQ41wo44wdW4R98WabvqQgKDLfxwMlhTc rKlg/JARehrYpPC1d0+PN2RaQUkAucjlxSFjnb3UOt0o0w3FqWB03u9IB7Q7PFya O7S4+WNyEJZiex9Ef1C/ea3ewfx9AMfaWYj+t2yYZjy5oXgZHk4EpoWsOqNDgmC7 bOlFMPeMoxczXkjqiCmsrODho3w8oEo/I111ovo8Sc6tS+13/Tioy9ZSrgdpIVrV DGItqasOXmVaHdatkY/DJ6f2buWlpZ3GTadAB5R+sixe/t3s583jV1Hktjb5NY4M N8y+TEpf5wf/yn9Z/Ub52JQPQDy1qAwICjWPpdYXligYFMV2vy4XZCptnldttz3y gz+2coOund99MGmxpyAm6NVtpVvVpRfjeVFbcqmzxF+35qXsl8w= =Zcol -----END PGP SIGNATURE-----