Skip to content

Conversation

@p4zuu
Copy link

@p4zuu p4zuu commented Dec 1, 2025

This issue has been reported privately to @rbradford.

VsockPacket::hdr holds a raw pointer to the address of the VSock packet header, which is in guest memory. It opens the door to double-fetch (or TOCTOU) race conditions. Therefore, VSockPacket::hdr content can't be trusted since it can be arbitrarily changed by the guest, at any time.

To mitigate this, we can copy the header content to an array in VMM's memory that the guest can't modify.

I managed to trigger this race condition by changing the len field header just before this line. This triggers a slice out-of-bounds and makes the VMM process panic. Since the packet header is allocated by the guest kernel, the PoC needs a guest kernel module to scan kernel memory and change the len field. I can provide the source files for the PoC.

It seems that some (maybe most) of the VSock code comes from firecracker, which had the same issue but fixed it. This PR takes some pieces of code from the firecracker codebase.

Also, I'm not a VSock expert so a more experienced reviewer would be appreciated.

@p4zuu p4zuu requested a review from a team as a code owner December 1, 2025 18:51
@rbradford
Copy link
Member

@alyssais Is this something you could take a look at? I think you might be the most experienced in this code.

@rbradford rbradford requested a review from alyssais December 1, 2025 22:39
VsockPacket::hdr holds a raw pointer to the address of the VSock packet
header, which is in guest memory. It opens the door to double-fetch
(or TOCTOU) race conditions. Therefore, VSockPacket::hdr content can't
be trusted since it can be arbitrarily changed by the guest, at any
time.

To mitigate this, we can copy the header content to an array in VMM's
memory that the guest can't modify.

Signed-off-by: Thomas Leroy <[email protected]>
@alyssais
Copy link
Member

alyssais commented Dec 2, 2025

Can do, but probably not this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants