Skip to content
Memory corruption Write-up Advanced

CVE-2024-21115: An Oracle Virtualbox LPE Used To Win Pwn2Own

An out-of-bounds bit clear in VirtualBox's VGA device allows clearing bits beyond the dirty-page bitmap, which can corrupt critical section data. An attacker with control over the guest can exploit this to achieve privilege escalation on the host.

Cody Gallagher Follow

Published on zerodayinitiative.com

Bounty$20,000total stated by author View original

The core bug used for this escape is a relative bit clear on the heap from the VGA device. The bug is in function vgaR3DrawBlank, which is called from vgaR3UpdateDisplay.

Cody Gallagher (@cogallag), on zerodayinitiative.com

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.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 10 min read.

Context

This write-up covers CVE-2024-21115, an out-of-bounds (OOB) write in Oracle VirtualBox that was used to win a Pwn2Own contest. The author is Cody Gallagher (@cogallag), and the report was published on the Zero Day Initiative blog on 9 May 2024. Oracle patched the bug in April 2024. The platform records the bounty as 20,000 USD.

The bug lives in the VGA device emulation. Inside the VGAState struct there is a bitmap that tracks dirty pages in the VRAM buffer, so the emulator knows which parts of the frame buffer need redrawing. The bitmap is large enough to hold the total number of pages even at the maximum VRAM VirtualBox allows, which the report states is 256MB.

The faulty function is vgaR3DrawBlank, which is called from vgaR3UpdateDisplay. When it clears dirty page bits it multiplies start_addr by 4 before doing so, which is incorrect. The result is a relative bit clear on the heap.

Setup

The report gives the following conditions.

  • The bug itself can be triggered with a single core and 32MB of VRAM, and possibly less.
  • All testing was done using the default graphics controller for Linux, VMSVGA. The author says it should work on others as well.
  • The full exploit could not be made to work under those constraints. It requires at least 65MB of VRAM, and the author used 128MB to be safe.
  • The exploit requires 4 cores because of the race condition it uses.
  • The values used to trigger the bug are all settable via ioport communication. The report does not reproduce the exact ioport communications and instead points to the exploit code.

The report does not state the VirtualBox version tested or the host or guest operating system versions.

Finding it

The author examined how start_addr is set and found that it allows any value up to vram_size. Later in the code, vbe_start_addr is stored into start_addr and vbe_line_offset is stored into line_offset. This happens when vgaR3UpdateBasicParams calls vgaR3GetOffsets, and the update occurs whenever new graphics or text is being drawn.

Because of the multiplication by 4, two things follow:

  1. If start_addr can be set to a value greater than 64MB, the bit clear lands outside the bounds of the bitmap.
  2. Even if start_addr is below 64MB, so that clearing starts inside the bitmap, the bit clear operation can continue past the bitmap's end.

As long as vram_size is greater than 64MB, the author could clear bits in heap memory following the bitmap. The values used to trigger the bug were chosen to zero out a specific bit. The author notes that if VBE_DISPI_INDEX_VIRT_WIDTH is increased it will most likely overwrite enough data to cause a segfault.

Exploitation

Step 1: pick a target for the bit clear

The author explored several paths to find something that could be zeroed to gain reliable code execution, and settled on CritSect inside VGAState. This critical section ensures that only one thread at a time processes in and out instructions for each device, as well as loads and stores to the mmio region.

The relevant behaviour of the critical section is:

  • When a thread locks it, it adds 1 to cLockers, updates NativeThreadOwner to the current thread, and adds 1 to cNestings.
  • A different thread attempting to lock the same section sees that cLockers is set and waits. There is first an optimised wait, spinning for some microseconds to see if it can quickly acquire the lock.
  • If that fails, it blocks on the EventSem semaphore.

The hEvent value is just an int. Each time a critical section is created, a new hEvent value is allocated sequentially. The critical section of VGAState has hEvent equal to 0x23. The first 4 bytes of the structure are u32Magic, and hEvent sits at offset 0x18.

