BSDSec

deadsimple BSD Security Advisories and Announcements

FreeBSD Security Advisory FreeBSD-SA-24:15.bhyve

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

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

Topic:          bhyve(8) out-of-bounds read access via XHCI emulation

Category:       core
Module:         bhyve
Announced:      2024-09-19
Credits:        Synacktiv
Sponsored by:   The FreeBSD Foundation, The Alpha-Omega Project
Affects:        All supported versions of FreeBSD.
Corrected:      2024-09-19 12:40:17 UTC (stable/14, 14.1-STABLE)
                2024-09-19 13:30:18 UTC (releng/14.1, 14.1-RELEASE-p5)
                2024-09-19 13:30:44 UTC (releng/14.0, 14.0-RELEASE-p11)
                2024-09-19 12:48:52 UTC (stable/13, 13.4-STABLE)
                2024-09-19 13:35:06 UTC (releng/13.4, 13.4-RELEASE-p1)
                2024-09-19 13:35:37 UTC (releng/13.3, 13.3-RELEASE-p7)
CVE Name:       CVE-2024-41721

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

bhyve can be configured to emulate devices on a virtual USB controller (XHCI),
such as USB tablet devices.  An insufficient boundary validation in the USB
code could lead to an out-of-bounds read on the heap, which could potentially
lead to an arbitrary write and remote code execution.

III. Impact

A malicious, privileged software running in a guest VM can exploit the
vulnerability to crash the hypervisor process or potentially achieve code
execution on the host in the bhyve userspace process, which typically runs as
root.  Note that bhyve runs in a Capsicum sandbox, so malicious code is
constrained by the capabilities available to the bhyve process.

IV.  Workaround

No workaround is available, but guests that do not use XHCI emulation are not
impacted.

V.   Solution

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

Guest operating systems emulating USB devices with XHCI need to be restarted for
the correction to be applied (i.e., their corresponding bhyve process needs to
be terminated and started again).

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:15/bhyve.patch
# fetch https://security.FreeBSD.org/patches/SA-24:15/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 corresponding 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/                              419da61f8203    stable/14-n268745
releng/14.1/                            3c6c0dcb5acb  releng/14.1-n267716
releng/14.0/                            ba46f1174972  releng/14.0-n265453
stable/13/                              2abd2ad64899    stable/13-n258347
releng/13.4/                            5f035df278cc  releng/13.4-n258258
releng/13.3/                            e7a790dc3ffe  releng/13.3-n257468
- -------------------------------------------------------------------------

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

The corresponding part of the security audit report as provided by Synacktiv
will be published in due course.

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

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

iQIzBAEBCgAdFiEEthUnfoEIffdcgYM7bljekB8AGu8FAmbsPQ0ACgkQbljekB8A
Gu/6chAAzST6xGx6RCb7MAHeZbqE3mTTUFoEkElPG3OiFsnFDySDnk0kKIjCNRbq
GssLGYfUerFYD4/jDhGLApZnBnPhaTruNgwi38d8Pg4pkcqGv8Y5xSdOQBN83Rjq
WiEgRqysuaE6HhvNN+JYf690M1Z6Tz0WkqoUJa8ZB8WcDnvBNQwMM0Prmo1RTZGR
UXxftj+is3EQFUQs/3GcPRzTcp8Cu5QZnfFdbGph6Da/ZIQ6NaslYgslWvmsYHzP
AVb/WI54VnIuMVoRIDWGtjjQa8p2H+dRih67clZYFxl2ya85aK78UrrtPk8x4dci
9KsISpKidqC/ofdT4mHpNH3Uxx4N2ymPJG6xJ/MGmDmrIIk1vjKejy9RVSJzt4QN
Iu1u/8d5NVXsMxbKQMEKqXY2dPFKi17S+EnhKzJUjtXeBxcMbNPh2Xcl+BmI8cZ2
WuJvfplzu5Wcvd3LUa7s0Z3AHKktiMr1IGIlk8XEEee0b7k164imZlRUZFTCYA6S
dNGTQ2UcHZz7W2Sk2HZf8CdNEgQQftW0BDc2IIs3lyA2WyPsIjGByUl987k3veQa
fQCXzf7cp/a0rOZ9KngMxdJap+TBKCsPLEFm46i074ngmuoJZsW3xd7ZD8hLFlPX
eaKh5MjWsHHfTYPRxeUKk2j9dobzN1ZP7AYWDasaDxZ4kmVIuEE=FVQ2
-----END PGP SIGNATURE-----