FreeBSD VuXML: Documenting security issues in FreeBSD and the FreeBSD Ports Collection

FreeBSD -- bhyve(8) privileged guest escape via TPM device passthrough

Affected packages
14.1 <= FreeBSD < 14.1_4
14.0 <= FreeBSD < 14.0_10

Details

VuXML ID 56d76414-6b50-11ef-9a62-002590c1f29c
Discovery 2024-09-04
Entry 2024-09-05

Problem Description:

bhyve can be configured to provide access to the host's TPM device, where it passes the communication through an emulated device provided to the guest. This may be performed on the command-line by starting bhyve with the `-l tpm,passthru,/dev/tpmX` parameters.

The MMIO handler for the emulated device did not validate the offset and size of the memory access correctly, allowing guests to read and write memory contents outside of the memory area effectively allocated.

Impact:

Malicious software running in a guest VM can exploit the buffer overflow to 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.

References

CVE Name CVE-2024-41928
FreeBSD Advisory SA-24:10.bhyve