← Lab /Systems

VirtualBox NAT Slirp bug enables VM escape to host userland

A missing length check and unchecked heap metadata in VirtualBox’s Slirp NAT implementation allow arbitrary code execution on the host from a guest VM.

Systems Google Project Zero 16 Dec 2025 Disclosure Prototype evidence

Published as “Thinking Outside The Box [dusted off draft from 2017]”

Why it matters

If successful, the bug lets a malicious guest VM execute arbitrary commands on the host, breaking isolation guarantees of VirtualBox NAT networking.

Summary

The writeup explains that VirtualBox’s custom Slirp NAT uses a zone allocator with inline metadata that lacks runtime validation in release builds. By sending crafted IP packets with bogus length fields and IP options, an attacker can corrupt chunk headers, turn the allocator into an arbitrary write primitive, and invoke memcpy to write controlled data. Using this primitive the attacker can overwrite GOT entries and call system() with attacker-controlled arguments, achieving code execution in the host userspace process.

What they found 1

  1. The unchecked assignment of m->m_len from the untrusted IP header makes later length checks ineffective.

    “if (m->m_len != RT_N2H_U16(ip->ip_len)) m->m_len = RT_N2H_U16(ip->ip_len);”

Caveats 5

  • The authors note that the exploit requires a largely unused packet heap and careful manipulation of multiple packet fragments.
  • They admit the code has not changed much since 2017, but provide no evidence of real-world exploitation after that date.
  • Exploit depends on the host using a non-strict release build where asserts are compiled out.
  • Requires the ability to send crafted IP fragments and UDP packets from the guest, plus a helper machine for UDP leakage.
  • Assumes the packet heap contains enough free space for the attacker-controlled structures.

What’s new here 4

  • Identifies missing runtime asserts in VirtualBox’s Slirp zone allocator that enable arbitrary zone pointer control.
  • Shows how a length field overwrite in ip_input() disables subsequent safety checks.
  • Demonstrates a full VM-to-host escape chain using UDP packets with checksum 0 to leak heap data and corrupt metadata.
  • Provides a write-primitive via the static PLT entry for memcpy to achieve arbitrary code execution.