Sceawere
Vulnerability Detail
CVE-2026-17050UPDATED Verified Sceawere Triage Sources: NVD / CISA KEV
USB Host Stack Double Free
Vulnerability Metadata
- Severity
- Medium
- Score / CVSS
- 5.7
- Creation Date
- 3h ago
- Vendor
- zephyrproject
- Product
- zephyr
- Attack Type
- use-after-free
- Vector String
- CVSS:3.1/AV:P/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:H
- Attack Complexity
- LOW
Narrative and Response
Description
The experimental USB host stack allocates a per-device configuration-descriptor buffer, udev->cfg_desc, from the dedicated usb_device_heap in usbh_device_set_configuration() (subsys/usb/host/usbh_device.c). On three failure paths — a failed full-length GET_DESCRIPTOR(CONFIGURATION) read, a mismatch between the short and full descriptor reads, and a rejected descriptor in parse_configuration_descriptor() — the buffer was released with k_heap_free() but the pointer was left dangling. The cleanup in usbh_device_free() is guarded only by if (udev->cfg_desc != NULL), so it frees the same block a second time. The path is driven entirely by the attached peripheral: usbh_device_connect() calls usbh_device_init(), which ends in usbh_device_set_configuration(), and on failure usbh_device_connect() calls usbh_device_free(). On v4.4.x this happens during the same enumeration, with no unplug required; on v4.1.0–v4.3.x the second free instead arrives via dev_removed_handler()/dev_connected_handler() in subsys/usb/host/usbh_core.c, so it requires a removal or duplicate-connect event after the failed enumeration — a sequence the attached device fully controls. A malicious or malformed USB device only has to answer the first 9-byte configuration-descriptor request with a well-formed header and then fail any of the three checks, for example by returning a full descriptor whose interface count disagrees with bNumInterfaces, or by answering the second read with different bytes. The result is a double free on usb_device_heap. On builds where lib/heap hardening is active (the current default CONFIG_SYS_HEAP_HARDENING_BASIC), sys_heap_free() detects the already-free chunk and calls k_panic(), giving a deterministic, peripheral-triggered denial of service of the USB host. On builds without that detection — earlier releases, or CONFIG_SYS_HEAP_HARDENING_NONE — the second free manipulates a chunk already on the free list, corrupting the heap's free list so that later allocations can return overlapping or invalid blocks. Exploitation beyond denial of service is bounded by the fact that usb_device_heap is a small dedicated heap (CONFIG_USBH_USB_DEVICE_HEAP, default 1024 bytes) whose only client is this descriptor buffer, and by CONFIG_USB_HOST_STACK being marked experimental and disabled by default. The fix sets udev->cfg_desc = NULL after every k_heap_free(), making the cleanup guard sound.
Executive Summary
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Technical Details
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Mitigations
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
References
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Additional Metadata
{
"score": "5.7",
"pubDate": "2026-09-21T17:17:34.020Z",
"pubdate": "2026-09-21T17:17:34.020Z",
"executiveSummary": "The experimental USB host stack within the operating system contains a critical double-free vulnerability residing in the descriptor management logic of subsys/usb/host/usbh_device.c. This flaw occurs when the usb_device_heap is improperly managed during failed configuration descriptor acquisition, leaving a dangling pointer in the udev structure.\nWhen a malicious or malformed USB device triggers specific failure paths during enumeration, the system releases the descriptor buffer but fails to nullify the pointer. Subsequent device cleanup operations trigger a second free on the same memory address. The impact ranges from a deterministic denial-of-service (DoS) via kernel panic under heap hardening configurations, to arbitrary heap metadata corruption in systems lacking such protections.\nThis vulnerability is accessible to any attacker capable of presenting a USB device to the host. While the USB host stack is experimental and typically disabled by default, the vulnerability presents a significant risk to systems where it is enabled, as it allows remote, unauthenticated attackers to crash the host system or potentially escalate to heap exploitation.\nThe attack is peripheral-triggered and does not require complex software-level exploits, relying instead on the device's adherence to the USB protocol in a way that forces the host into a vulnerable error-handling state.",
"technicalDetails": "Root Cause: The vulnerability stems from improper state management in usbh_device_set_configuration() within subsys/usb/host/usbh_device.c. The function allocates memory for the configuration descriptor via k_heap_free() across three distinct error conditions: (1) failure of the full-length GET_DESCRIPTOR(CONFIGURATION) request, (2) descriptor length mismatch between initial and subsequent reads, and (3) validation failure within parse_configuration_descriptor(). In these instances, the buffer is correctly freed, but the udev->cfg_desc pointer is not set to NULL. The subsequent destruction of the device structure via usbh_device_free() performs an unchecked or improperly guarded free, resulting in a classic double-free vulnerability.\nExploitation Path: The vulnerability is exploited by a crafted USB device that initiates a standard enumeration sequence. The device provides a valid 9-byte header to pass initial checks but subsequently triggers one of the defined error conditions. On affected versions (v4.4.x), this is accomplished within a single enumeration attempt. On versions v4.1.0–v4.3.x, the attacker must provide a sequence of events—such as a removal followed by a duplicate-connect event—to trigger the dev_removed_handler() or dev_connected_handler() in subsys/usb/host/usbh_core.c, ensuring the second free execution path is reached.\nVulnerability Impact: Under configurations enabled with CONFIG_SYS_HEAP_HARDENING_BASIC, the sys_heap_free() implementation identifies the double-free attempt and triggers a k_panic(), resulting in immediate host denial-of-service. In environments where heap hardening is disabled (CONFIG_SYS_HEAP_HARDENING_NONE), the second call to k_heap_free() corrupts the internal free list of the usb_device_heap. Because the heap is dedicated solely to these descriptors (typically sized at 1024 bytes), exploitation of the corrupted heap metadata could theoretically allow an attacker to influence subsequent allocations of device structures, though this is constrained by the experimental nature and limited scope of the affected heap.\nAffected Scope: The vulnerability is constrained to the USB host stack, which is experimental and disabled by default. Authentication is not required, as the vector is purely physical/peripheral. Attackers require direct access to the USB host port to inject the malicious device descriptor sequence."
}