CVE-2024-26996: usb: gadget: f_ncm: Fix UAF ncm object at re-bind after usb ep transport error
In the Linux kernel, the following vulnerability has been resolved:
usb: gadget: f_ncm: Fix UAF ncm object at re-bind after usb ep transport error
When ncm function is working and then stop usb0 interface for link down,
eth_stop() is called. At this piont, accidentally if usb transport error
should happen in usb_ep_enable(), 'in_ep' and/or 'out_ep' may not be enabled.
After that, ncm_disable() is called to disable for ncm unbind
but gether_disconnect() is never called since 'in_ep' is not enabled.
As the result, ncm object is released in ncm unbind
but 'dev->port_usb' associated to 'ncm->port' is not NULL.
And when ncm bind again to recover netdev, ncm object is reallocated
but usb0 interface is already associated to previous released ncm object.
Therefore, once usb0 interface is up and eth_start_xmit() is called,
released ncm object is dereferrenced and it might cause use-after-free memory.
[function unlink via configfs]
usb0: eth_stop dev->port_usb=ffffff9b179c3200
--> error happens in usb_ep_enable().
NCM: ncm_disable: ncm=ffffff9b179c3200
--> no gether_disconnect() since ncm->port.in_ep->enabled is false.
NCM: ncm_unbind: ncm unbind ncm=ffffff9b179c3200
NCM: ncm_free: ncm free ncm=ffffff9b179c3200 <-- released ncm
[function link via configfs]
NCM: ncm_alloc: ncm alloc ncm=ffffff9ac4f8a000
NCM: ncm_bind: ncm bind ncm=ffffff9ac4f8a000
NCM: ncm_set_alt: ncm=ffffff9ac4f8a000 alt=0
usb0: eth_open dev->port_usb=ffffff9b179c3200 <-- previous released ncm
usb0: eth_start dev->port_usb=ffffff9b179c3200 <--
eth_start_xmit()
--> dev->wrap()
Unable to handle kernel paging request at virtual address dead00000000014f
This patch addresses the issue by checking if 'ncm->netdev' is not NULL at
ncm_disable() to call gether_disconnect() to deassociate 'dev->port_usb'.
It's more reasonable to check 'ncm->netdev' to call gether_connect/disconnect
rather than check 'ncm->port.in_ep->enabled' since it might not be enabled
but the gether connection might be established.
Security readout for executives and security teams
Plain-English summary
A Linux USB networking flaw can leave the kernel using an object after it has been freed. Under a specific USB NCM failure and rebind sequence, subsequent network transmission may crash the system or corrupt kernel memory. The supplied score is 7.8 (High), but exposure appears limited to systems using the affected USB gadget functionality.
Executive priority
Treat as an expedited priority for products using USB NCM gadget mode, particularly embedded or physically accessible devices. For general Linux servers without this functionality, first confirm applicability before emergency action. No active exploitation is established in the supplied evidence.
Technical view
In Linux USB gadget f_ncm, an endpoint-enable error can prevent gether_disconnect() during NCM disable. Unbinding then frees the NCM object while dev->port_usb retains a stale pointer. After rebinding, eth_start_xmit() can dereference that freed object. The fix disconnects based on ncm->netdev rather than endpoint-enabled state.
Likely exposure
Most relevant to Linux devices configured for USB gadget NCM networking, including embedded systems and appliances. The supplied affected entries identify versions 4.4, 5.15.157, 6.1.88, 6.6.29, 6.8.8, and 6.9; the additional โ0โ entry is ambiguous. Distribution backports require vendor-specific verification.
Exploitation context
The supplied CVSS vector describes local, low-privilege exploitation without user interaction and potentially high confidentiality, integrity, and availability impact. Triggering requires a USB endpoint transport error followed by NCM unbind, rebind, and traffic. The bundle marks KEV false and provides no evidence of active exploitation or a public exploit.
Researcher notes
The failure depends on a narrow cleanup-state inconsistency: gether_disconnect() was gated by in_ep->enabled even though the network association could already exist. The correction instead tests ncm->netdev. The sources demonstrate a kernel paging fault, but do not establish reliable privilege escalation, remote reachability, exploit availability, or attacks in the wild.
Mitigation direction
Upgrade to a vendor-supported kernel or package containing the referenced f_ncm fix.
Prioritize embedded and appliance systems that expose USB NCM gadget networking.
If immediate patching is unavailable, consult vendor guidance for supported risk-reduction measures.
Avoid relying solely on version numbers because distributions may backport the correction.
Validation and detection
Inventory systems using Linux USB gadget NCM networking or the f_ncm function.
Record running kernel and distribution package versions on identified systems.
Confirm vendor advisories or package changelogs state that CVE-2024-26996 is fixed.
Where source provenance is available, verify inclusion of the applicable referenced stable-kernel commit.
After updating, confirm the intended fixed kernel is running.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cve ยท low confidence lookup
CVE-2024-26996 mapping review
Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.