CVE-2026-13216: Zephyr virtio PCI - Buffer Overflow
- Cve: CVE-2026-13216
- Name: Zephyr virtio PCI - Buffer Overflow
- Description: The virtio PCI driver (drivers/virtio/virtio_pci.c) parses a device's PCI capability list during driver initialization. In virtio_pci_read_cap() the device-supplied capability length byte cap_len (read from PCI config space via pcie_conf_read()) was only checked with assert(tmp.cap_len == cap_struct_size). That assert resolves to __ASSERT_NO_MSG(), gated by CONFIG_ASSERT, which defaults off in production builds, so the value reached the copy logic completely unvalidated. The length then drives a loop that copies extra capability dwords into a fixed-size stack buffer supplied by the caller. A cap_len below the 24-byte base struct virtio_pci_cap underflows the unsigned extra_data_words count to a near-SIZE_MAX value, producing an effectively unbounded stack write; a cap_len above the caller's buffer (up to 255) writes up to roughly 228 bytes of device-controlled data past the buffer. Both are out-of-bounds writes of attacker-controlled content executed in kernel mode during boot-time device probe. The input originates from the virtio device. In the common deployment where Zephyr runs as a guest under a hypervisor, the device backend is the host, which already fully outranks the guest, so the bug yields no privilege escalation. The exploitable case is a virtio device that is untrusted relative to the Zephyr kernel — an untrusted or physical/passthrough virtio PCIe device on a bare-metal system, or a confidential-computing posture where the guest must defend against the host — where a malicious device can corrupt the kernel stack and potentially achieve code execution or a crash. The fix replaces the compiled-out assert with a runtime range check rejecting cap_len outside [sizeof(struct virtio_pci_cap), cap_struct_size] before any arithmetic or copy.
- Impact: Malicious virtio devices can corrupt kernel stack, causing crashes or potential code execution in kernel mode.
- Remediation: Apply the runtime range check fix validating cap_len before arithmetic or copy, or update to the latest Zephyr version containing the fix.
- Vulnerability type: buffer_overflow
- Vulnerability impact: remote_code_execution, denial_of_service
- Requirements: Attacker needs untrusted or physical passthrough virtio PCIe device access
- Labels source: projectdiscovery
- Severity: medium
- Cvss score: 6.1
- Cvss vector: CVSS:3.1/AV:P/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H
- Epss score: 0.00257
- Epss percentile: 0.17267
- Assignee: [email protected]
- Published at: 2026-08-25T17:17:04Z
- Age in days: 91
- Modified at: 2026-11-04T05:18:41Z
- Patch available: yes
- References total: 2
- Products total: 1
- Oss: yes
- Projects total: 1
- Advisory url: https://nvd.nist.gov/vuln/detail/CVE-2026-13216
- Nvd status: awaiting_analysis
- Checked, none or zero: known exploited entries, nuclei templates, public exploits total, public exploits capped, public exploits, rejected by nvd
- Not known: requirement type, hackerone
Cwe
| Id | Name |
|---|---|
| CWE-787 | Out-of-bounds Write |
References
| Url | Source | Tags |
|---|---|---|
| https://github.com/zephyrproject-rtos/zephyr/commit/d98dacee24ad10c972d3b7281c9009d82ed351c9 | nvd | |
| https://github.com/zephyrproject-rtos/zephyr/security/advisories/GHSA-qrh3-4mvv-w667 | nvd |
Products
| Product | Affected | Platform bound | Sources | Url |
|---|---|---|---|---|
| zephyrproject:zephyr | >= 4.4.0, < 4.4.2; >= 4.2.0, < 4.3.2 | no | cna_alias | /v1/products/zephyrproject/zephyr |
Projects
| Repository | Link kinds | Indexed | Url |
|---|---|---|---|
| zephyrproject-rtos/zephyr | commit, fix, security_advisory | yes | /v1/repositories/zephyrproject-rtos/zephyr |
Index
- Checked, none or zero: repositories, repositories high signal, packages
Exploitation
- Checked, none or zero: known exploited, known exploited by, exploitation seen, public exploit, public exploit count, initial access, remote, authentication required
- Not known: known exploited since, vulncheck known exploited since, public exploit first date, nuclei template, initial access since, hackerone reports, exposed hosts