Skip to content

NULL-pointer dereference DoS in MAX32 USB device controller transfer-completion handlers

Moderate
d3zd3z published GHSA-58p9-6mjq-rf2m Jul 5, 2026

Software

zephyr

Affected versions

>= 4.2.0, <= 4.4.0

Patched versions

4.5.0

Description

The MAX32xxx USB device controller driver (drivers/usb/udc/udc_max32.c, compatible adi_max32_usbhs) dereferenced an endpoint buffer in its OUT and IN transfer-completion handlers without checking it for NULL. udc_event_xfer_out_done() called net_buf_add(buf, ep_request->actlen) immediately after buf = udc_buf_get(ep_cfg), where udc_buf_get() returns NULL when the endpoint FIFO is empty.

A transfer-completion event is queued from interrupt context and processed asynchronously by the driver thread; between queuing and processing, the endpoint FIFO can be drained by host-controlled control flow — in particular udc_setup_received() drains the EP0 OUT/IN FIFOs whenever a new SETUP packet arrives, and dequeue/disable/purge paths drain it likewise.

A USB host that aborts an in-flight EP0 control transfer with a new SETUP packet (legal USB behavior) can therefore cause a stale XFER_OUT_DONE event to be processed against an empty FIFO, producing net_buf_add(NULL, ...), a near-NULL pointer dereference that faults and crashes the device. No authentication is required; the attacker is the USB host the device is connected to (physical bus access). Impact is denial of service (device crash).

The defect was introduced when the MAX32 UDC driver was added and shipped in Zephyr v4.4.0. The fix adds NULL-buffer checks that return early with UDC_EVT_ERROR/-ENOBUFS in both the OUT-done and IN-done handlers.

Affected components

  • drivers/usb/udc/udc_max32.c

Affected versions

v4.4.0 (MAX32 UDC driver, adi_max32_usbhs)

Fix

Fixed (merged) in a0d8f78

Projected fixed version: 4.5.0 (the fix is merged on main but not yet released; this forecast should be confirmed against the actual release).

Introduced by: 65883ed (drivers: udc: Add MAX32xxx UDC driver, 2025-04-09); shipped in v4.4.0

Evidence

  • drivers/usb/udc/udc_max32.c:242-249 — post-fix udc_event_xfer_out_done adds NULL check before net_buf_add(buf, actlen); pre-fix (git show ^) called net_buf_add on the unchecked buf
  • drivers/usb/udc/udc_common.c:79-82 — udc_buf_get is k_fifo_get(..., K_NO_WAIT), returns NULL on empty FIFO
  • lib/net_buf/buf_simple.c net_buf_simple_add — does buf->len += len, dereferencing near-NULL when buf is NULL
  • drivers/usb/udc/udc_common.c:118-143 — udc_setup_received drains EP0 OUT/IN FIFOs on a new SETUP packet (host-controlled), the FIFO-drain that races the queued completion event
  • drivers/usb/udc/udc_max32.c:296-327 — thread handler dispatches independent msgq events (SETUP vs XFER_OUT_DONE) whose order follows host/IRQ timing
  • drivers/usb/udc/udc_max32.c:84-93 — OUT-done ISR callback queues XFER_OUT_DONE without holding any buffer reference
  • git: file added by 65883ed (2025-04-09) and present in v4.4.0 tag — vulnerable code shipped

Patches

Branch Pull request Status
main #108447 merged
v4.4-branch #109517 merged
v4.3-branch #110875 superseded

For more information

If you have any questions or comments about this advisory:

embargo: 2026-07-05

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Physical
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:P/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

CVE ID

CVE-2026-10656

Weaknesses

NULL Pointer Dereference

The product dereferences a pointer that it expects to be valid but is NULL. Learn more on MITRE.