4.6medium
NULL pointer dereference in USB DFU device_next download handler (handle_download)
- Severity
- 4.6medium CVSS:3.1 by zephyr
- Exploit likelihood
- 0.17% (higher than 6% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- zephyr
Description
The USB DFU class implementation in Zephyr's new (experimental) device_next USB device stack contains a NULL pointer dereference in handle_download() (subsys/usb/device_next/class/usbd_dfu.c). The handler computes MIN(setup->wLength, buf->len) and passes buf->data to the image write callback without checking that the buf net_buf pointer is non-NULL. The handler is reached over the USB control endpoint, driven by the USB host. For a DFU_DNLOAD (download) request with no Data OUT stage — notably the zero-length terminating download that the DFU protocol uses to end a firmware transfer — the USB core invokes the class handler with a NULL buffer. After the device has been advanced to the DFU_DNLOAD_IDLE state (by sending one valid download block and a GET_STATUS), a zero-length DFU_DNLOAD reaches handle_download() with buf == NULL, dereferencing it. The result is a NULL+offset read that triggers a fatal CPU fault, i.e. a denial of service (device crash/reset). The attacker is whatever controls the USB host the device is attached to; DFU download support must be enabled with a registered image. There is no memory corruption or information disclosure — impact is limited to availability. The fix adds an explicit if (buf != NULL) guard so the callback receives a zero-length, NULL-data transfer instead of crashing.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| zephyr | from 4.4.0 before 4.4.2 | CVE List |
Classification
SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.
What each source says
CVE List
The USB DFU class implementation in Zephyr's new (experimental) device_next USB device stack contains a NULL pointer dereference in handle_download() (subsys/usb/device_next/class/usbd_dfu.c). The handler computes MIN(setup->wLength, buf->len) and passes buf->data to the image write callback without checking that the buf net_buf pointer is non-NULL. The handler is reached over the USB control endpoint, driven by the USB host. For a DFU_DNLOAD (download) request with no Data OUT stage — notably the zero-length terminating download that the DFU protocol uses to end a firmware transfer — the USB core invokes the class handler with a NULL buffer. After the device has been advanced to the DFU_DNLOAD_IDLE state (by sending one valid download block and a GET_STATUS), a zero-length DFU_DNLOAD reaches handle_download() with buf == NULL, dereferencing it. The result is a NULL+offset read that triggers a fatal CPU fault, i.e. a denial of service (device crash/reset). The attacker is whatever controls the USB host the device is attached to; DFU download support must be enabled with a registered image. There is no memory corruption or information disclosure — impact is limited to availability. The fix adds an explicit if (buf != NULL) guard so the callback receives a zero-length, NULL-data transfer instead of crashing.
NVD (es)
La implementación de la clase USB DFU en la nueva (experimental) pila de dispositivos USB device_next de Zephyr contiene una desreferencia de puntero NULL en handle_download() (subsys/usb/device_next/class/usbd_dfu.c). El gestor calcula MIN(setup -> wLength, buf -> len) y pasa buf -> data a la función de devolución de llamada de escritura de imagen sin verificar que el puntero net_buf de buf no sea NULL. Se accede al gestor a través del punto final de control USB, impulsado por el host USB. Para una solicitud DFU_DNLOAD (descarga) sin una etapa de salida de datos (Data OUT) - en particular, la descarga de terminación de longitud cero que el protocolo DFU utiliza para finalizar una transferencia de firmware - el núcleo USB invoca al gestor de clase con un búfer NULL. Después de que el dispositivo ha avanzado al estado DFU_DNLOAD_IDLE (enviando un bloque de descarga válido y un GET_STATUS), una DFU_DNLOAD de longitud cero llega a handle_download() con buf == NULL, desreferenciándolo. El resultado es una lectura NULL+offset que desencadena un fallo fatal de la CPU, es decir, una denegación de servicio (bloqueo/reinicio del dispositivo). El atacante es quien controla el host USB al que está conectado el dispositivo; el soporte de descarga DFU debe estar habilitado con una imagen registrada. No hay corrupción de memoria ni revelación de información - el impacto se limita a la disponibilidad. La solución añade una protección explícita if (buf != NULL) para que la función de devolución de llamada reciba una transferencia de longitud cero y datos NULL en lugar de bloquearse.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-12051 changed 2026-08-31 | CVE Terms of Use |
| NVD | CVE-2026-12051 changed 2026-10-23 | Public domain |