Kuboid
Open Luck·Kuboid.in
Black Hat2024
Open in YouTube ↗

URB Excalibur: The New VMware All-Platform VM Escapes

Black Hat1,379 views38:48over 1 year ago

This talk demonstrates a series of novel virtual machine escape techniques targeting VMware's hypervisor by exploiting vulnerabilities in the USB Request Block (URB) handling. The researchers identify heap-based buffer overflows and information disclosure vulnerabilities within the EHCI (Enhanced Host Controller Interface) implementation across multiple VMware platforms. The presentation details a sophisticated exploit chain involving heap grooming and memory corruption to achieve arbitrary code execution on the host system from within a guest VM. The researchers provide a comprehensive analysis of the attack surface and demonstrate successful escapes on VMware Fusion and Workstation.

Exploiting the VMware USB Request Block: A Deep Dive into VM Escape Primitives

TLDR: Researchers at Ant Group Light-Year Security Lab recently detailed a sophisticated VM escape chain targeting VMware’s USB Request Block (URB) handling. By chaining heap-based buffer overflows and out-of-bounds read/write primitives, they achieved arbitrary code execution on the host from a guest VM. This research highlights the critical need to audit virtualized device drivers, as they remain a high-value, often overlooked attack surface for hypervisor breakouts.

Virtual machine escapes are the holy grail of offensive security research. When you break out of a guest, you aren't just compromising a single workload; you are compromising the entire infrastructure layer. The recent presentation at Black Hat 2024 on URB Excalibur demonstrates that even mature, closed-source hypervisors like VMware are vulnerable to memory corruption bugs in their virtualized device implementations. Specifically, the researchers focused on the EHCI (Enhanced Host Controller Interface) controller, proving that the complexity of USB emulation is a fertile ground for memory safety issues.

The Vulnerability: EHCI and URB Handling

At the core of this research is the way VMware handles USB Request Blocks (URBs). The EHCI controller acts as the bridge between the guest OS and the host's USB emulation layer. The researchers identified that the logic responsible for processing these requests—specifically the ehci_control_transfer function—suffers from critical flaws when handling data packets.

The primary vulnerability, CVE-2022-31705, is a heap-based out-of-bounds write. The issue stems from a lack of proper bounds checking when processing the setup_len field in the URB. Because the hypervisor trusts the length provided by the guest without sufficient validation, an attacker can trigger an integer overflow. This leads to a scenario where the hypervisor allocates a buffer that is too small for the incoming data, resulting in a heap overflow that allows for memory corruption.

The researchers also identified a secondary information disclosure vulnerability. By manipulating the writeback_len field in the URB, they could force the hypervisor to leak sensitive memory contents back to the guest. This is a classic "read-what-you-want" primitive that is essential for bypassing modern exploit mitigations like ASLR (Address Space Layout Randomization).

From Primitive to Escape

Achieving code execution requires more than just a single crash. The researchers employed a technique called heap grooming to stabilize the memory state. By repeatedly allocating and freeing objects of specific sizes, they could influence the heap layout to ensure that their corrupted buffers were placed adjacent to critical control structures.

The exploit chain follows a logical progression:

  1. Heap Grooming: Use the SVGA_3D_CMD_SET_SHADER command to allocate and free heap chunks of controlled sizes, ensuring the heap is in a predictable state.
  2. Information Leak: Trigger the out-of-bounds read to leak the base address of the heap and other critical pointers.
  3. Arbitrary Read/Write: Use the out-of-bounds write to overwrite the writeback_len and pipe pointers within the URB structure.
  4. Control Flow Hijack: Overwrite a function pointer in a dynamically allocated object. When the hypervisor subsequently calls this function, it redirects execution to a ROP chain or shellcode.

The demo shown during the talk was particularly impressive. The researchers successfully escaped from a Linux guest running on VMware Fusion to the host macOS system, ultimately launching the calculator application. This is the gold standard for a successful VM escape demonstration.

Real-World Applicability for Pentesters

For those of us performing red team engagements or bug bounty research, this work serves as a reminder that the "virtual" in virtual machine is just code. If you are testing an environment that relies on VMware, don't just look at the guest OS. Look at the hardware emulation layer.

If you encounter a target that allows for custom USB device passthrough, you are looking at a potential entry point. The attack surface here is not just the USB controller itself, but the entire stack of virtualized drivers that the hypervisor exposes to the guest. During an engagement, focus on identifying which virtual devices are enabled. If you can interact with the EHCI or XHCI controllers, you have a direct line to the hypervisor's memory management logic.

Defensive Considerations

Defending against these types of attacks is notoriously difficult because they occur at the hypervisor level, often invisible to guest-based EDR solutions. The most effective mitigation is to minimize the attack surface. If a virtual machine does not require USB passthrough, disable the controller entirely in the VM configuration.

Furthermore, ensure that your virtualization hosts are patched against the latest advisories from VMware Security Advisories. While patching is the baseline, the complexity of these bugs suggests that we should also be advocating for better memory safety in hypervisor development. As researchers, we should continue to push for the adoption of memory-safe languages in these critical components.

The work presented on URB Excalibur is a masterclass in modern exploit development. It takes a deep understanding of the underlying protocol, a creative approach to memory corruption, and the persistence to overcome modern exploit mitigations. For those interested in the technical weeds, I highly recommend reviewing the official conference slides to see the full exploit chain in detail. Keep digging into these low-level components; that is where the most impactful research is happening today.

Talk Type
research presentation
Difficulty
expert
Category
exploit dev
Has Demo Has Code Tool Released


Black Hat Asia 2024

44 talks · 2024
Browse conference →
Premium Security Audit

We break your app before they do.

Professional penetration testing and vulnerability assessments by the Kuboid Secure Layer team. Securing your infrastructure at every layer.

Get in Touch
Official Security Partner
kuboid.in