Skip to main content
Vulnerability Database/CVE-2026-97995

CVE-2026-97995: Linux Kernel virtio_console UAF Vulnerability

CVE-2026-97995 is a use-after-free flaw in the Linux kernel's virtio_console driver that causes slab-out-of-bounds memory access during device removal. This article covers technical details, affected versions, impact, and mitigation steps.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-97995 Overview

CVE-2026-97995 is a slab-out-of-bounds read vulnerability in the Linux kernel's virtio_console driver. The flaw occurs during device removal when leftover control messages remain on the control-out virtqueue (c_ovq). The __send_control_msg() function publishes &portdev->cpkt as the virtqueue cookie, and remove_vqs() later passes that cookie to free_buf(), which incorrectly treats it as a struct port_buffer and reads past the ports_device object. KASAN detects the invalid read during driver unbind. The upstream fix drains c_ovq without freeing, since the packet is embedded in portdev and released with it.

Critical Impact

A local user with the ability to unbind the virtio_console device triggers an out-of-bounds read in kernel memory, leading to kernel memory disclosure or system instability.

Affected Products

  • Linux kernel virtio_console driver
  • Guest virtual machines running affected Linux kernel versions with virtio-console devices
  • Distributions shipping unpatched upstream kernel sources

Discovery Timeline

  • 2026-09-25 - CVE-2026-97995 published to NVD
  • 2026-09-25 - Last updated in NVD database

Technical Details for CVE-2026-97995

Vulnerability Analysis

The virtio_console driver manages serial-like communication between a hypervisor and guest kernel through virtqueues. The control-out virtqueue (c_ovq) transports control packets built from struct virtio_console_control, which is embedded in ports_device as the cpkt field.

When a control message is enqueued, __send_control_msg() registers &portdev->cpkt as the opaque cookie associated with the buffer. During device teardown, virtcons_remove() calls remove_vqs(), which iterates each virtqueue and hands any outstanding cookies to free_buf(). That handler assumes every cookie points to a struct port_buffer and dereferences the sgpages field. Because cpkt is substantially smaller than port_buffer, the dereference reads past the end of the allocated ports_device object, producing a slab-out-of-bounds read reported by KASAN.

Root Cause

The root cause is a type confusion in the virtqueue cleanup path. The control-out queue mixes two cookie types: pointers to struct port_buffer for normal buffers and pointers to the embedded cpkt for control messages. The removal path does not differentiate between them and uniformly applies free_buf() semantics.

Attack Vector

Exploitation requires local access to trigger device unbind through sysfs (for example, writing to unbind_store under /sys/bus/virtio/drivers/virtio_console/). An attacker with sufficient privileges to unbind the driver while a control message is still pending on c_ovq triggers the invalid read. No code example is included because no verified public proof-of-concept is available; see the upstream commits referenced below for patch-level detail.

Detection Methods for CVE-2026-97995

Indicators of Compromise

  • KASAN report entries containing slab-out-of-bounds in free_buf with a call stack including remove_vqs, virtcons_remove, and unbind_store.
  • Unexpected kernel oops or warning messages tied to the virtio_console module during driver unbind.
  • Sysfs writes to unbind under /sys/bus/virtio/drivers/virtio_console/ from non-administrative contexts.

Detection Strategies

  • Enable KASAN on test and staging kernels to surface the out-of-bounds read deterministically.
  • Audit kernel ring buffer (dmesg) for virtio_console warnings correlated with driver bind/unbind events.
  • Monitor loaded kernel versions against the fixed commits listed in the patch section.

Monitoring Recommendations

  • Alert on sysfs write events targeting virtio driver bind/unbind paths through auditd rules.
  • Track kernel panic and KASAN telemetry from guest VMs into a central log pipeline for correlation.
  • Inventory guest kernel versions across virtualization fleets to identify unpatched hosts.

How to Mitigate CVE-2026-97995

Immediate Actions Required

  • Apply the upstream Linux kernel patches that drain c_ovq without freeing the embedded control packet.
  • Restrict access to virtio driver sysfs bind/unbind interfaces to privileged administrative accounts.
  • Rebuild and redeploy custom kernels after merging the fix for virtio_console.

Patch Information

The fix drains c_ovq during removal without passing the control packet to free_buf(), since the packet lives inside portdev and is released with it. Patches are available in the following upstream commits: 177ee901aa2b, 894f98e73983, a80c33488e0b, and f620c40ea686.

Workarounds

  • Avoid unbinding the virtio_console driver on production guests until patched kernels are deployed.
  • Remove the virtio_console module from guest images where serial virtio communication is not required.
  • Restrict guest administrative access that could trigger driver unbind through sysfs.
bash
# Remove virtio_console if unused and prevent reload
sudo modprobe -r virtio_console
echo "blacklist virtio_console" | sudo tee /etc/modprobe.d/blacklist-virtio_console.conf

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.