From owner-freebsd-security-notifications@freebsd.org Tue Apr 6 20:23:11 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 3BB7F5B8181 for ; Tue, 6 Apr 2021 20:23:11 +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 4FFJqy3GNnz4m9G; Tue, 6 Apr 2021 20:23:10 +0000 (UTC) (envelope-from security-advisories@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1617740591; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc; bh=3ugHiNMDVx1sSnq6LrSNw2DTv2SsgliYgpqOioa/rI0=; b=JXfY8cGzwAkqgOLjPMzMcG8nau5jly+WjGJZM3u673y9IXxJZWTXwJCqQr+82La/emjo+P Vk1YIlXQKp8hWxsGgvfp5pzLtDrxbWmHaee6UHWCK0qnANiDn5k1UWGHvCavGmGcoOV8sI WnBQLaUdFcIdPMgabL+/ZwS5dBcg5YXdmBcln38pAmOQJ6SYTyE5d6R505YmT/cU5UL4bs h1MQ+coyLV9LCr/yzdZQJqE9TYWUfUwFEcLmBMsVNdqSi+fqoLw9FTYvP7KbfsAUMKjAE+ ZamykyRrphSYeuHYgCogWPhbPlbsA8ZdcjxcvblxgKVNtbfrhk8HD50wrMRENQ== Received: by freefall.freebsd.org (Postfix, from userid 945) id 00FF315EA9; Tue, 6 Apr 2021 20:23:09 +0000 (UTC) From: FreeBSD Security Advisories To: FreeBSD Security Advisories Subject: FreeBSD Security Advisory FreeBSD-SA-21:10.jail_mount Reply-To: freebsd-security@freebsd.org Precedence: bulk Message-Id: <20210406202310.00FF315EA9@freefall.freebsd.org> Date: Tue, 6 Apr 2021 20:23:09 +0000 (UTC) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1617740590; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc; bh=3ugHiNMDVx1sSnq6LrSNw2DTv2SsgliYgpqOioa/rI0=; b=yqVl5IGpN7Tf8l90CwpzfUxKtlmYh58oNg8HrhTYKgVYLaAluGaEENp7hIDgmcDTNNklfa ka26cscPnRK5iDReLx3lxkxIH8YxUGmYRmxqrA90HFPEidULmZWCLEoO8zwMArkT1VuWbQ 87XRYlHdc3wyB0mHD7ClztfTSVt1yCS1X5InAhfWj6pmfZsZ1jiBo4m5NKQMLjTiz7S90R 5VgzGqUnYjSnToPAqc7BoJznBVaeLlb0jhKoD0USB39kh4srw3885YmN4l54xXl4EHuMRl pEZ/6MTAEKPqLOl31pOroLSloKE0lXWnAskRQWbanMjt/B8v/bu/839hBLggdQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1617740590; a=rsa-sha256; cv=none; b=w/8pruc/QblPRUuKidNCT2LzuhOeew/NyQf+lftWJH6U6K+X3REyV91WU/x/X4xjiFQlY9 AG+yixdk3vWB8dGwHUgvv+V24ijxPM5+672x/GjGwlXEh+J+qVjULE/bnmH759cVw+jNWg lGtM/w5ApqFG3lq6BMURP/TEt40JkUB5R3xtsXK+Bbga94g6rHwbqzZeK1Aa3TG/u7txvb VOwpiwRdSr5G6HYCS00QB6d3fJbCXBfE160TawHS/WvLPDUY5rCMmh8TwkKeA3FVM4aRyo vHOOMOOqt73QcdkY+BwTx1DlG/bDr0ppE/ylj4JdsAwNSRi+hfW4gi29Z/EIJw== 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, 06 Apr 2021 20:23:11 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 ============================================================================= FreeBSD-SA-21:10.jail_mount Security Advisory The FreeBSD Project Topic: jail escape possible by mounting over jail root Category: core Module: jail Announced: 2021-04-06 Credits: Mateusz Guzik Affects: All supported versions of FreeBSD. Corrected: 2021-04-06 18:50:48 UTC (stable/13, 13.0-STABLE) 2021-04-06 19:18:59 UTC (releng/13.0, 13.0-RC5-p1) 2021-04-06 19:20:50 UTC (stable/12, 12.2-STABLE) 2021-04-06 19:21:33 UTC (releng/12.2, 12.2-RELEASE-p6) 2021-04-06 19:22:31 UTC (stable/11, 11.4-STABLE) 2021-04-06 19:22:59 UTC (releng/11.4, 11.4-RELEASE-p9) CVE Name: CVE-2020-25584 For general information regarding FreeBSD Security Advisories, including descriptions of the fields above, security branches, and the following sections, please visit . I. Background The jail(2) system call allows a system administrator to lock a process and all of its descendants inside an environment with a very limited ability to affect the system outside that environment, even for processes with superuser privileges. It is an extension of, but far more powerful than, the traditional UNIX chroot(2) system call. II. Problem Description Due to a race condition between lookup of ".." and remounting a filesystem, a process running inside a jail might access filesystem hierarchy outside of jail. III. Impact A process with superuser privileges running inside a jail configured with the allow.mount permission (not enabled by default) could change the root directory outside of the jail, and thus gain full read and write access to all files and directories in the system. IV. Workaround As a workaround, disable allow.mount permission for all jails with untrusted root users; see jail(1) and jail.conf(5) manual pages for details. Note that this permission is not enabled by default. V. Solution Upgrade your vulnerable system to a supported FreeBSD stable or release / security branch (releng) dated after the correction date and reboot. 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 # shutdown -r +10min "Rebooting for a security update" 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.0] # fetch https://security.FreeBSD.org/patches/SA-21:10/jail_mount.13.patch # fetch https://security.FreeBSD.org/patches/SA-21:10/jail_mount.13.patch.asc # gpg --verify jail_mount.13.patch.asc [FreeBSD 12.2] # fetch https://security.FreeBSD.org/patches/SA-21:10/jail_mount.12.patch # fetch https://security.FreeBSD.org/patches/SA-21:10/jail_mount.12.patch.asc # gpg --verify jail_mount.12.patch.asc [FreeBSD 11.4] # fetch https://security.FreeBSD.org/patches/SA-21:10/jail_mount.11.patch # fetch https://security.FreeBSD.org/patches/SA-21:10/jail_mount.11.patch.asc # gpg --verify jail_mount.11.patch.asc b) Apply the patch. Execute the following commands as root: # cd /usr/src # patch < /path/to/patch c) Recompile your kernel as described in and reboot the system. VI. Correction details The following list contains the correction revision numbers for each affected branch. Branch/path Hash Revision - ------------------------------------------------------------------------- stable/13/ 3ae17faa3704 stable/13-n245118 releng/13.0/ 4710439ec594 releng/13.0-n244729 stable/12/ r369552 releng/12.2/ r369557 stable/11/ r369560 releng/11.4/ r369562 - ------------------------------------------------------------------------- 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 HHHHHH 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/A6HiuWv54gCjWNV05eS9J6n5cIFAmBsveQACgkQ05eS9J6n 5cIujRAAoTOIB1bMhDN3w382izu+g4L4HATqhOyKlf3Ezwlnmckt4s+ERar7EWND 4MayXSogCYwYwb6gsfBsqEdAJwhID1zkBDmC9LaYKehOLMMdPOCbpemJ3xT0540m S4MJ+vPBT2NZ8NsUGNNpIF/mZTgwDai4WSBCr/0OIyNDd+nzStOv0d8h3aNGNweW p/pvETnf/FtR9kACZ2HuiHtOx2IvQv8+n4gjefl440fz8czb3nftdGHRXLc0Kkcy T/l3Y0SgBvXmlhtmhGZmF787Bw/5No+fbKZ4AuTMms42OWz8y02ZjFCvwXEu7/tC f9eeFUzpR+rjNr0MMFEm1GBPNgbdF4v/IhnUA4gWrhjp1sh+4SjHoFhS1tfdY6gf W76eyT0B8oDOLK4Jo76iTjvN1sZ0wctOaq7yk+7rGbhSUFUohQmtsMbvGOfHIVxl DlJ9faccWJLOjbeUAVhVMbowT3/QKqnbuRpkq6U7YIcs9P4cg8RUrokCOiGd5pBz PD5zpNcRCe69c+d39XDGDiBjPm4mQK1VEOr90gcAlE5yioxUW6qlHkFrp/Mje6dX 25Sb1q1zwjn3rM1moIeRXmx+ioLAT9ZWpYs5IvKsuRw4VmppIjA6TWm8ECbjKQKG yPuUgUyxoIoEJgQNmJaM2Rk/fKijyVjEG22jlDNwCxASE4vJ7Xw= =g2On -----END PGP SIGNATURE-----