The author found that VMMDev uses the hEvent value 0x21. Testing showed the hEvent values are consistent between runs because they are assigned sequentially on startup. The critical sections for VMMDev and VGA are created directly after the processor-related critical sections, so as long as the processor chipset does not change, these values should remain constant. The author notes that other critical sections could potentially be used, but chose VMMDev.

Step 2: turn 0x23 into 0x21

The bit clearing bug is used to change the VGAState hEvent from 0x23 to 0x21, matching VMMDev. The consequence is that when two threads exist, one holding the VMMDev critical section and one holding the VGA critical section, either thread releasing its section can wake a thread waiting for either device. The plan is to wake a thread waiting for VGA prematurely, while another thread is still using VGA.

Step 3: deal with the SigTrap

Hitting the race alone is not enough. VirtualBox throws a SigTrap shortly afterwards, because the racing thread changes NativeThreadOwner when it locks the critical section. When the first thread tries to unlock, NativeThreadOwner does not match, causing the error.

The author found a way to turn off an individual critical section entirely: a bit in fFlags called RTCRITSECT_FLAGS_NOP. If this bit is set, all locking and unlocking operations for that critical section are ignored.

The problem is that the only primitive available is a bit clear, so there is no way to set the flag directly. The flag has to be set from the racing VGA thread before the first VGA thread exits and crashes the process.

Step 4: find a write primitive through vbe_regs

The author found an ioport for writing data to vbe_regs in VGAState:

Text
uint16_t vbe_regs[VBE_DISPI_INDEX_NB];

This ioport lets a caller specify vbe_index as an arbitrary short, and then writes an arbitrary short to vbe_regs[vbe_index] in vbe_ioport_write_data. The write is protected by a bounds check on the index, but the race condition can be used to circumvent it.

Step 5: race the bounds check

The exploit starts a VGA request on one thread (the worker) specifying a valid vbe_index, and a second VGA request on another thread (the racer) specifying a bad vbe_index. Normally the racer would wait for the worker to finish. By racing two VMMDev requests on two other threads, the racer VGA thread can be woken prematurely, modifying vbe_index after the worker thread has validated it but before it is used.

The racer must be woken at a critical moment during the worker's execution. To make the race easier to win, the author takes advantage of a memset in vbe_ioport_write_data where the length is controlled. For the worker request this length is made large, giving a longer window. In testing the author could easily get this to over 1 millisecond, described as a massive amount of time in which to win the race.

After winning the race, the desired effect is observed: the fFlags member at offset 0x14 is changed to 0xf, disabling the critical section. Combined with the earlier change of hEvent from 0x23 to 0x21, VGA threads can now easily be raced against each other.

Step 6: corrupt cScratchRegion for read and write primitives

Both a read and a better write are achieved by corrupting the same value. VGAState contains a field of struct type VMSVGASTATE, and that struct contains a field named cScratchRegion. cScratchRegion tracks the size of the buffer au32ScratchRegion, which stores data during VMSVGA IO port communication. In vmsvgaIORead and vmsvgaIOWrite the buffer is read and written based on the value of cScratchRegion.

Using the vbe_ioport_write race once more, cScratchRegion is corrupted. This yields a fully controlled buffer overread and buffer overflow of a buffer within VGAState.

Step 7: leak the VBoxDD.dll base

Each device in VirtualBox has a PDMPCIDEV allocated directly after it in memory. Because it is part of the initial allocation for the device, it is always there. At the beginning of the structure there is a pointer to the static string vga located in VBoxDD.dll. The buffer overread is used to read this pointer and infer the base address of VBoxDD.dll.

The structure also has a nested PDMPCIDEVINT structure containing several easily accessible function pointers. The function pointers pfnConfigRead and pfnConfigWrite can be overwritten by the buffer overflow, and calls to them can then be triggered using PCI ioports.

Step 8: trigger the overwritten function pointer

To prepare the call, pciIOPortAddressWrite is first called to set uConfigReg to specify the PCI device to read from or write to. In this case the value can be found in the uDevFn value at the beginning of the PDMPCIDEV struct. After uConfigReg is set, pciIOPortDataWrite is called, which calls pci_data_write. That function calls the overwritten function pointer with some controlled arguments.

