CVE-2026-99312
A use-after-free in AMD’s KVM NPT, exploitable to host memory access, opened by a security fix and closed by a single line.
TL;DR: CVE-2026-99312 is a use-after-free in the Linux kernel’s KVM nested page table (NPT) on AMD processors with nested virtualization enabled. A guest with root can free its NPT page, get it reallocated to host memory, and forge page table entries that map any host physical address. Found by Terra Security’s Oren Yomtov and published Nov 18, 2026. The bug sat in the kernel for nearly four years — opened by a security fix, closed by an unconditional mmu_context reset on INIT. Mitigation: disable nested virt on AMD (modprobe -r kvm_amd; modprobe kvm_amd nested=0) or update the kernel.
How KVM Confines a VM
A VM sees its own physical memory starting at zero. Every address it accesses has to be translated into the host’s real memory. KVM builds that translation table — the nested page table (NPT) — and keeps it in host kernel memory.
The AMD processor reads the NPT whenever it needs a translation it hasn’t cached. It breaks the physical address into pieces, each selecting an entry that gives the next level’s host address. The bottom entry gives the final host page, and the remaining twelve bits select a position inside it.
The processor finds the top-level page through a single field in the VMCB (virtual machine control block): nCR3, the NPT pointer. KVM builds the table, the processor makes every selection, and our VM stays confined only as long as the NPT pointer names a page KVM still owns.
The Bug
The NPT pointer can be freed and reallocated. Between when KVM releases the page and when it reassigns nCR3, the processor follows the old pointer anyway. If that page gets reused for something else — say, host kernel memory — our guest’s page table becomes a view into the host.
Step by step:
- Guest kernel triggers an INIT reset, which frees the current NPT page.
- The guest reuses that freed page and writes its own entries.
- The processor follows nCR3 to the old page (still in flight).
- Those entries name any host physical page we choose.
- Every subsequent memory access in our guest lands wherever the forged table says.
Use after free. Classic.
The Exploit
Terra Security demonstrated both read and write:
Read: On a DigitalOcean droplet (shared AMD host), they read about 127 GB of host RAM — the memory of other tenants’ VMs. On a bare-metal AMD server with no other customers, they read the full host kernel.
Write: On their own server, they mapped a host kernel page as writable and injected 32 chosen bytes into it. A witness module confirmed the change.
A shared host with nested virtualization enabled means another customer’s VM could leak your database keys or SSH credentials sitting in host memory.
How It Was Found
This bug sat in the kernel for just under four years. It was opened by a security fix — a previous CVE’s patch removed some protection from the NPT page, and the new code path that freed the page never added a corresponding reset of the mmu context during INIT emulation. The fix for the old bug created the window; the new bug hid in it.
This is the kind of finding that comes from reading diff hunks, not fuzzing. A security patch changes when a page is freed. Nobody checks whether the old code path still resets the pointer. Four years pass.
The Fix
The upstream fix is commit e3f33b0a1d89 (“KVM: x86: Unconditionally reset MMU context when emulating INIT”). It adds a single unconditional call in the INIT emulation path:
kvm_x86_vcpu_reset(vcpu, KVM_VCPU_RESET_INIT);
Before the fix, the mmu context was reset only under certain conditions. After, it’s always reset when the guest issues INIT. No more stale pointer.
One function call. That’s the difference between a guest that sees its own memory and a guest that reads the host.
Attack Surface
The requirements narrow the scope:
- AMD processor — Intel’s EPT doesn’t have the same NPT free pattern.
- Nested virtualization enabled —
cat /sys/module/kvm_amd/parameters/nestedshould readY. - Root inside the guest — the VM needs to free and rewrite its own NPT page.
Many cloud providers don’t enable nested virt on AMD, so the actual exposure is limited. But self-hosted KVM on AMD with nested virt turned on — that’s a wide-open window to the host.
Mitigation
Update the kernel. Any kernel carrying the upstream fix is patched. Check with git log --oneline --all | grep e3f33b0a1d89 or simply update.
Disable nested virt if you don’t need it:
modprobe -r kvm_amd
modprobe kvm_amd nested=0
echo "options kvm_amd nested=0" > /etc/modprobe.d/kvm-nested-disable.conf
Check your droplets. If you’re on DigitalOcean or similar, nested virt is probably off by default. Confirm with dmesg | grep -i nested.
What It Means
CVE-2026-99312 is a reminder that hypervisor boundaries are only as strong as their weakest allocation. When you manage memory across privilege levels, a freed page is a bridge — until you close it.
Four years old. Opened by a security fix. Fixed by a single function call. The kind of bug you find when someone actually reads the code that runs after the patch lands.