From owner-freebsd-security-notifications@freebsd.org Tue Aug 24 20:52:55 2021 Return-Path: Delivered-To: freebsd-security-notifications@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EA494660B4D for ; Tue, 24 Aug 2021 20:52:55 +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 4GvLsg4461z4qBK; Tue, 24 Aug 2021 20:52:55 +0000 (UTC) (envelope-from security-advisories@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1629838375; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc; bh=4r+fQaaFty7OGmza4TJMaS9bbuKqMtBhMVkkYfwB4MI=; b=hvPBmi4KuGLo/9ikd7buj5tx5yB9643AQcTPNSI+66qOTzw92HHkXO1gELNNTtQ96GTFIB 7jgjdRPFYglP5PNPkVhA08mOsn+giL2wwg4TegLGBl3JASpIIaWnL6Hf4p/HVk3goTF6nP 2vj+lotKlGjgNBofM0tlyvOeha0Z4jdYho3n3M7yz5ghIAANV1xJPrE5qRQxwLb2OtLMgt Y5TMRd2/JUzMU6zbFdrJGswNYsOPyoxw0DsZOtEjhrX8RqX6y2UTjGVsbFQGH88g4gkwok /zECQ1lxs8gHEcZVNkyRPzEIjjem3aM4penPUGfRLX7/58B5usV/zHoxKLjeYg== Received: by freefall.freebsd.org (Postfix, from userid 945) id 3895474BF; Tue, 24 Aug 2021 20:52:55 +0000 (UTC) From: FreeBSD Security Advisories To: FreeBSD Security Advisories Subject: FreeBSD Security Advisory FreeBSD-SA-21:15.libfetch Reply-To: freebsd-security@freebsd.org Precedence: bulk Message-Id: <20210824205255.3895474BF@freefall.freebsd.org> Date: Tue, 24 Aug 2021 20:52:55 +0000 (UTC) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1629838375; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc; bh=4r+fQaaFty7OGmza4TJMaS9bbuKqMtBhMVkkYfwB4MI=; b=qwrDeYURVYTcNHilibDUFdPT7o3xtqutBJGF98t8I+34E9EDbcWz+0lW66I5vEOeFjeBVH oUa/xM/ODoImkyrNktZgP4znj93Z2OxMrS6SmeHLa04iaAUeAtRXwRUfr2zmY3xLnIhFpq YTqWhxSlCMe2C35tYor4OD9gz4znoFYSmQb7+QWlmEu1MtO09M1Ltx+wTGOVd2ZGziDwTb aRIzYnZ8ZKMdtG5qHtFAf7ntWNxyz/egPddIYteXJgM67/QSAYiiR3DnRiq6lqRNcl+8IA /zIMoJoESBFjDbv3EJk8bsn4fEMfgzGdhTqlEIR1pE3U34iuRdTBYLy83d9rEA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1629838375; a=rsa-sha256; cv=none; b=F1wlHdaK1tBYaiUb1dKzv89CTxIP5Nbphxbnsd5WhDMaO75IYPWhsTQmvleuYW83luNTdy cGjAAV21cHkD8v4sY4U6W5bCwm8Hr0H+ZYOqUCnNIJiT7m4MV+vwsksuv7Cgvyx0EGjVJc 440we3p2HFhjdpbgmHr8MkN14uatRVJwtFERo0HAd+qxeX70eIfdRXMq/oTS6s74srX1Eq SbpF+dm4t2t15MX97HyalPmZXbtalUGIkxcXi3EpzD+hXA0jlSbF3MJj+/xfsWrrZjg1fn UafF8WZZpQVu7y0nBl8v3U6G5iWBMh8h0Q/Bokax2tOiOe8v6jkaNkQAbHt91w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-BeenThere: freebsd-security-notifications@freebsd.org X-Mailman-Version: 2.1.34 List-Id: "Moderated Security Notifications \[moderated, low volume\]" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Aug 2021 20:52:56 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 ============================================================================= FreeBSD-SA-21:15.libfetch Security Advisory The FreeBSD Project Topic: libfetch out of bounds read Category: core Module: libfetch Announced: 2021-08-24 Credits: Samanta Navarro Affects: All supported versions of FreeBSD. Corrected: 2021-08-24 17:59:43 UTC (stable/13, 13.0-STABLE) 2021-08-24 18:00:47 UTC (releng/13.0, 13.0-RELEASE-p4) 2021-08-24 18:30:16 UTC (stable/12, 12.2-STABLE) 2021-08-24 18:32:17 UTC (releng/12.2, 12.2-RELEASE-p10) 2021-08-24 18:29:40 UTC (stable/11, 11.4-STABLE) 2021-08-24 18:31:31 UTC (releng/11.4, 11.4-RELEASE-p13) CVE Name: CVE-2021-36159 For general information regarding FreeBSD Security Advisories, including descriptions of the fields above, security branches, and the following sections, please visit . I. Background libfetch(3) is a multi-protocol file transfer library included with FreeBSD and used by the fetch(1) command-line tool, pkg(8) package manager, and others. II. Problem Description The passive mode in FTP communication allows an out of boundary read while libfetch uses strtol to parse the relevant numbers into address bytes. It does not check if the line ends prematurely. If it does, the for-loop condition checks for *p == '\0' one byte too late because p++ was already performed. III. Impact The connection buffer size can be controlled by a malicious FTP server because the size is increased until a newline is encountered (or no more characters are read). This also allows to move the buffer into more interesting areas within the address space, potentially parsing relevant numbers for the attacker. Since these bytes become available to the server in form of a new TCP connection to a constructed port number or even part of the IPv6 address this is a potential information leak. IV. Workaround No workaround is available. 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-21:15/libfetch.patch # fetch https://security.FreeBSD.org/patches/SA-21:15/libfetch.patch.asc # gpg --verify libfetch.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 . 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/ a75324d674f5 stable/13-n246939 releng/13.0/ 060510ba8bfb releng/13.0-n244758 stable/12/ r370384 releng/12.2/ r370395 stable/11/ r370382 releng/11.4/ r370388 - ------------------------------------------------------------------------- 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----- iQIzBAEBCgAdFiEE/A6HiuWv54gCjWNV05eS9J6n5cIFAmElV14ACgkQ05eS9J6n 5cJpVBAApBRBKwxTpmLfH+JJP8JwDwpop407/A54uPFRXzl7ri6D0wlvlHgMb70T OPnD2pco3gI56GOvRLipnbtrkGZJT0ijsXHMqMK+3O44yoMP8BMNOZauPUVia6FW 6P0aLXqjiJDYZ8N2k+MnnsXQFJKvFt/Vv0D7aHOUettfgyx5YIQX2urjB/hGZIfM 93VMRCsLruixIRgsL6Jt2PvS004HxqJOsaNMg6unp0JWa/vrcCcr4AMzJmu+k0lg /XtUpNBWdClKSYvDFikNrCz9x8ae6V9wosz5gfeKL+1tctBMxhrMLwBEaWtB7YIc 4Vu9+ZsGRLBpapEE8aLRyApY1xFP0xcDutf1G/tuuz5zK8gObaTrxTcRm6fbyf8C ejspPabgM3lgKrWjGiI0T3WzYPWJKTZqtGEAtyMAutjpv9+N/p0YEDsCWkvG/zlt BZ+TbT33oL2N1odzLBNOlJkiR2LQnTcjBgci+jqCVx7CdnYmV2laGF1kIttBCcRN TOJoOJ1pbK1UXqek77+cCSeTKrlocU6oH3+1W68oLeWtemvzCTxlxLsT/pU/TetC 2fibVyN9P1PMI0VbaktjSN8HX8QWtr1u5kp2AIZPmq5RqL+S7+o90GVFr5f41D7M QjHGddO+DG77lGyd+KC7zMuG6p8OcDBkdy9Tc0aTVW4JPhnIeyA= =QN3R -----END PGP SIGNATURE-----