When the function pointer is called, arg1 is the value of pDevInsR3, fully controlled by the buffer overflow. arg2 points to the PDMPCIDEV struct after VGAState, so data at that location is also controlled. With fully controlled arg1 and arg2, the final execution chain can be built.

Step 9: work around Control Flow Guard

The libraries use Windows Control Flow Guard, so indirect calls to arbitrary code are not possible. CFG does allow calls to arbitrary functions in other libraries, so it does not prevent calling WinExec("calc").

Step 10: build an arbitrary read

First the buffer read and write primitives are used to construct an arbitrary read, in order to get the address of kernel32.dll. Only the base address of VBoxDD.dll is known, so something usable has to be found in that library. The author found a function in VBoxDD.dll that works for this purpose. Because arg1 is fully controlled, the read routine takes memory from arg1+0x2d8 and stores it into the memory pointed to by arg2. Since arg2 points directly after VGAState in memory, the result can be read afterwards with the buffer overread. This gives an arbitrary read primitive.

Step 11: resolve kernel32.dll and WinExec

With the arbitrary read, pointers to functions in other libraries can be leaked through the VBoxDD.dll IAT. VBoxDD.dll imports several functions from kernel32.dll, so reading any one of those import table entries gives a pointer into kernel32.dll. From there the author scans backward with the read until the PE magic at the beginning of kernel32.dll is found, which gives the base.

Next the export table of kernel32.dll is located by reading out all the table addresses. The names table is scanned until the name WinExec is found. With the index, the ordinal and address tables give the function address. Finally calc is written into heap memory the author controls and WinExec("calc") is called.

Root cause

The mistake is in vgaR3DrawBlank. When clearing the dirty page bits it multiplies start_addr by 4 before performing the bit clear. Since start_addr can be set to any value up to vram_size, and vram_size can exceed 64MB, the clear can land outside the bitmap, or start inside it and run past its end. The bitmap was sized for the maximum VRAM of 256MB, so the sizing itself was not the problem; the incorrect scaling of the offset was.

The report does not discuss any defence at the point of the bit clear. The later stages of the exploit are constrained by Windows Control Flow Guard, which the author works around by calling an existing exported function rather than arbitrary code.

Impact

The author states that the bug can be triggered on a large percentage of virtual machines because it is an easily accessible path in VGA, and believes it can probably be turned into at least a denial of service on any VM with at least 32MB of VRAM.

The full escape as exploited has significantly more constraints, which restricts the number of machines affected. The author notes it may still be possible to turn the bug into a full escape under a wider range of conditions, but that was not part of the research. The exploit as written needs at least 65MB of VRAM (128MB used in practice) and 4 cores.

Fix

The report states that Oracle patched the bug in April 2024 and links to Oracle's April 2024 security advisory. The report does not describe the code change itself.

Variants to test

  • Other graphics controllers. The author tested only VMSVGA and says the bug should work on others as well. A positive result is the same out-of-bounds bit clear when start_addr is set above 64MB with more than 64MB of VRAM.
  • Lower VRAM for the trigger. The bug was triggered with 32MB and possibly less. A positive result is the same out-of-bounds bit clear with a smaller VRAM allocation.
  • Larger VBE_DISPI_INDEX_VIRT_WIDTH. The author expects this to overwrite enough data to cause a segfault. A positive result is a reproducible crash.
  • Other critical sections. The author notes other critical sections could potentially be used instead of VMMDev. A positive result is a matching hEvent value that produces the same premature wake-up.
  • Different processor chipsets. The hEvent values are constant only while the processor chipset does not change. A positive result is a stable pair of hEvent values on a different chipset.
Hero Background
Hero Background From the original on zerodayinitiative.com

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 16 min read.

What happened, in plain words

A security researcher named Cody Gallagher found a bug in Oracle VirtualBox, a program that lets you run other operating systems inside a window on your computer. The bug is a local privilege escalation in VirtualBox that the author exploited in a constrained setup to run code on the host. He used this bug to win a contest called Pwn2Own, where researchers demonstrate such attacks. The bug is tracked as CVE-2024-21115, and Oracle fixed it in April 2024. The platform records the bounty as 20,000 USD. This article explains the technical write-up for someone who has never studied security.

