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

FreeBSD -- Multiple issues in ctl(4) CAM Target Layer

Affected packages
14.1 <= FreeBSD-kernel < 14.1_4
14.0 <= FreeBSD-kernel < 14.0_10
13.3 <= FreeBSD-kernel < 13.3_6

Details

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

Problem Description:

Several vulnerabilities were found in the ctl subsystem.

The function ctl_write_buffer incorrectly set a flag which resulted in a kernel Use-After-Free when a command finished processing (CVE-2024-45063). The ctl_write_buffer and ctl_read_buffer functions allocated memory to be returned to userspace, without initializing it (CVE-2024-8178). The ctl_report_supported_opcodes function did not sufficiently validate a field provided by userspace, allowing an arbitrary write to a limited amount of kernel help memory (CVE-2024-42416). The ctl_request_sense function could expose up to three bytes of the kernel heap to userspace (CVE-2024-43110).

Guest virtual machines in the bhyve hypervisor can send SCSI commands to the corresponding kernel driver via the virtio_scsi interface. This provides guests with direct access to the vulnerabilities covered by this advisory.

The CAM Target Layer iSCSI target daemon ctld(8) accepts incoming iSCSI connections, performs authentication and passes connections to the kernel ctl(4) target layer.

Impact:

Malicious software running in a guest VM that exposes virtio_scsi can exploit the vulnerabilities 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.

A malicious iSCSI initiator could achieve remote code execution on the iSCSI target host.

References

CVE Name CVE-2024-42416
CVE Name CVE-2024-43110
CVE Name CVE-2024-8178
FreeBSD Advisory SA-24:11.ctl