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

=============================================================================
FreeBSD-SA-24:17.bhyve                                      Security Advisory
                                                          The FreeBSD Project

Topic:          Multiple issues in the bhyve hypervisor

Category:       core
Module:         bhyve
Announced:      2024-10-29
Credits:        Synacktiv
Sponsored by:   The FreeBSD Foundation, The Alpha-Omega Project
Affects:        All supported versions of FreeBSD.
Corrected:      2024-10-19 15:42:15 UTC (stable/14, 14.1-STABLE)
                2024-10-29 18:45:36 UTC (releng/14.1, 14.1-RELEASE-p6)
                2024-10-19 15:43:46 UTC (stable/13, 13.4-STABLE)
                2024-10-29 18:49:55 UTC (releng/13.4, 13.4-RELEASE-p2)
                2024-10-29 18:53:41 UTC (releng/13.3, 13.3-RELEASE-p8)
CVE Name:       CVE-2024-51562, CVE-2024-51563, CVE-2024-51564,
                CVE-2024-51565, CVE-2024-51565

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

bhyve(8) is a hypervisor that runs guest operating systems inside a virtual
machine.

II.  Problem Description

Several vulnerabilities were found in the bhyve hypervisor's device models.

The NVMe driver function nvme_opc_get_log_page is vulnerable to a buffer over-
read from a guest-controlled value.  (CVE-2024-51562)

The virtio_vq_recordon function is subject to a time-of-check to time-of-use
(TOCTOU) race condition.  (CVE-2024-51563)

A guest can trigger an infinite loop in the hda audio driver.
(CVE-2024-51564)

The hda driver is vulnerable to a buffer over-read from a guest-controlled
value.  (CVE-2024-51565)

The NVMe driver queue processing is vulernable to guest-induced infinite
loops.  (CVE-2024-51565)

III. Impact

Malicious guest virtual machines may be able to perform a denial of service
(DoS) of the bhyve host, and may read memory within the bhyve process that
they should not be able to access.

IV.  Workaround

No workaround is available.  Virtual machines that provide none of the NVMe,
virtio, and hda devices to the guest are not vulnerable.

V.   Solution

Upgrade your vulnerable system to a supported FreeBSD stable or
release / security branch (releng) dated after the correction date.
Restart bhyve processes, or reboot the system.

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.

# fetch https://security.FreeBSD.org/patches/SA-24:17/bhyve.patch
# fetch https://security.FreeBSD.org/patches/SA-24:17/bhyve.patch.asc
# gpg --verify bhyve.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>.

Restart the applicable bhyve processes, or reboot the system.

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/                              86ba5941b132    stable/14-n269162
releng/14.1/                            fcd9a2d8a5bd  releng/14.1-n267723
stable/13/                              df1a36fdfae6    stable/13-n258536
releng/13.4/                            5d07a7e902fa  releng/13.4-n258265
releng/13.3/                            adb7b541aea1  releng/13.3-n257475
- -------------------------------------------------------------------------

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-51562>
<URL:https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-51563>
<URL:https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-51564>
<URL:https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-51565>
<URL:https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-51565>

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

iQIzBAEBCgAdFiEEthUnfoEIffdcgYM7bljekB8AGu8FAmchUCUACgkQbljekB8A
Gu/RJhAA5oWfn9F1Tdmwwl5CFbvIjSmHcWdDsTbQ66DrL8HcinrNoBSdhr2xuAQK
mxsWuUI1V4Wb9Yp0EXjpNB2ZIpjDbEionVK7BEZJ2D09TCi1CFS84CiTdqBlkJ/A
2K+eQD6BAG+wKu0yRlqu2wA8RgUWob8ORZ9PFyT4XH23OT4F60WUhPJ+917cqCru
Ye7hKcSy/xaL0J95ZOG+qeuTf9RbBeQ4f+Sq2ERbtPXVRcBs3x2PEjg1ptuKNmst
Hbvg+fIsfGWf99r50EhBP2yPJ/jNZBhYJ5gX+zdJsyuXRnJwnv2P6WNxFKoh2I2n
RI4L3rJ7hJVPURhXZ3fkmiQ8qW/VxrR+2H4YxjuD2U7KQg22ZxCCFNFfN7gYI63U
8/shw6Ez5OQqVyXl/+uD0/P6pnscKsQz9zNix7kI+G9meBZLnyA1/eGB0iFQVjYg
NxepUWheMsraLX1ytURtI2lY8pr26Fd4xtY0mKpV13ohL59nQZ79fIeot50m8WMP
++zqqErJa/9mk6MSZ/xXHWUbPLmQmuNyHere4kqvd4dTLLMOe17WB7NrPJch2S23
BCcnfZNGwP9iPY27CHRStAYI2OIj2iL7oe2Z7jnh+afpcX3r5isxqZf3R6pw7C2a
fDPHVTfKJ951yBloejhXJcPXdwgYMZ+8nd2MVafrIYD7dTZfCrU=
=BYuX
-----END PGP SIGNATURE-----