blog.rust.gay

KVM's AMD nested fix left a pointer behind

On November 20, Terra Security and DigitalOcean disclosed CVE-2026-99312, a KVM bug that let a guest on an AMD host read about 127 GB of the host's memory. The guest did not need a second vulnerability or a network path into the hypervisor. It needed root inside a virtual machine on a host that had nested virtualization enabled.

The uncomfortable part is where the bug came from. It was not introduced by a new feature. It was introduced by a 2022 fix for a different nested-virtualization flaw. That patch switched a reset path back to the outer VM's control block but missed one page-table pointer. The pointer stayed stale for almost four years.

The pointer that survived INIT

KVM confines each virtual machine with a nested page table. The table translates the guest's physical addresses into the host's real memory, and the processor finds it through a pointer kept for each virtual CPU. When a nested VM is reset, KVM is supposed to restore the outer VM's state, including that pointer.

The reset in question is INIT, a signal that stops a virtual CPU and returns it to a known state. In the vulnerable path, KVM reset the control block but did not restore the nested-page-table pointer. The pointer still referred to a page the kernel had already freed. That alone would be a stale reference, not a useful exploit. The second half is what made it dangerous: once the kernel reused the freed page for something else, the guest could write its own translation entries into it. The processor then walked those entries as if they were the real nested page table.

That is enough to name any physical page on the host. In DigitalOcean's test, the first thing that came back was the host's kernel version banner, followed by roughly 127 GB of host RAM mapped read-only. On the researcher's own bare-metal AMD server, with no other tenants attached, the guest wrote 32 chosen bytes into a live page of host kernel memory. A witness module in that kernel confirmed the change.

Both tests started with root inside a guest the researchers controlled. This is not a bug an attacker reaches over the network. It is a bug that turns a compromised or malicious tenant into a host-memory reader, which is exactly the boundary a hypervisor is supposed to hold.

A hardening patch that hardened the wrong thing

The flaw was created by the fix for CVE-2022-3344, another nested-virtualization bug. That 2022 patch moved a reset path back to the outer VM's control block. It handled the control block correctly and missed the page-table pointer, according to Terra's analysis. The error then sat in the kernel for just under four years.

The affected code entered Linux 6.1 in 2022 and was carried into the 5.15.81 and 6.0.11 releases. That range matters because it covers kernels that distributions still support and that cloud images still ship. A bug that lives in a stable branch for four years is not an edge case. It is part of the installed base.

Terra's earlier work on "PatchSlop" found that the fix for one kernel bug introduced 3.2% of kernel vulnerabilities. That number is a useful corrective to the way patches are usually discussed. A fix is reviewed against the bug it is meant to close. It is rarely reviewed against the state it leaves behind: which pointers are still live, which locks are still held, which reset paths now run in a different order.

KVM maintainers were told about the problem on October 21. The fix was merged on November 2 and shipped in stable kernels on November 17 in 7.3.5, 6.18.64 and 6.12.118. The turnaround was fast once the bug was understood. The four years before that are the part worth thinking about.

Reachability, not severity

The bug is narrower than the headline suggests. It affects only hosts with AMD processors, and only when nested virtualization is enabled. Intel hosts are not affected because the vulnerable code exists only in KVM's support for nested virtualization on AMD. Many cloud providers were not exposed because they do not enable nested virtualization on AMD at all.

The default is less reassuring. Nested virtualization is on by default in the kvm_amd module. A provider that never changed the setting is exposed. A provider that deliberately turned it off is not. That is why the same CVE can be critical for one fleet and irrelevant for another, and why the list of affected providers is a configuration question rather than a vendor question.

Severity ratings disagree in a way that is worth reading closely. The Linux kernel's CVE team scores the flaw 8.8 out of 10, with high impact on confidentiality, integrity and availability. Red Hat's preliminary assessment rates it Moderate at 5.6 and treats the impact as denial of service only. DigitalOcean treated it as critical for its own shared cloud. None of these is irrational. They are answering different questions. The kernel team is scoring the primitive. Red Hat is scoring what it believes an attacker can do in the configurations it supports. DigitalOcean is scoring what it saw on a multi-tenant fleet where a read of host memory is a tenant-isolation failure.

The practical lesson is that a CVSS number cannot tell you whether your hosts are reachable. The configuration can.

Nested virtualization is not a fringe setting. CI systems use it to run a VM inside a VM, labs use it to test hypervisors, and some Kubernetes setups rely on it for sandboxed workloads. Turning it off closes this path completely, but it also breaks tenants who depend on it. That is why the mitigation has to be time-boxed: disable nested virtualization now if you cannot patch, then patch and reboot, then decide whether the tenant actually needs nested virtualization at all.

The patch is in the host kernel

The fix lives in the host kernel. Updating the operating system inside a VM changes nothing. A host also keeps running its old kernel until it is rebooted, so installing a fixed package is not the same as being fixed.

Operators who run their own AMD KVM hosts have two options. The first is to update the host kernel and reboot. The second, if they cannot update yet, is to turn nested virtualization off. On a host that uses the kvm_amd module, the setting can be checked with:

cat /sys/module/kvm_amd/parameters/nested

A value of 1 or Y means nested virtualization is on. To disable it persistently, add options kvm_amd nested=0 to the module configuration and reboot. Changing the parameter at runtime affects new VMs, but the persistent fix is the module option plus a reboot, and a newly installed kernel does not protect the host until the reboot either. After rebooting, confirm with uname -r and read the parameter again.

Distribution support lagged at publication. Debian's security tracker listed the kernels in all of its releases as vulnerable, with a fix only in unstable. Ubuntu rated the flaw High and listed its kernels as vulnerable with no fixed package released. Red Hat listed Enterprise Linux 9 and 10 as affected with the fix deferred, and Enterprise Linux 8 as not affected. Those statuses will change, but they are a reminder that "the upstream fix exists" and "my host is fixed" are different statements.

The inventory problem is harder than it looks. A host may be managed by a cloud control plane, a hypervisor appliance, or a colo provider. The useful questions are not "is the kernel package new" but "which kernel is running, when was the last reboot, and is nested virtualization on." A package inventory that stops at the version string will miss a host that installed the fix and never rebooted.

What is still unknown

There are no reports of the flaw being used outside research. No exploit code has been published. There is also no published guidance for detecting a past attempt. That last gap is the one that should make operators uncomfortable. Patching forward is possible. Proving that nobody read host memory before the patch is not.

The write primitive was demonstrated on a bare-metal machine with no other tenants, not on a shared cloud host. That does not make the read primitive harmless. A read of host memory can expose another tenant's keys, tokens or model weights, and the read was demonstrated on a production cloud. The difference between read and write matters for severity, but it does not make the isolation failure go away.

Conclusion

The usual post-incident advice is to patch and move on. The better advice is to treat this as a patch-review problem. The 2022 fix was a reasonable change that closed a real bug. It also left a pointer live across a reset path, and nobody caught it for four years. If a fix can create a vulnerability, then a fix needs the same adversarial review as a feature, including the state transitions it touches and the paths it does not execute in the reproducer.

The second lesson is about reachability. A CVE score describes a primitive. It does not describe your fleet. Before deciding that a hypervisor bug is someone else's problem, check whether nested virtualization is on, whether the host kernel is actually running the fixed build, and whether the reboot happened. Those three questions are more useful than the severity number.

Terra's disclosure is a good piece of research, and the fix is already in the stable trees. The part that should stay with us is the origin story: a security patch, written to make a hypervisor safer, left a pointer that made it less safe. That is not an argument against patching. It is an argument for reviewing patches as code that can be wrong in new ways.

Sources


← back to posts