From owner-freebsd-security@freebsd.org Tue Aug 24 20:52:55 2021 Return-Path: Delivered-To: freebsd-security@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 9132A660C4D 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 4GvLsg2LHPz4q60; 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=dmi6BPrYg4q+AVU8z0DwTLS3xXNjcbEGM9RN2b80Y/OxCu1Yie8I7RtesGLJl3GpaCWW6j iOlu8Y7Ry+shzcbVJjrwgr82E9ka0A+aSmMuuaHgSKdR/1GsxgKcTmXJ/khEMtatDo0RTY PJMLbCbZVZkdH+8n6PvlKlmfna4TJDJqUcj112RmXz+ZUR5b+c0hXhOvDmcLI9sweJ/SEd YrTX8DfIfdu+B2Kw/YoxTSryNFsI+7eQPAopBSJzl7bPHWNBQZ1F1mMO7BuwVAAIVPnR/P bLkBO4gZnzDmIqfjaRXR3jpTBcAMbwHsnwoY0lg6IopJBhtK8Kt6SpZU1AH2hw== Received: by freefall.freebsd.org (Postfix, from userid 945) id 3056F73E7; 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.3056F73E7@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=H3T8AA3XjV8TERS0Z0HpGPmL6YPXFUKQkIqUoGFPoYRqf5A7pWzvGrbLz2yVYG8i75XZ8N qNvkOQE+yfj9i8UN0DD2aX+bLbwh7fAd9PyuB+AjqcDN3i+26miHQP3KKd+1ZxT5Bbfosy lXpu0bh7muVjEoW2n58RerIF/PG/2KkjHH56OA4EzYfX2L9S1fB38/VBEU4TAVVr/UkTM+ OnquqJJKOZw/DZesdNmec2iK7McoSLfijY8CWu+g7geeHad5g6fje6Bjb9kDggG8l0JRyA jLy1IOWzTJnzj0xSqwsvlnHXA1GpnwAtn6Gx4kkNZAQBRCpqOEcJMz3kcKTuAw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1629838375; a=rsa-sha256; cv=none; b=Gc5vqJgnCwH3i9vnm3K0/0tmY6KXVjzGjOjUQqZWfrTodg3Mj9Zl01VtYsoz4rrn9P1zm8 6Y5dRq7o2APvETOyeYelArl4fcwFXGrCJRHJLgf2Dnwzc6dFY/VTNMInxvObIBLpgeresn oWcwZKaGEW/SoBgdTDymrq25JmdYocpk4RVSLThj3PPuoyHUPTIBfPg/l+16hADsSHQ08I iQ9JX/SDdfYKFVvnoPHhEXrjqDET7vHaNPj7xI2jcLTJVjk/9eKmV65U56UXy/bpytEy+W JV2AM10U/PjexJNyUCuKyCES4DEByIpxvFP7CAk9okKY1yiR5MyATybGJf1vWA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-BeenThere: freebsd-security@freebsd.org X-Mailman-Version: 2.1.34 List-Id: "Security issues \[members-only posting\]" 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-----