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

Hacker News by 9 min read 510x views
CVE-2026-99312: KVM Guest-to-Host Escape

Share Post

Rent a server in the haze and one item comes alongside the bill: you are solitary in there. Your VM is yours, your neighbors' VMs are theirs, and the hypervisor keeps it that way. We bankrupt that border on an average DigitalOcean droplet, and reached the bodily presenter and all another tenant's VM on it.

What came rear archetypal was the host's own kernel type banner, a cord that exists nowhere inner a guest. Then the remainder of the machine: concerning 127 GB of presenter RAM, ours to read, and compose and on a shared presenter that recollection belongs to whoever alternatively is operating VMs there.

On DigitalOcean we demonstrated the read. The compose we showed on a bare-metal AMD server of our own, anywhere our VM dropped 32 chosen bytes into a live presenter kernel page. Arbitrary compose to presenter recollection is the essential component for code execution.

All it took was what all haze client already has: a VM and base inner it.

The bug is in KVM, the hypervisor built into the Linux kernel, on AMD CPUs alongside nested virtualization enabled. It sat in the kernel for fair under four years, and it was opened by a safety fix.

So how does a VM attain recollection it was never given?

How KVM Confines a VM to Its Own Memory

Three players matter here. Our VM is the droplet we rented. KVM is the hypervisor inner the host's Linux kernel. The processor is the bodily AMD part that runs our VM's code. A VM additionally has its own leaf table, but this narrative follows lone KVM's nested leaf table: it turns a bodily location as seen by our VM into an location in the host's genuine memory. KVM builds that array in presenter kernel memory, out of our VM's reach. The processor says it whenever a translation is needed and not already cached.

The pointer in our VM's authority obstacle names the starting page of KVM's table. It is the physical location our VM wants to use, not that pointer, that the processor breaks into pieces. For an average recollection page, four groups of nine bits choose one admission apiece at the top, second, third, and base levels. Each selected admission gives the presenter location of the next array page; the base admission gives the presenter recollection page, and the remaining dozen bits choose a stance inner it. KVM builds the table, but the processor makes these selections. It treats whichever leaf the pointer names as the top level.

The bug: one code way in KVM forgot to update that pointer. After the bug fires, the pointer motionless names a leaf that no longer holds the leaf table, since KVM freed it. The processor keeps following the pointer anyway, so any the kernel reallocates that leaf for becomes the top of our VM's recollection map. This is a use-after-free.

The next figures zoom in on the levels that go wrong. In Step 2, a large-page admission stops the lookup before the base level.

The Bug: A Reset Leaves a Pointer to a Freed Page

Some clouds let a VM run a VM of its own, a nested VM. The characteristic is called nested virtualization. KVM afterward keeps two authority blocks, one for our VM and one for the nested VM, all alongside its own leaf array pointer. We compose the nested VM ourselves, and we run it alongside paging turned off, which is why KVM cannot hand it our leaf array and builds it a second one. Every period the nested VM exits rear to our VM the normal way, KVM updates our VM's pointer so that it names our VM's live leaf array before our VM runs again.

There is another way out: a reset indication called INIT. When INIT pulls a virtual CPU out of the nested VM, KVM skips the normal exit way and leaves our VM's pointer holding the location it held before. KVM has a second safety net that would capture this, a complete rebuild of the recollection map during it handles the reset. It runs that rebuild lone whenever paging was on beforehand, and the environment it says is the nested VMs, which we turned off. So neither way refreshes the pointer.

That is the bug: one exit way forgot to update the pointer. We rotate it into a use-after-free. While the nested VM runs, we alter our VM's recollection map, which makes KVM throw distant our VM's leaf array and liberated the leaf at its top. Then a second virtual CPU of our VM sends INIT. KVM does not update the pointer, so it resumes our VM alongside a pointer that names a freed page. What follows is how we utilize it.

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

We contact recollection in our VM that KVM has not mapped yet. KVM has to allocate a page-table leaf for it, and the leaf it fair freed is a fine applicant to arrive back: the identical CPU freed it, so it sits near the top of that CPU's liberated list. KVM reallocates it as a caller bottom-level array for our VM and fills it alongside the presenter addresses of our VM's pages. That leaf is a live leaf array again, built and owned by the kernel.

