CVE-2026-13212: Zephyr virtio driver calls an arbitrary function pointer from an out-of-range used-ring descriptor id
The Zephyr virtio driver does not validate the descriptor-chain head id that the virtio device writes into the used ring. In virtioisr() (drivers/virtio/virtiocommon.c), the device-written vq->used->ring[idx].id is used directly as an index into vq->recvcbs[] and vq->desc[], which are both allocated with exactly vq->num entries. recvcbs[] holds {cb, opaque} callback entries, and the indexed callback pointer is then invoked as cbe.cb(cbe.opaque, usedlen).
Because the id is consumed as a 16-bit value with no bound check, a malicious or compromised virtio backend (an untrusted hypervisor, or an untrusted hardware/peer-processor virtio device on a PCI or MMIO transport) can supply an id far beyond vq->num. This causes an out-of-bounds read of a {function pointer, argument} pair from heap memory beyond recvcbs[], after which the driver calls that attacker-shaped pointer in the guest's interrupt context. No guest privileges or user interaction are required; the backend triggers it by writing the shared used ring and raising the queue interrupt.
The result is an arbitrary / attacker-influenced function-pointer call in the Zephyr guest, i.e. a control-flow-hijack primitive that can lead to code execution or, at minimum, a reliable crash. The fix rejects any used-ring id >= vq->num before indexing recvcbs[]/desc[] or invoking the callback. This affects builds using CONFIGVIRTIO with the PCI or MMIO transport.
Affected Software
Event History
Frequently Asked Questions
Which deployments are realistically exposed?
Zephyr guests using virtio are exposed when their virtio backend is malicious or compromised. This includes untrusted hypervisors and untrusted hardware or peer-processor virtio devices using PCI or MMIO transports.
What does an attacker need to exploit this?
The attacker needs control of the virtio backend such that it can write a crafted descriptor-chain head ID into the shared used ring and raise the queue interrupt. No guest privileges or user interaction are required.
What is the practical impact of successful exploitation?
A crafted out-of-range ID causes the driver to read a callback pointer and argument from beyond the recv_cbs allocation and invoke that pointer in guest interrupt context. This provides an attacker-influenced function-pointer call and a control-flow-hijack primitive in the Zephyr guest.
How can I identify the vulnerable behavior in source?
Inspect drivers/virtio/virtio_common.c, specifically virtio_isr(), for use of vq->used->ring[idx].id as an index into vq->recv_cbs[] or vq->desc[] without verifying that the ID is less than vq->num. The relevant callback is then invoked through cbe.cb(cbe.opaque, used_len).