CVE-2024-26996
Severity CVSS v4.0:
Pending analysis
Type:
CWE-416
Use After Free
Publication date:
01/05/2024
Last modified:
04/08/2026
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
usb: gadget: f_ncm: Fix UAF ncm object at re-bind after usb ep transport error<br />
<br />
When ncm function is working and then stop usb0 interface for link down,<br />
eth_stop() is called. At this piont, accidentally if usb transport error<br />
should happen in usb_ep_enable(), &#39;in_ep&#39; and/or &#39;out_ep&#39; may not be enabled.<br />
<br />
After that, ncm_disable() is called to disable for ncm unbind<br />
but gether_disconnect() is never called since &#39;in_ep&#39; is not enabled.<br />
<br />
As the result, ncm object is released in ncm unbind<br />
but &#39;dev->port_usb&#39; associated to &#39;ncm->port&#39; is not NULL.<br />
<br />
And when ncm bind again to recover netdev, ncm object is reallocated<br />
but usb0 interface is already associated to previous released ncm object.<br />
<br />
Therefore, once usb0 interface is up and eth_start_xmit() is called,<br />
released ncm object is dereferrenced and it might cause use-after-free memory.<br />
<br />
[function unlink via configfs]<br />
usb0: eth_stop dev->port_usb=ffffff9b179c3200<br />
--> error happens in usb_ep_enable().<br />
NCM: ncm_disable: ncm=ffffff9b179c3200<br />
--> no gether_disconnect() since ncm->port.in_ep->enabled is false.<br />
NCM: ncm_unbind: ncm unbind ncm=ffffff9b179c3200<br />
NCM: ncm_free: ncm free ncm=ffffff9b179c3200 port_usb=ffffff9b179c3200 port_usb=ffffff9b179c3200 dev->wrap()<br />
Unable to handle kernel paging request at virtual address dead00000000014f<br />
<br />
This patch addresses the issue by checking if &#39;ncm->netdev&#39; is not NULL at<br />
ncm_disable() to call gether_disconnect() to deassociate &#39;dev->port_usb&#39;.<br />
It&#39;s more reasonable to check &#39;ncm->netdev&#39; to call gether_connect/disconnect<br />
rather than check &#39;ncm->port.in_ep->enabled&#39; since it might not be enabled<br />
but the gether connection might be established.
Impact
Base Score 3.x
7.80
Severity 3.x
HIGH
Vulnerable products and versions
| CPE | From | Up to |
|---|---|---|
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.15.157 (excluding) | |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.16 (including) | 6.1.88 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.2 (including) | 6.6.29 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.7 (including) | 6.8.8 (excluding) |
| cpe:2.3:o:linux:linux_kernel:6.9:rc1:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.9:rc2:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.9:rc3:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.9:rc4:*:*:*:*:*:* |
To consult the complete list of CPE names with products and versions, see this page
References to Advisories, Solutions, and Tools
- https://git.kernel.org/stable/c/0588bbbd718a8130b98c54518f1e0b569ce60a93
- https://git.kernel.org/stable/c/6334b8e4553cc69f51e383c9de545082213d785e
- https://git.kernel.org/stable/c/7250326cbb1f4f90391ac511a126b936cefb5bb7
- https://git.kernel.org/stable/c/7f67c2020cb08499c400abf0fc32c65e4d9a09ca
- https://git.kernel.org/stable/c/f356fd0cbd9c9cbd0854657a80d1608d0d732db3
- https://git.kernel.org/stable/c/0588bbbd718a8130b98c54518f1e0b569ce60a93
- https://git.kernel.org/stable/c/6334b8e4553cc69f51e383c9de545082213d785e
- https://git.kernel.org/stable/c/7250326cbb1f4f90391ac511a126b936cefb5bb7
- https://git.kernel.org/stable/c/7f67c2020cb08499c400abf0fc32c65e4d9a09ca
- https://git.kernel.org/stable/c/f356fd0cbd9c9cbd0854657a80d1608d0d732db3
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/4EZ6PJW7VOZ224TD7N4JZNU6KV32ZJ53/
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/DAMSOZXJEPUOXW33WZYWCVAY7Z5S7OOY/
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/GCBZZEC7L7KTWWAS2NLJK6SO3IZIL4WW/



