# CVE-2026-12052: Out-of-bounds write in USB CDC NCM control handler when host wLength is smaller than the response

> A USB host can trigger an out-of-bounds write in the Zephyr RTOS CDC NCM handler, causing memory corruption and denial of service.

- **Severity:** Medium 5.2 (`CVSS:3.1/AV:P/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Local or same network only
- **Victim action needed:** Not needed
- **Fix available:** No
- **Published:** 11 Aug 2026
- **Updated:** 11 Aug 2026
- **Also known as:** GHSA-vr4p-6rg5-qgpx

## What is CVE-2026-12052?

CVE-2026-12052 is a medium-severity memory corruption vulnerability in zephyrproject zephyr, published on 11 Aug 2026. It can only be exploited from the same machine or local network, with no action from the victim.

### Official description

The USB device-side CDC NCM class control-to-host handler usbd_cdc_ncm_cth in subsys/usb/device_next/class/usbd_cdc_ncm.c builds a fixed-size response for the GET_NTB_PARAMETERS (28-byte struct ntb_parameters) and GET_NTB_INPUT_SIZE (8-byte struct ntb_input_size) class requests and copies the whole structure into the control DATA IN buffer with net_buf_add_mem(buf, ..., sizeof(...)), ignoring the host-supplied wLength.

The control DATA IN buffer is allocated by the USB stack with a capacity of exactly wLength bytes (usbd_ep_ctrl_data_in_alloc -> udc_ctrl_data_alloc -> net_buf_alloc_len(&udc_ep_pool, wLength); no round-up is applied for the IN endpoint). Because net_buf_add_mem/net_buf_simple_add only bounds the copy with an __ASSERT_NO_MSG, which is compiled out in production builds, a host that issues one of these standard CDC NCM control requests with a wLength smaller than the response structure (e.g. wLength = 1) causes the handler to memcpy up to 27 bytes past the end of the allocated pool buffer.

The request fields come straight from the USB SETUP packet, so any host (or USB interposer) the Zephyr device enumerates against can trigger the overflow with no authentication once an image built with the device_next USB stack and the CDC NCM class is connected. The out-of-bounds write corrupts adjacent allocations and metadata in the shared udc_ep_pool, primarily causing memory corruption and denial of service of the USB stack; the overflow length is bounded (<= 27 bytes) and the written content is fixed device constants, and the bug reads nothing back so there is no information disclosure. The fix clamps the copy with MIN(sizeof(...), setup->wLength), matching the existing CDC ACM handler.

Weakness: CWE-787 (Out-of-bounds Write)

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


## How do I fix CVE-2026-12052?

No fix has been published for CVE-2026-12052 yet. Limit exposure of the affected software until one is available.

## Is CVE-2026-12052 being exploited?

There is no known exploitation of CVE-2026-12052 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-12052 and fix it if it is affected.

What it is: CVE-2026-12052 is a medium-severity memory corruption vulnerability in zephyrproject zephyr, published on 11 Aug 2026. It can only be exploited from the same machine or local network, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2026-12052 in the wild and no public exploit code.

Affected product: zephyrproject zephyr. No package-level version data is available, so check the vendor advisory linked from the reference page.

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-12052/ (Markdown: https://insights.sbomify.com/CVE-2026-12052/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-12052
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-12052
- OSV: https://osv.dev/vulnerability/CVE-2026-12052

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-12052/
Summaries are generated and may contain mistakes; the official description above is the record.
