# CVE-2026-13216: Out-of-bounds stack write in Zephyr virtio PCI driver from unvalidated device-supplied capability length

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** MEDIUM 6.1
- **CVSS:** 6.1 (v3.1, CNA) `CVSS:3.1/AV:P/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H`
- **CVSS metrics:** Attack vector: Physical; Attack complexity: Low; Privileges required: None; User interaction: None; Scope: Unchanged; Confidentiality impact: None; Integrity impact: High; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.26% (percentile 11, 2026-11-28)
- **CWE:** CWE-787
- **Published:** 2026-08-25T16:05:36.964Z
- **Modified:** 2026-11-04T05:18:41.863Z

## Who should check

- Anyone running zephyrproject zephyr \>= 4.2.0, \< 4.3.2; \>= 4.4.0, \< 4.4.2

## 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.

## Affected and fixed versions

- zephyrproject zephyr: \>= 4.2.0, \< 4.3.2; \>= 4.4.0, \< 4.4.2 (cvelist)

## Mitigation

- Upgrade zephyr to 4.4.2 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2026-13216. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2026-13216.md
Affected: zephyrproject zephyr >= 4.2.0, < 4.3.2; >= 4.4.0, < 4.4.2
Fixed in: zephyrproject zephyr 4.3.2, zephyrproject zephyr 4.4.2

Steps:
1. Search this machine and project for zephyrproject zephyr: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2026-13216 being exploited?

There is no confirmed exploitation: CVE-2026-13216 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.26% chance of exploitation in the next 30 days (as of 2026-11-28).

### How serious is CVE-2026-13216?

Medium: CVSS 6.1 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2026-13216?

zephyrproject zephyr \>= 4.2.0, \< 4.3.2; \>= 4.4.0, \< 4.4.2.

### Is there a fix for CVE-2026-13216?

Yes. Fixed in zephyrproject zephyr 4.3.2, zephyrproject zephyr 4.4.2. Upgrade zephyr to 4.4.2 or later.

### How do I check if I'm affected by CVE-2026-13216?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- vendor: <https://github.com/zephyrproject-rtos/zephyr/security/advisories/GHSA-qrh3-4mvv-w667>
- patch: <https://github.com/zephyrproject-rtos/zephyr/commit/d98dacee24ad10c972d3b7281c9009d82ed351c9>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2026-13216>

HTML: <https://flawdb.com/CVE-2026-13216> · JSON: <https://flawdb.com/api/v1/entries/CVE-2026-13216>
