CVE-2024-58083: KVM: Explicitly verify target vCPU is online in kvm_get_vcpu()
In the Linux kernel, the following vulnerability has been resolved:
KVM: Explicitly verify target vCPU is online in kvm_get_vcpu()
Explicitly verify the target vCPU is fully online _prior_ to clamping the
index in kvm_get_vcpu(). If the index is "bad", the nospec clamping will
generate '0', i.e. KVM will return vCPU0 instead of NULL.
In practice, the bug is unlikely to cause problems, as it will only come
into play if userspace or the guest is buggy or misbehaving, e.g. KVM may
send interrupts to vCPU0 instead of dropping them on the floor.
However, returning vCPU0 when it shouldn't exist per online_vcpus is
problematic now that KVM uses an xarray for the vCPUs array, as KVM needs
to insert into the xarray before publishing the vCPU to userspace (see
commit c5b077549136 ("KVM: Convert the kvm->vcpus array to a xarray")),
i.e. before vCPU creation is guaranteed to succeed.
As a result, incorrectly providing access to vCPU0 will trigger a
use-after-free if vCPU0 is dereferenced and kvm_vm_ioctl_create_vcpu()
bails out of vCPU creation due to an error and frees vCPU0. Commit
afb2acb2e3a3 ("KVM: Fix vcpu_array[0] races") papered over that issue, but
in doing so introduced an unsolvable teardown conundrum. Preventing
accesses to vCPU0 before it's fully online will allow reverting commit
afb2acb2e3a3, without re-introducing the vcpu_array[0] UAF race.
Security readout for executives and security teams
Plain-English summary
Linux KVM can return vCPU0 when an invalid or not-yet-online virtual CPU is requested. If vCPU creation then fails, later code may access freed memory, potentially affecting confidentiality, integrity, and availability. The issue requires local, low-privileged access and unusual buggy or misbehaving guest or userspace behavior, making it important for virtualization hosts but not a routine remote threat.
Executive priority
Treat this as a high-priority virtualization-host patching item, especially for multi-tenant systems or hosts exposed to untrusted guests or local users. It does not warrant an internet-wide emergency response based on this bundle because the attack vector is local and exploitation is unconfirmed. Expedite inventory, vendor-version confirmation, controlled updating, and reboot verification.
Technical view
kvm_get_vcpu() performed nospec index clamping before confirming the target was fully online. A bad index therefore became zero and returned vCPU0 rather than NULL. Because xarray publication precedes guaranteed vCPU-creation success, an error could free vCPU0 while another path retained access, enabling a CWE-416 use-after-free. The correction validates online_vcpus before clamping and access.
Likely exposure
Exposure is concentrated on KVM systems running affected Linux kernels, particularly where local users, virtualization processes, or guests exercise vCPU lifecycle paths. The bundle lists affected releases from 5.1 through 6.14 but mixes versions and commit identifiers; distribution backports may change status. Confirm each running vendor kernel against its advisory or the cited stable fixes.
Exploitation context
KEV is false, and the supplied sources do not report active exploitation or a public proof of concept. The kernel description calls practical impact unlikely and associates triggering with buggy or misbehaving userspace or guests. CVSS 3.1 scores it 7.8: local access, low complexity, low privileges, no user interaction, and high modeled impact.
Researcher notes
Review vCPU publication, failure cleanup, and concurrent callers of kvm_get_vcpu(). The critical invariant is that callers cannot receive a vCPU before online_vcpus publishes it. The bundle establishes a possible use-after-free but provides no demonstrated exploitability, affected-architecture breakdown, or evidence of guest-to-host code execution. Version assessment requires branch-specific commit or distribution-package analysis.
Mitigation direction
Apply a vendor-supported kernel update containing the appropriate cited Linux stable fix.
Reboot into the updated kernel and confirm the running release and package.
Prioritize KVM hosts accepting untrusted guests or local virtualization users.
If patching is delayed, consult vendor guidance; supplied sources name no temporary workaround.
Validation and detection
Inventory KVM-enabled hosts and record each exact running kernel package and build.
Map each build to its distribution advisory or cited stable-branch correction.
Confirm the patched kernel is active after reboot, not merely installed.
Review scanner findings against vendor backports to avoid version-only misclassification.
Verify KVM workloads and vCPU lifecycle tests operate normally after updating.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cwe · low confidence lookup
CWE-416: Exact CWE lookup
Use the exact CWE identifier as the starting point before reviewing related ATT&CK behavior. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
2CVSS vectors
3Timeline events
2ADP providers
11Source links
SSVC decision data
CISA-ADPCISA Coordinator
Timestamp
Version
2.0.3
Exploitation: noneAutomatable: noTechnical Impact: total
CVSS vector scores
2 official scores
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.
CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.
CWE-416 · source CWE mapping
Use After Free
Use After Free represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.