BSDSec

deadsimple BSD Security Advisories and Announcements

FreeBSD Security Advisory FreeBSD-SA-24:01.bhyveload

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

=============================================================================
FreeBSD-SA-24:01.bhyveload                                  Security Advisory
                                                          The FreeBSD Project

Topic:          bhyveload(8) host file access

Category:       core
Module:         bhyeload
Announced:      2024-02-14
Credits:        The water cooler. (Note, this is the requested credit)
Affects:        All supported versions of FreeBSD.
Corrected:      2024-01-15 22:27:59 UTC (stable/14, 14.0-STABLE)
                2024-02-14 06:05:44 UTC (releng/14.0, 14.0-RELEASE-p5)
                2024-01-15 23:11:38 UTC (stable/13, 13.2-STABLE)
                2024-02-14 06:06:00 UTC (releng/13.2, 13.2-RELEASE-p10)
CVE Name:       CVE-2024-25940

For general information regarding FreeBSD Security Advisories,
including descriptions of the fields above, security branches, and the
following sections, please visit <URL:https://security.FreeBSD.org/>.

I.   Background

bhyveload(8) is used to load a FreeBSD guest into a bhyve virtual machine.

II.  Problem Description

`bhyveload -h <host-path>` may be used to grant loader access to the <host-path>
directory tree on the host.  Affected versions of bhyveload(8) do not make any
attempt to restrict loader's access to <host-path>, allowing the loader to read
any file the host user has access to.

III. Impact

In the bhyveload(8) model, the host supplies a userboot.so to boot with, but the
loader scripts generally come from the guest image.  A maliciously crafted
script could be used to exfiltrate sensitive data from the host accessible to
the user running bhyhveload(8), which is often the system root.

IV.  Workaround

No workaround is available, but guests that do not use `bhyveload -h` are not
impacted.  Common VM solutions that use bhyveload(8) do not usually use the
- -h option.

V.   Solution

Upgrade your 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 or arm64 platforms,
or the i386 platform on FreeBSD 13, 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 14.0]
# fetch https://security.FreeBSD.org/patches/SA-24:01/bhyveload-14.0.patch
# fetch https://security.FreeBSD.org/patches/SA-24:01/bhyveload-14.0.patch.asc
# gpg --verify bhyveload-14.0.patch.asc

[FreeBSD 13.2]
# fetch https://security.FreeBSD.org/patches/SA-24:01/bhyveload-13.2.patch
# fetch https://security.FreeBSD.org/patches/SA-24:01/bhyveload-13.2.patch.asc
# gpg --verify bhyveload-13.2.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 <URL:https://www.FreeBSD.org/handbook/makeworld.html>.  Virtual
machines that have been booted with bhyveload(8) do not need to be rebooted.

VI.  Correction details

This issue is corrected as of the corresponding Git commit hash in the
following stable and release branches:

Branch/path                             Hash                     Revision
- -------------------------------------------------------------------------
stable/14/                              426b28fdf700    stable/14-n266333
releng/14.0/                            f5bb597829e1  releng/14.0-n265406
stable/13/                              78345dbd7a00    stable/13-n257186
releng/13.2/                            48598b1670ce  releng/13.2-n254657
- -------------------------------------------------------------------------

Run the following command to see which files were modified by a
particular commit:

# git show --stat <commit hash>

Or visit the following URL, replacing NNNNNN with the hash:

<URL:https://cgit.freebsd.org/src/commit/?id=NNNNNN>

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

VII. References

<URL:https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-25940>

The latest revision of this advisory is available at
<URL:https://security.FreeBSD.org/advisories/FreeBSD-SA-24:01.bhyveload.asc>
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEthUnfoEIffdcgYM7bljekB8AGu8FAmXMYRAACgkQbljekB8A
Gu8KwRAAxCnMsCQbp/CZ1O2GYxDTCOt1M5CZaFBD8r3b4xSN1gFB79z3aHAmSX0a
kTGpp5QSbxx1UtA9eZoZTa/wpmMAo1AZ7ry0OK1VuRFtF2D+IM64l07m91HW5ncU
YCsbeQ6wuXHeVlZ/t7eu/X03YltYIuMu/wIzpsPYtMvTB+ZI50nm0pUGaQnH9ZA2
jMGhLcWQSaHi46pMJ1o2iXWbaFZh4S6fHhNXSEFxaWuQf/o//whSgeqtFnhozfZ4
vbx0pyF3HrkjPRLwc9QDRNcFnG0F9DCOmiGlAAZD4/XRNOd5PgSvmHxDPrc1UkJO
K8CcU7vIgloKdETS43HhlDhT34/adV1dMpwCLpr9JZ3FmfTtIor1q8w9l0nLohln
VeLUbhaMZAXYqQp5wcDso26n9moD8l/izJZZ0gWu8xsooKmE2DY0t7ASXdcvnSq8
VKlpZP0DHcdZdeePiCF6XovAvv3fAq5hvIdCccBIJHbFIWEL2Psq9hYqFISb+mFb
gAoX5gyo4S+lWgn33aUCzjYuR0MhelJPRFIndjr5+Dn0AgQniNre7uRt4k97jvT1
Q9h+f4uyNFafuD5YMqfRhsk8EN93bEc3Bkq47KCYDSTJujd99pYFPE1SzvNAPmNY
CYxqYjkfjklarfellifxvqdKrOWoeOkK4a3Ckd5+4Y8BaaTzWCY=LOMD
-----END PGP SIGNATURE-----