Xen exploitation part 3: XSA-182, Qubes escape
A flaw in Xen's page table update fast path allowed a guest to set the writable flag on a self-referencing page table entry, bypassing checks. An attacker with code execution in an untrusted VM could exploit this to escape to the host and gain control of dom0 on Qubes OS.
blog.quarkslab.com
Published on blog.quarkslab.com
Posted Thu 04 August 2016 Authors Jérémie Boutoille, Gabriel Campana Category Exploitation Tags Xen, exploitation, PoC, guest-to-host, vm escape, Qubes OS, 2016
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 write-up has not been written yet. The Original tab links to the source.
How it worked
Impact
An attacker with code execution in an untrusted VM could escape to the host and gain full control over dom0, and from there access other VMs; the exploit was demonstrated on Qubes OS.
What the attacker needed
Code execution in an untrusted VM; vulnerable Xen hypervisor
The fix
The vulnerability was fixed by Xen (XSA-182); Qubes OS users were advised to update dom0.
How it was found
- Create a self-mapping page table entry without the RW flag.
- Use the fast path to add the RW flag to that entry.
- Access the page directory with write permission.
- Iterate through host memory to find the page directory.
- Find struct start_info to locate dom0.
- Find the vDSO page and patch it to get a root shell in dom0.
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 write-up has not been written yet. The Original tab links to the source.
In a virtualised system, a hypervisor runs multiple virtual machines (VMs) and is supposed to keep them isolated. This bug let a program inside one VM break out and take control of the most privileged VM (dom0), which manages the whole system. The mistake was that a shortcut in the hypervisor's memory management skipped a safety check when only the writable flag was changed.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.