VirtualBox pretends to be a graphics card so that the guest operating system can draw on the screen. That pretend graphics card is called the VGA device. The bug is in the code that emulates this device. The report was published on the Zero Day Initiative blog on 9 May 2024.

Background: what is a virtual machine and why does a graphics card matter?

A virtual machine (VM) is like a computer inside a computer. The real computer runs a program (VirtualBox) that creates a fake set of hardware: a fake processor, fake memory, a fake disk, and a fake graphics card. The guest operating system (for example, Linux) runs on this fake hardware and does not know it is fake. The fake hardware is called an emulator.

The fake graphics card is important because the guest can send it commands to draw pixels. Those commands are handled by VirtualBox code running on the real computer. If that code has a bug, a malicious guest can exploit it to escape the VM and run code on the host. That is called a virtual machine escape or local privilege escalation (LPE).

The vulnerability: a wrong multiplication

Inside VirtualBox there is a data structure called VGAState. Think of it as a big box of settings and buffers for the fake graphics card. One part of it is a bitmap: a long sequence of bits (0s and 1s) where each bit represents a small block of video memory (VRAM). The bitmap tracks which blocks are "dirty", meaning they have changed and need to be redrawn on the screen. This is a common technique to avoid redrawing the whole screen every time.

The bitmap is sized to handle the maximum VRAM that VirtualBox allows, which the report says is 256MB. So even if you give the VM the maximum video memory, the bitmap is big enough.

The bug is in a function called vgaR3DrawBlank, which is called from vgaR3UpdateDisplay. When this function clears the dirty bits, it multiplies a value called start_addr by 4 before doing the bit clear. That multiplication is wrong. The result is that the bit clear can land outside the bitmap, in memory that follows it. This is called an out-of-bounds (OOB) write, specifically a relative bit clear on the heap. The heap is the area of memory where programs allocate dynamic data.

Why does multiplying by 4 cause an out-of-bounds? The report does not explain why the multiplication by 4 is wrong beyond saying it is incorrect. So the offset becomes 4 times too large, and the bit clear goes past the end of the bitmap.

Setup: what you need to trigger it

The report gives these conditions:

  • The bug itself can be triggered with a single processor core and 32MB of VRAM, and possibly less.
  • All testing used the default graphics controller for Linux, called VMSVGA. The author says it should work on other controllers as well.
  • The full exploit (the code that turns the bug into a working attack) could not be made to work with those minimal settings. It requires at least 65MB of VRAM, and the author used 128MB to be safe.
  • The exploit requires 4 cores because it uses a race condition (explained later).
  • The values used to trigger the bug are all settable via ioport communication. An ioport is a way for the guest to talk to emulated hardware, like a mailbox with numbered slots. The report does not reproduce the exact ioport communications and instead points to the exploit code.

The report does not state the VirtualBox version tested or the host or guest operating system versions.

Finding it: how the author located the bug

The author examined how start_addr is set and found that it allows any value up to vram_size (the amount of video memory). Later in the code, vbe_start_addr is stored into start_addr and vbe_line_offset is stored into line_offset. This happens when vgaR3UpdateBasicParams calls vgaR3GetOffsets. This update occurs whenever new graphics or text is being drawn.

Because of the multiplication by 4, two things follow:

  1. If start_addr can be set to a value greater than 64MB, the bit clear lands outside the bounds of the bitmap.
  2. Even if start_addr is below 64MB, so that clearing starts inside the bitmap, the bit clear operation can continue past the bitmap's end.

As long as vram_size is greater than 64MB, the author could clear bits in heap memory following the bitmap. The values used to trigger the bug were chosen to zero out a specific bit. The author notes that if VBE_DISPI_INDEX_VIRT_WIDTH is increased it will most likely overwrite enough data to cause a segfault (a crash).

Exploitation: turning the bug into an attack

The author explored several paths to find something that could be zeroed to gain reliable code execution, and settled on CritSect inside VGAState. This critical section ensures that only one thread at a time processes in and out instructions for each device, as well as loads and stores to the mmio region. A thread is a sequence of instructions that the processor runs; multiple threads can run at the same time. A critical section is a lock that prevents two threads from using the same resource at once, like a single key to a room.

