5.5medium
usb: gadget: f_ncm: validate minimum block_len in ncm_unwrap_ntb()
- Severity
- 5.5medium CVSS:3.1 by redhat-SADP
- Exploit likelihood
- 0.14% (higher than 3% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- Linux
Description
In the Linux kernel, the following vulnerability has been resolved: usb: gadget: f_ncm: validate minimum block_len in ncm_unwrap_ntb() The block_len read from the host-supplied NTB header is checked against ntb_max but has no lower bound. When block_len is smaller than opts->ndp_size, the bounds check of: ndp_index > (block_len - opts->ndp_size) will underflow producing a huge unsigned value that ndp_index can never exceed, defeating the check entirely. The same underflow occurs in the datagram index checks against block_len - opts->dpe_size. With those checks neutered, a malicious USB host can choose ndp_index and datagram offsets that point past the actual transfer, and the skb_put_data() copies adjacent kernel memory into the network skb. Fix this by rejecting block lengths that cannot hold at least the NTB header plus one NDP. This will make block_len - opts->ndp_size and block_len - opts->dpe_size both well-defined. Commit 8d2b1a1ec9f5 ("CDC-NCM: avoid overflow in sanity checking") fixed a related class of issues on the host side of NCM.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| Linux Linux | from 2b74b0a04d3e9f9f08ff026e5663dce88ff94e52 before 068a7f2749fff6462a0a908ec415b885fe430f50, from 2b74b0a04d3e9f9f08ff026e5663dce88ff94e52 before 1425655c2870054c3ab4712e2b6dbdd331597ada, from 2b74b0a04d3e9f9f08ff026e5663dce88ff94e52 before 8b3b7bd3c02f98634baaf36c7fc7ac915f6517ca, from 2b74b0a04d3e9f9f08ff026e5663dce88ff94e52 before 0f156bb5334e588034ca68ac2ee92b23f66e56e7, from 2b74b0a04d3e9f9f08ff026e5663dce88ff94e52 before 8757a2593631443648218244b9788e193ae0fdc1, from 2b74b0a04d3e9f9f08ff026e5663dce88ff94e52 before 6762f8a95772265dd0c2ffe7f400493f3115b135, from 2b74b0a04d3e9f9f08ff026e5663dce88ff94e52 before d58ba8f6546232f8414f396c189297dbee03f1a7, from 2b74b0a04d3e9f9f08ff026e5663dce88ff94e52 before 74908b0318d1df1188457040b8714ff4d4b68126 and 12 more Not affected: before 5.9, from 5.10.258 up to 5.10.*, from 5.15.209 up to 5.15.*, from 6.1.175 up to 6.1.*, from 6.6.136 up to 6.6.*, from 6.12.83 up to 6.12.* | CVE List |
| kernel | Not specified | CVE List |
| kernel-rt | Not specified | CVE List |
| linux linux_kernel | from 5.9 before 6.6.136, from 6.12 before 6.12.83, from 6.13 before 6.18.24, from 6.19 before 6.19.14, from 7.0 before 7.0.1 | NVD |
All scores
| redhat-SADP | 5.5medium CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H |
| NVD | 5.5medium CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H |
Classification
What each source says
CVE List
In the Linux kernel, the following vulnerability has been resolved: usb: gadget: f_ncm: validate minimum block_len in ncm_unwrap_ntb() The block_len read from the host-supplied NTB header is checked against ntb_max but has no lower bound. When block_len is smaller than opts->ndp_size, the bounds check of: ndp_index > (block_len - opts->ndp_size) will underflow producing a huge unsigned value that ndp_index can never exceed, defeating the check entirely. The same underflow occurs in the datagram index checks against block_len - opts->dpe_size. With those checks neutered, a malicious USB host can choose ndp_index and datagram offsets that point past the actual transfer, and the skb_put_data() copies adjacent kernel memory into the network skb. Fix this by rejecting block lengths that cannot hold at least the NTB header plus one NDP. This will make block_len - opts->ndp_size and block_len - opts->dpe_size both well-defined. Commit 8d2b1a1ec9f5 ("CDC-NCM: avoid overflow in sanity checking") fixed a related class of issues on the host side of NCM.
NVD (es)
En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta: usb: gadget: f_ncm: validar la longitud mínima de bloque (block_len) en ncm_unwrap_ntb() La block_len leída del encabezado NTB proporcionado por el host se verifica contra ntb_max pero no tiene un límite inferior. Cuando block_len es menor que opts -> ndp_size, la verificación de límites de: ndp_index > (block_len - opts -> ndp_size) se desbordará por debajo, produciendo un valor sin signo enorme que ndp_index nunca puede exceder, anulando la verificación por completo. El mismo desbordamiento por debajo ocurre en las verificaciones del índice del datagrama contra block_len - opts -> dpe_size. Con esas verificaciones neutralizadas, un host USB malicioso puede elegir ndp_index y desplazamientos de datagrama que apuntan más allá de la transferencia real, y skb_put_data() copia memoria adyacente del kernel en el skb de red. Solucione esto rechazando las longitudes de bloque que no pueden contener al menos el encabezado NTB más un NDP. Esto hará que block_len - opts -> ndp_size y block_len - opts -> dpe_size estén ambos bien definidos. El commit 8d2b1a1ec9f5 (’CDC-NCM: avoid overflow in sanity checking’) solucionó una clase de problemas relacionados en el lado del host de NCM.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-31617 changed 2026-10-15 | CVE Terms of Use |
| NVD | CVE-2026-31617 changed 2026-11-11 | Public domain |