It is the incorrect level. The old pointer motionless names it, so the processor says a bottom-level array as the top level. It takes an admission there and follows it, expecting the second level. The entries are absolutely accurate bottom-level entries, all one the presenter location of a leaf of our VM, so the processor lands in average recollection of ours.

So we never contact KVM's table. The leaf we end up controlling is the one below it: our own data page, which the processor now says as the second flat of the leaf table, alongside entries we are liberated to write.

This stage is a competition and can fail. On a haze presenter you get one genuine attempt per boot. On the ample droplet anywhere we ran the complete chain, it worked on 6 of 12 boots. That is a coin flip per boot, which is applicable for any motivated attacker.

Step 2: Let the Processor Reveal Our Pages' Host Addresses

Step 1 made the processor peruse a leaf of our VM as the second flat of KVM's table. We authority its contents, but to build a complete array of our own we need the presenter addresses of our pages. Our VM does not cognize them.

Here is the hardware item that gets us there: whenever the processor says a array entry, it sets its Accessed bit. We put a valid admission alongside that bit apparent at the commencement of many pages in our VM, and we set its large-page emblem so the processor stops at that admission alternatively of strolling further. On the leaf it says as the second level, the processor turns the Accessed bit on. We inspect which of our pages came rear alongside that bit set. That tells us which leaf to edit, although it does not yet disclose the page's presenter address.

Now we edit that page. We put a guessed presenter location into a distinct admission of Page A, one the processor says to discover a third-level page. If the conjecture reaches another marked leaf of ours, the processor says that leaf as the third flat and sets the Accessed bit there too. That tells us the guessed location is anywhere that leaf really sits in presenter memory. No alter method we try another guess.

Guessing plant since we stack the phase first. We factory that marked admission in 262,144 of our own pages, a gigabyte of visitant RAM, so a fit portion of the presenter addresses we try rotate out to be ours. On our bare-metal server a few hundred guesses gave us the presenter addresses of two of our pages, all conjecture costing microseconds.

Step 3: Forge a Page Table for All Host Memory

We now cognize the genuine presenter addresses of two of our pages. That is adequate to build a complete leaf array of our own.

One leaf holds the array structure. The entries in it item anywhere we akin in presenter bodily memory. The another leaf proves the oracle worked: it appears at the location we predicted.

From that instant on, our VM's code runs through a leaf array we wrote, and all recollection admission lands anywhere we say.

On DigitalOcean we pointed our array at concerning 127 GB of presenter RAM, mapped read-only. The hypervisor's kernel type banner came back, a cord no droplet should always see.

To display the compose without risking anyone else's infrastructure, we used a bare-metal AMD server we control. Our VM put chosen bytes into a presenter kernel page. A observer component in the presenter kernel owned that leaf and reported that item another than itself had changed it.

The impact: a peruse reaches all tenant's recollection on the host. A compose is worse. Arbitrary compose to presenter kernel recollection is how you get code implementation on the presenter itself.

A Security Fix Opened the Bug

In 2022, KVM had a distinct bug: whenever a reset pulled a virtual CPU out of a nested VM, it kept operating on the nested VM's authority block, which afterward got freed. The fix for that bug, CVE-2022-3344, switched it rear to the authority obstacle of the VM that runs the nested one before item was freed.

That fixed the authority block. It did not fix the page-table pointer inner it. The toggle happened, but nobody refreshed the pointer, so our VM's authority obstacle went rear into service, motionless naming the leaf our memory-map alter had already freed. That 2022 fix has now needed at smallest two follow-on fixes, and one of them is this escape.

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

Disclosure Timeline‍

  • 2026-10-21. Reported to the Linux KVM maintainers. 
  • ‍2026-11-02. Fix merged to mainline, and archetypal 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.

Mitigation

Many haze providers we surveyed are out of attain for one reason: they did not allow 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 indicator of the kvm_amd component to 0. That turns nested virtualization off and closes this way completely.

Visit Terra Security to study more.

Other Article Hacker News
↑
Close Right Ads
Close Left Ads