The relevant behaviour of the critical section is:

  • When a thread locks it, it adds 1 to cLockers, updates NativeThreadOwner to the current thread, and adds 1 to cNestings.
  • A different thread attempting to lock the same section sees that cLockers is set and waits. There is first an optimised wait, spinning for some microseconds to see if it can quickly acquire the lock.
  • If that fails, it blocks on the EventSem semaphore. A semaphore is a signalling mechanism; blocking means the thread sleeps until it is woken.

The hEvent value is just an int (integer). Each time a critical section is created, a new hEvent value is allocated sequentially. The critical section of VGAState has hEvent equal to 0x23. The first 4 bytes of the structure are u32Magic, and hEvent sits at offset 0x18. An offset is a distance from the start of a structure in memory.

The author found that VMMDev uses the hEvent value 0x21. Testing showed the hEvent values are consistent between runs because they are assigned sequentially on startup. The critical sections for VMMDev and VGA are created directly after the processor-related critical sections, so as long as the processor chipset does not change, these values should remain constant. The author notes that other critical sections could potentially be used, but chose VMMDev.

Step 1: pick a target for the bit clear

The hEvent value is just an int.

Step 2: turn 0x23 into 0x21

The bit clearing bug is used to change the VGAState hEvent from 0x23 to 0x21, matching VMMDev. The consequence is that when two threads exist, one holding the VMMDev critical section and one holding the VGA critical section, either thread releasing its section can wake a thread waiting for either device. The plan is to wake a thread waiting for VGA prematurely, while another thread is still using VGA.

Step 3: deal with the SigTrap

Hitting the race alone is not enough. VirtualBox throws a SigTrap shortly afterwards, because the racing thread changes NativeThreadOwner when it locks the critical section. When the first thread tries to unlock, NativeThreadOwner does not match, causing the error. A SigTrap is a signal that something went wrong, often leading to a crash.

The author found a way to turn off an individual critical section entirely: a bit in fFlags called RTCRITSECT_FLAGS_NOP. If this bit is set, all locking and unlocking operations for that critical section are ignored.

The problem is that the only primitive available is a bit clear, so there is no way to set the flag directly. The flag has to be set from the racing VGA thread before the first VGA thread exits and crashes the process.

Step 4: find a write primitive through vbe_regs

The author found an ioport for writing data to vbe_regs in VGAState:

Text
uint16_t vbe_regs[VBE_DISPI_INDEX_NB];

This line declares an array named vbe_regs that holds 16-bit unsigned integers (uint16_t). The size of the array is VBE_DISPI_INDEX_NB, which is a constant defined elsewhere. This array is part of the VGAState structure and stores VBE (VESA BIOS Extensions) register values. VBE is a standard for setting graphics modes.

This ioport lets a caller specify vbe_index as an arbitrary short, and then writes an arbitrary short to vbe_regs[vbe_index] in vbe_ioport_write_data. The write is protected by a bounds check on the index, but the race condition can be used to circumvent it. A bounds check is a test that the index is within the allowed range; if not, the write is refused.

Step 5: race the bounds check

The exploit starts a VGA request on one thread (the worker) specifying a valid vbe_index, and a second VGA request on another thread (the racer) specifying a bad vbe_index. Normally the racer would wait for the worker to finish. By racing two VMMDev requests on two other threads, the racer VGA thread can be woken prematurely, modifying vbe_index after the worker thread has validated it but before it is used.

The racer must be woken at a critical moment during the worker's execution. To make the race easier to win, the author takes advantage of a memset in vbe_ioport_write_data where the length is controlled. memset is a function that fills a block of memory with a value. For the worker request this length is made large, giving a longer window. In testing the author could easily get this to over 1 millisecond, described as a massive amount of time in which to win the race.

After winning the race, the desired effect is observed: the fFlags member at offset 0x14 is changed to 0xf, disabling the critical section. Combined with the earlier change of hEvent from 0x23 to 0x21, VGA threads can now easily be raced against each other.

Step 6: corrupt cScratchRegion for read and write primitives

