CVE-2026-99312: KVM Guest-to-Host Escape

· Terra Security ·

5 min read Original article ↗

A cloud VM shares a physical server with other customers' VMs, and the hypervisor keeps each one confined to its own memory. We found a way through that boundary on a DigitalOcean droplet, and proved it is possible to read memory that belongs to the physical host.

‍

The bug, now tracked as CVE-2026-99312, is in KVM, the hypervisor built into the Linux kernel, on AMD CPUs with nested virtualization enabled. It sat in the kernel for just under four years, and it was opened by a security fix.

So, how does a VM reach memory it was never given?

How KVM Confines a VM to Its Own Memory

Our VM sees what looks like its own physical memory, starting at address zero. Those addresses are private to the VM, and every one of them has to be translated into an address in the host's real memory. KVM, the hypervisor inside the host's Linux kernel, builds the table that does this: the nested page table, or NPT. "Nested" here means a second layer of translation underneath the page tables our VM manages for itself. It is unrelated to the nested VMs that appear in the next section. KVM keeps the NPT in host kernel memory, out of our VM's reach.

The processor, the physical AMD chip that runs our VM's code, reads the NPT whenever it needs a translation it has not already cached. It breaks the physical address our VM wants to use into pieces. For an ordinary memory page, four groups of nine bits select one entry apiece at the top, second, third and bottom levels. Each selected entry gives the host address of the next table page; the bottom entry gives the host memory page, and the remaining twelve bits select a position inside it.

The processor finds the top-level page through a single field. KVM keeps a control block for each virtual CPU of our VM (AMD calls it the VMCB), and its nCR3 field holds the host address of the NPT's top-level page. We call that field the NPT pointer. KVM builds the table, but the processor makes every selection in it, and it treats whichever page the NPT pointer names as the top level.

Our VM stays confined only as long as the NPT pointer names a page KVM still owns.

The Bug: A Reset Forgets to Update the NPT Pointer

Some clouds let a VM run a VM of its own, called a nested VM. While the nested VM runs, the processor uses the nested VM's NPT pointer. When it stops, KVM updates our VM's NPT pointer so it names our live table again.

One way of stopping the nested VM skips that update: a reset signal called INIT. Our VM comes back with the NPT pointer it had before which has since been freed.

The processor still treats that page as the top level of our VM's NPT, so whatever the kernel puts there next decides which memory our VM can reach.

Step 1: KVM Reallocates the Freed Page as a Bottom-Level Table

Our VM now runs with a stale pointer: an NPT pointer to a page the kernel has freed. That page does not stay free for long. When our VM touches memory it has not used before, KVM builds new NPT pages for it, and the freed page comes back as one of them: a bottom-level table for our VM, filled with the host addresses of our VM's pages.

Meanwhile the stale pointer still names that page, so the processor reads it as the top level. It picks an entry and expects the address of a second-level table. What it finds is a bottom-level entry: the host address of one of our VM's own pages. So the processor reads an ordinary page of ours as the second level of the NPT.

We call that page Page A. It is our VM's memory, so every entry in it is ours to write.

‍

Step 2: Forge a Page Table for All Host Memory

The processor now takes its second level from Page A, so we write the rest of the table ourselves. Its entries name any host physical page we choose: the host kernel, or memory that belongs to other VMs. The next time the processor walks the table, our VM's code runs through a page table we wrote, so every memory access it makes lands where we say.

On DigitalOcean we pointed the forged table at about 127 GB of host RAM, mapped read-only, and scanned for the host's kernel version banner, which we got as a proof of it really working.

We demonstrated the write part on our own server, so nobody else's infrastructure was at risk. There the forged table mapped a host kernel page as writable, and our VM put chosen bytes into it. A witness module we had loaded into the host kernel owned that page and reported that it was indeed changed.

A Security Fix Opened the Bug

In 2022, KVM had a different bug: when a reset pulled a virtual CPU out of a nested VM, it kept running on the nested VM's control block, which then got freed. The fix for that bug, CVE-2022-3344, switched the CPU back to the outer VM's control block before anything was freed.

In PatchSlop we found that 3.2% of kernel CVEs were introduced by the fix for another CVE. This bug was introduced the same way.

Disclosure Timeline‍

  • 2026-10-21. Reported to the Linux KVM maintainers. 
  • ‍2026-11-02. Fix merged to mainline, and first tagged in v7.4-rc2 on 2026-11-09. ‍
  • 2026-11-17. Released in stable 7.3.5 and in the 6.18.64 and 6.12.118 long-term kernels.
  • 2026-11-18. CVE-2026-99312 published. 

Mitigation

Many cloud providers we surveyed were not vulnerable because they did not enable nested virtualization on AMD.

  1. Running KVM hosts on AMD? Update to a kernel that carries the fix.
  1. Cannot update yet? Set the nested parameter of the kvm_amd module to 0. That turns nested virtualization off and closes this path completely.

Visit Terra Security to learn more.