From owner-freebsd-security@freebsd.org Thu Jan 30 13:22:42 2020 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 255F0239A56 for ; Thu, 30 Jan 2020 13:22:42 +0000 (UTC) (envelope-from gjb@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 487gy971v6z46vC; Thu, 30 Jan 2020 13:22:41 +0000 (UTC) (envelope-from gjb@freebsd.org) Received: from FreeBSD.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id 923E31A668; Thu, 30 Jan 2020 13:22:41 +0000 (UTC) (envelope-from gjb@freebsd.org) Date: Thu, 30 Jan 2020 13:22:39 +0000 From: Glen Barber To: Nathan Dorfman Cc: freebsd-security@freebsd.org Subject: Re: Cryptographic signatures of installer sets Message-ID: <20200130132239.GG9584@FreeBSD.org> References: <20200125200007.GA11@rtfm.net> <20200127164201.GB9584@FreeBSD.org> <20200130005006.GA13@e398a4ce8009> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Xzd0sUmZITcBHKTf" Content-Disposition: inline In-Reply-To: <20200130005006.GA13@e398a4ce8009> X-BeenThere: freebsd-security@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Security issues \[members-only posting\]" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jan 2020 13:22:42 -0000 --Xzd0sUmZITcBHKTf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Nathan, On Thu, Jan 30, 2020 at 12:50:06AM +0000, Nathan Dorfman wrote: > On Mon, Jan 27, 2020 at 04:42:01PM +0000, Glen Barber wrote: > > No, this last part is not true. The installer always verifies the > > checksums against /usr/freebsd-dist/MANIFEST on the installation medium. > >=20 > > In particular, this was done in r293223, where the LOCAL_DISTRIBUTIONS > > variable explicitly contains the MANIFEST. >=20 > Thank you, Glen. You're correct of course; the installer uses its > embedded MANIFEST and doesn't even fetch it from the mirror... during > system installation, at least. >=20 > However, the first time a jail is set up, using the `bsdinstall jail` > command, it does in fact fetch and trust the mirror's MANIFEST. I just > tested this with a freshly installed 12.1-RELEASE system and a local > mirror with a modified base.txz and manifest. It installs the modified > files into the new jail without any complaint. >=20 > Simply, after a clean installation /usr/freebsd-dist doesn't exist on > the new system, so the jail script creates it and downloads the MANIFEST > from the mirror. See lines 60-70, here: >=20 > https://svnweb.freebsd.org/base/release/12.1.0/usr.sbin/bsdinstall/script= s/jail?view=3Dmarkup#l60 >=20 > After the first jail, this downloaded manifest and package(s) are saved > in /usr/freebsd-dist. So you are only at risk the first time, and there > will be some evidence of the tampering. Still, I hope you'll agree that > this should be fixed. The installer already has a trusted manifest as > you point out, why not simply install that one into the target system's > /usr/freebsd-dist at setup time? >=20 I honestly wasn't aware there was a jail subcommand to bsdinstall. I think, rather than creating /usr/freebsd-dist on the host system, we should instead check if the misc/freebsd-release-manifests package is installed and bail if it does not. This package contains the MANIFEST files from past releases (and in-progress releases, including BETA and RC builds). Does that seem like a reasonable solution? Glen --Xzd0sUmZITcBHKTf Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEjRJAPC5sqwhs9k2jAxRYpUeP4pMFAl4y2JoACgkQAxRYpUeP 4pNgIw/+L0cnf3PJEak7dm8nXqp8F8em/cNDnTCSoXGqHP14esvjn3w45pOsw0f8 bgBEKauvzRGZ/rurUINUEHtkjCml4VGkXHybbD+Qihg/ZQbyzaioQFAIjGaiO7Sn ++AQjvjsdiecR6cbsRhH7PqqlfvGlAtwWTN9afjuSZzUzy5rFT5rL7+/RKPVN8+w ugVyL4KwzkdJIABqw+F5pF+K96c42GPTOnMeTtveLkHH+h1tK+6zaVn/8P2XvBUB X9ejv3CbvsyUU84c2+eBsy7xD96Yyv5oFhnPPwtZ19mBu65CbH5jgtz4Owl6KBHK L//2JFw93SZQ768BK+Bm0lToaKsk0DP9OWQz9k54TeOL6DN1ZQ/PzJoxx5Mi3XQR B8+pS8//9ex6RTSX8GrMyl05S+0rfLNODM/Zu1k8D8dai0J3V2hVS4r3brn0g/ZF Uwjx4oDcI9ez15Ft/e4tFHu3Omw8gKtjmTtbBWNC4g/qg0MVC2vnx7DWE1BCf5iF fZ+Svt1XENIxDuBDFn0aLzNXNg3lwuGP6KIhbbtKxDNTAdxnvrkCvEzctkOcYStc wWfmzH4ReXSBZmibZ37pmLMJIPw6IGo72asE9cYDHV2VIHoakc8Du01+vUZ1josk mWGAxHSAHRqc0Yu98gxZqMPIkSdqUpbSRDkc0b2U5i5aY1FSFdY= =5WnG -----END PGP SIGNATURE----- --Xzd0sUmZITcBHKTf--