Both a read and a better write are achieved by corrupting the same value. VGAState contains a field of struct type VMSVGASTATE, and that struct contains a field named cScratchRegion. cScratchRegion tracks the size of the buffer au32ScratchRegion, which stores data during VMSVGA IO port communication. In vmsvgaIORead and vmsvgaIOWrite the buffer is read and written based on the value of cScratchRegion.

Using the vbe_ioport_write race once more, cScratchRegion is corrupted. This yields a fully controlled buffer overread and buffer overflow of a buffer within VGAState. A buffer overread means reading past the end of a buffer; a buffer overflow means writing past the end. Both can leak or overwrite adjacent memory.

Step 7: leak the VBoxDD.dll base

Each device in VirtualBox has a PDMPCIDEV allocated directly after it in memory. Because it is part of the initial allocation for the device, it is always there. At the beginning of the structure there is a pointer to the static string vga located in VBoxDD.dll. The buffer overread is used to read this pointer and infer the base address of VBoxDD.dll. The base address is where the library is loaded in memory; knowing it helps calculate addresses of other things in that library.

The structure also has a nested PDMPCIDEVINT structure containing several easily accessible function pointers. A function pointer is a variable that holds the address of a function, so calling it jumps to that address. The function pointers pfnConfigRead and pfnConfigWrite can be overwritten by the buffer overflow, and calls to them can then be triggered using PCI ioports.

Step 8: trigger the overwritten function pointer

To prepare the call, pciIOPortAddressWrite is first called to set uConfigReg to specify the PCI device to read from or write to. In this case the value can be found in the uDevFn value at the beginning of the PDMPCIDEV struct. After uConfigReg is set, pciIOPortDataWrite is called, which calls pci_data_write. That function calls the overwritten function pointer with some controlled arguments.

When the function pointer is called, arg1 is the value of pDevInsR3, fully controlled by the buffer overflow. arg2 points to the PDMPCIDEV struct after VGAState, so data at that location is also controlled. With fully controlled arg1 and arg2, the final execution chain can be built.

Step 9: work around Control Flow Guard

The libraries use Windows Control Flow Guard, so indirect calls to arbitrary code are not possible. Control Flow Guard (CFG) is a Windows security feature that checks that indirect calls (calls through function pointers) go to valid functions. CFG does allow calls to arbitrary functions in other libraries, so it does not prevent calling WinExec("calc"). WinExec is a Windows function that runs a program; calc is the calculator.

Step 10: build an arbitrary read

First the buffer read and write primitives are used to construct an arbitrary read, in order to get the address of kernel32.dll. Only the base address of VBoxDD.dll is known, so something usable has to be found in that library. The author found a function in VBoxDD.dll that works for this purpose. Because arg1 is fully controlled, the read routine takes memory from arg1+0x2d8 and stores it into the memory pointed to by arg2. Since arg2 points directly after VGAState in memory, the result can be read afterwards with the buffer overread. This gives an arbitrary read primitive. An arbitrary read means you can read any memory address you choose.

Step 11: resolve kernel32.dll and WinExec

With the arbitrary read, pointers to functions in other libraries can be leaked through the VBoxDD.dll IAT. The IAT (Import Address Table) is a list of addresses of functions that a program imports from other libraries. VBoxDD.dll imports several functions from kernel32.dll, so reading any one of those import table entries gives a pointer into kernel32.dll. From there the author scans backward with the read until the PE magic at the beginning of kernel32.dll is found, which gives the base. PE magic is a signature at the start of a Windows executable file.

Next the export table of kernel32.dll is located by reading out all the table addresses. The export table lists functions that the library makes available to others. The names table is scanned until the name WinExec is found. With the index, the ordinal and address tables give the function address. Finally calc is written into heap memory the author controls and WinExec("calc") is called.

Root cause

The mistake is in vgaR3DrawBlank. When clearing the dirty page bits it multiplies start_addr by 4 before performing the bit clear. Since start_addr can be set to any value up to vram_size, and vram_size can exceed 64MB, the clear can land outside the bitmap, or start inside it and run past its end. The bitmap was sized for the maximum VRAM of 256MB, so the sizing itself was not the problem; the incorrect scaling of the offset was.

