GHSL-2021-058: Disclosure of the host memory into the virtualized guest in hyperkit - CVE-2021-32847
A typo in the hyperkit disk driver turns an assertion into an assignment, so a malicious guest can trigger an out-of-bounds read of host memory. This allows the guest to leak host memory into the virtualized guest.
Originally disclosed on GitHub Security Lab
A malicious guest can trigger a vulnerability in the host by abusing the disk driver that may lead to the disclosure of the host memory into the virtualized guest.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely a typo in an assertion: the equality operator was written as an assignment, so the size check always passes and an out-of-bounds read occurs.
Impact
A malicious guest can read host memory outside its address space, potentially leaking sensitive data, and the impact is exacerbated by heap layout allowing further manipulation.
What the attacker needed
Malicious guest OS; virtio-blk device enabled; host running hyperkit
The fix
The maintainers fixed the issues.
How it was found
- Compile hyperkit with AddressSanitizer to detect invalid reads.
- Boot hyperkit with a virtio-blk disk device and a custom guest kernel that sends a crafted discard operation.
- The guest kernel sets up virtio descriptors with a discard request and an invalid iov_base pointer.
- The guest notifies the device, triggering the vulnerable code path.
- The host reads memory beyond the guest's address space, leaking data into the guest.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Hyperkit is software that lets one computer run another computer inside it (a virtual machine). The guest (the virtual machine) can send disk commands to the host (the real computer). A mistake in checking the size of one disk command lets the guest read memory outside its own area, which could leak sensitive data from the host.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.