From nobody Tue Aug 01 21:38:15 2023 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 4RFpPz0ycwz4psSd for ; Tue, 1 Aug 2023 21:38:17 +0000 (UTC) (envelope-from security-advisories@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (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 4RFpPh4myrz3Nty; Tue, 1 Aug 2023 21:38:16 +0000 (UTC) (envelope-from security-advisories@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1690925896; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc; bh=EvJV/k5pchuM+8dL8rwzBZd47FwpBIwrG+Cr/w5yndo=; b=JVR6vKx9hQmpmWv3H5AMKQNfmNVq/hQnXX8YZTEJRD19CAPizIOwvBm9ijtnSrDHvvVUpv Van+n4jdUi0W3SdLhFSmuP7uSrX8xEppdBvYGrBBoZLyCE8s6p0QNACx8zJ7YBhG5T82mU WuRAvRCBGFD8UDv5cBZ/cTrip/s5TRy8vVxcvomo/q6LkBQkTxj4gDDCmd7iGEPBmgL4XU xIQuNp8Oscv+YJIppS7QK4jHEhq6G+utpk/Ff8N085Q2vazHAZGAWKkH1yBNQSnjhcU/vw VAp+l5XX/cbWyHqj+UMm7HQThvnc3jQdcJVZQWXgTIMFgGKoq9gLoKJNw+3uug== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1690925896; a=rsa-sha256; cv=none; b=EuYLmkIe8KkUC33UksOcn/+Jw/vmraIgS8do49hpTCi5o8bogW8ztbz/jlxDyj+bi8tgM4 Is++mL1T++A6uayKms+9t8DCSmECCR1vYdcpZTAU5BBSge2hY+gxELKL6WXZi66AsJBHlt n1iSaKK3PZaUFOYSEjgmC2daFlFXNrXnRVnceycS3j1yHZd3bl9SnE9WLKMtcCi3dzM7GM iW08lpxoGb0Zz1u8OFf/UOrkwYlSaZ18ye3TnVunnW2cuViwwm/UJwbxfsEwcrHXEXtwM4 5RwlErZOamNfpatqe9ueTjSawQfDwqGXFd3WzsinFiDwPXKeR9MAqZlkAVr+gg== 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=1690925896; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc; bh=EvJV/k5pchuM+8dL8rwzBZd47FwpBIwrG+Cr/w5yndo=; b=epSRae+lUV8u4h1d2MBUPLRTiBTMeHn0t7VpE0chXuVKD5aRAvpjYHYHirjTK19SuGo1KZ uwzv/o89+uUxQGg9TsgdgQNoa3W78v26ZxLQcrQLRQGuyUGse6o73uKvjzEA30VStWAbQo GhuBP9yZZacToGqChjMUAWON4xFt80TF2aE0NVkzyD/1uif8ltDxdKeTVO3oAX7YeZoIQm yz23uI9AOVxF8+FL0jLlctbdhrAM2Bo+XeTtjwLDkPh40a5cWUjwUrbt7Zx3t9YRJmnqiz /RWyKwXX9zXDKiNtY6QqdbGABo6OfS89fGk96kj7oxHdv+Uo9yB3R7BIebem1A== Received: by freefall.freebsd.org (Postfix, from userid 945) id C579219E32; Tue, 1 Aug 2023 21:38:15 +0000 (UTC) From: FreeBSD Security Advisories To: FreeBSD Security Advisories Subject: FreeBSD Security Advisory FreeBSD-SA-23:08.ssh Reply-To: freebsd-security@freebsd.org Precedence: bulk Message-Id: <20230801213815.C579219E32@freefall.freebsd.org> Date: Tue, 1 Aug 2023 21:38:15 +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: Sender: owner-freebsd-security-notifications@freebsd.org X-BeenThere: freebsd-security-notifications@freebsd.org -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 ============================================================================= FreeBSD-SA-23:08.ssh Security Advisory The FreeBSD Project Topic: Potential remote code execution via ssh-agent forwarding Category: contrib Module: OpenSSH Announced: 2023-08-01 Credits: Qualys Affects: All supported versions of FreeBSD. Corrected: 2023-07-21 14:41:41 UTC (stable/13, 13.2-STABLE) 2023-08-01 19:50:47 UTC (releng/13.2, 13.2-RELEASE-p2) 2023-08-01 19:48:26 UTC (releng/13.1, 13.1-RELEASE-p9) 2023-07-21 16:25:51 UTC (stable/12, 12.4-STABLE) 2023-08-01 19:47:00 UTC (releng/12.4, 12.4-RELEASE-p4) CVE Name: CVE-2023-38408 For general information regarding FreeBSD Security Advisories, including descriptions of the fields above, security branches, and the following sections, please visit . I. Background ssh-agent is a program to hold private keys used for OpenSSH public key authentication. Connections to ssh-agent may be forwarded from further remote hosts using the -A option to ssh. The server to which the ssh-agent connection is forwarded may cause the ssh-agent process to load (and unload) operating system-provided shared libraries to support the addition and deletion of PKCS#11 keys. II. Problem Description The server may cause ssh-agent to load shared libraries other than those required for PKCS#11 support. These shared libraries may have side effects that occur on load and unload (dlopen and dlclose). III. Impact An attacker with access to a server that accepts a forwarded ssh-agent connection may be able to execute code on the machine running ssh-agent. Note that the attack relies on properties of operating system-provided libraries. This has been demonstrated on other operating systems; it is unknown whether this attack is possible using the libraries provided by a FreeBSD installation. IV. Workaround Avoid using ssh-agent forwarding, or start ssh-agent with an empty PKCS#11/FIDO allowlist (ssh-agent -P '') or by configuring an allowlist that contains only specific provider libraries. V. Solution Upgrade your vulnerable system to a supported FreeBSD stable or release / security branch (releng) dated after the correction date and restart any ssh sessions using ssh-agent forwarding. 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. [FreeBSD 13.2] # fetch https://security.FreeBSD.org/patches/SA-23:08/ssh.13.2.patch # fetch https://security.FreeBSD.org/patches/SA-23:08/ssh.13.2.patch.asc # gpg --verify ssh.13.2.patch.asc [FreeBSD 13.1] # fetch https://security.FreeBSD.org/patches/SA-23:08/ssh.13.1.patch # fetch https://security.FreeBSD.org/patches/SA-23:08/ssh.13.1.patch.asc # gpg --verify ssh.13.1.patch.asc [FreeBSD 12.4] # fetch https://security.FreeBSD.org/patches/SA-23:08/ssh.12.4.patch # fetch https://security.FreeBSD.org/patches/SA-23:08/ssh.12.4.patch.asc # gpg --verify ssh.12.4.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 ssh sessions that use ssh-agent forwarding, or reboot. 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/ d578a19e2cd3 stable/13-n255848 releng/13.2/ 20bcfc33d3f2 releng/13.2-n254624 releng/13.1/ 3d3a1cbfd7a2 releng/13.1-n250189 stable/12/ r373142 releng/12.4/ r373151 - ------------------------------------------------------------------------- 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----- iQIzBAEBCgAdFiEEthUnfoEIffdcgYM7bljekB8AGu8FAmTJdsUACgkQbljekB8A Gu9M3A//ftE38dmRBx//0dm0sY6Pb++OprS7SKkm/dPlv2ywFMrUOZJl47pcfEuJ h+jeHOMWzQJYwSQBxPii/PbJRbxd4w4c0pjLDKXO3fc74anmuLQh7b8DLip6jQ/S C4LM11e0lGfxwJmrQl49r8eKkm4ta+TOn+IoSzGzsYUYkpqX3jpBuP/yhFvueXO7 9ZaXCIsg99/tZvXU34b4ZA5t3vVjkAhtbV9HSAza0RnM4ZFJnXJoZbheVMgp63qp yg2pieDnA5U/c1exC8joRQoiyXtSZjmq2+8e4HYXc9+LZvWr+/fyfBXO6BXn4hmU KSB6t2aldvB0ywWEbge+mM9I+h0jPKHNo/HsAwwF4gKfLqzZ1XNLnHC+LVTTe0cD lNHw6kBgH9qx4oLBXg8fZwxtPGv5qvSjC4qisDWi/BMDeVsTfr8wa+LoKHIp0KOH AnhuNKs1/TYpyHZfa2l7OfvSc70jSGYyG6Flcr5lYrhfDnXEFR6En4qbRLjIS6GA +8otM6AyuLLiwfaLdha2G9scuA/RUfyixB7AAhrFrxJPBQypC/kIi+lF0TKmEx69 Q2TlWktN/zzHzPJLafor5g9W9dft2Kt4T8hHsmQVwwwN58l3Q49FSrKAib5Agv66 1QuQDP5hhsq7VISG81ZzMZbgvhNgCM5EPjggZ65Qrk9/NCyWhOw= =scNH -----END PGP SIGNATURE-----