The report does not discuss any defence at the point of the bit clear. The later stages of the exploit are constrained by Windows Control Flow Guard, which the author works around by calling an existing exported function rather than arbitrary code.

Impact

The author states that the bug can be triggered on a large percentage of virtual machines because it is an easily accessible path in VGA, and believes it can probably be turned into at least a denial of service on any VM with at least 32MB of VRAM. A denial of service means crashing or disrupting the VM.

The full escape as exploited has significantly more constraints, which restricts the number of machines affected. The author notes it may still be possible to turn the bug into a full escape under a wider range of conditions, but that was not part of the research. The exploit as written needs at least 65MB of VRAM (128MB used in practice) and 4 cores.

Fix

The report states that Oracle patched the bug in April 2024 and links to Oracle's April 2024 security advisory.

Variants to test

  • Other graphics controllers. The author tested only VMSVGA and says the bug should work on others as well. A positive result is the same out-of-bounds bit clear when start_addr is set above 64MB with more than 64MB of VRAM.
  • Lower VRAM for the trigger. The bug was triggered with 32MB and possibly less. A positive result is the same out-of-bounds bit clear with a smaller VRAM allocation.
  • Larger VBE_DISPI_INDEX_VIRT_WIDTH. The author expects this to overwrite enough data to cause a segfault. A positive result is a reproducible crash.
  • Other critical sections. The author notes other critical sections could potentially be used instead of VMMDev. A positive result is a matching hEvent value that produces the same premature wake-up.
  • Different processor chipsets. The hEvent values are constant only while the processor chipset does not change. A positive result is a stable pair of hEvent values on a different chipset.
Hero Background
Hero Background From the original on zerodayinitiative.com

Glossary

  • Virtual machine (VM): a computer inside a computer, created by software.
  • Host: the real computer running the virtual machine.
  • Guest: the operating system running inside the virtual machine.
  • Emulator: software that pretends to be hardware.
  • VGA device: the emulated graphics card in VirtualBox.
  • VRAM: video memory used by the graphics card.
  • Bitmap: a sequence of bits used to track states, here dirty pages.
  • Dirty page: a block of video memory that has changed and needs redrawing.
  • Out-of-bounds (OOB) write: writing to memory outside the intended buffer.
  • Heap: the area of memory where programs allocate dynamic data.
  • Bit clear: an operation that sets a bit to 0.
  • Struct: a collection of related data fields in memory.
  • Offset: distance from the start of a structure.
  • Critical section: a lock that allows only one thread at a time to access a resource.
  • Thread: a sequence of instructions that can run concurrently with others.
  • Race condition: a situation where the outcome depends on the timing of concurrent operations.
  • Semaphore: a signalling mechanism used to coordinate threads.
  • SigTrap: a signal indicating a serious error, often a crash.
  • Ioport: a numbered communication channel between the guest and emulated hardware.
  • mmio: memory-mapped input/output, where hardware registers appear as memory addresses.
  • Bounds check: a test that an index or size is within allowed limits.
  • memset: a function that fills memory with a value.
  • Buffer overread: reading past the end of a buffer.
  • Buffer overflow: writing past the end of a buffer.
  • Function pointer: a variable that holds the address of a function.
  • DLL: a dynamic link library, a file containing code that programs can use.
  • Base address: the memory address where a library is loaded.
  • IAT (Import Address Table): a list of addresses of functions imported from other libraries.
  • PE magic: a signature at the start of a Windows executable file.
  • Export table: a list of functions a library makes available.
  • Control Flow Guard (CFG): a Windows security feature that checks indirect calls.
  • WinExec: a Windows function that runs a program.
  • Denial of service (DoS): an attack that makes a system unavailable, often by crashing it.
  • CVE: a unique identifier for a publicly known security vulnerability.
  • Pwn2Own: a contest where researchers demonstrate exploits.
  • Bounty: a reward paid for finding a security bug.
  • LPE (Local Privilege Escalation): gaining higher privileges on a machine you already have access to.

More from Oracle (VirtualBox)

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.