{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2025-40093","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","state":"PUBLISHED","assignerShortName":"Linux","dateReserved":"2025-04-16T07:20:57.163Z","datePublished":"2025-10-30T09:48:00.807Z","dateUpdated":"2026-08-05T12:07:44.429Z"},"containers":{"cna":{"providerMetadata":{"orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","shortName":"Linux","dateUpdated":"2026-08-05T12:07:44.429Z"},"descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nusb: gadget: f_ecm: Refactor bind path to use __free()\n\nAfter an bind/unbind cycle, the ecm->notify_req is left stale. If a\nsubsequent bind fails, the unified error label attempts to free this\nstale request, leading to a NULL pointer dereference when accessing\nep->ops->free_request.\n\nRefactor the error handling in the bind path to use the __free()\nautomatic cleanup mechanism."}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","baseScore":7.8,"baseSeverity":"HIGH"},"scenarios":[{"lang":"en","value":"AV:L - The entire bind/unbind/re-bind sequence that creates and then dereferences the stale `ecm->notify_req` is driven by local writes to `/sys/kernel/config/usb_gadget/<g>/UDC` and the function/config symlinks; no USB host traffic, cable event, or physical port access is required, so the bug is reachable purely through local filesystem/syscall access.\nAC:L - The attacker deterministically controls every step — the successful first bind, the unbind that leaves `ecm->notify_req`/`ecm->notify` dangling, and the forced failure of the next bind by exhausting `usb_interface_id()` (MAX_CONFIG_INTERFACES) or `usb_ep_autoconfig()` via extra functions linked into the config between cycles — plus the heap spray that reclaims the freed `usb_request`. No race or condition outside attacker control is involved.\nPR:L - `gadget_dev_desc_UDC_store()` and `ecm_bind()` perform no capability check at all; access is gated only by configfs file permissions, and on Android and embedded/industrial deployments the USB gadget configfs tree is routinely delegated to non-root system/daemon accounts that switch tethering (ECM/NCM/RNDIS) functions.\nUI:N - The attacker performs all configfs writes itself; no victim action, cable plug event, or interaction with another user is needed to reach the stale free.\nS:U - The dangling-pointer free and subsequent heap corruption stay within the kernel's own security authority; no VM, IOMMU, or sandbox boundary is crossed.\nC:H - `kfree(ecm->notify_req->buf)` reads a pointer out of the reclaimed `struct dummy_request`/`dwc3_request` slab and `usb_ep_free_request()` reads `ep->ops` out of a potentially freed `struct usb_ep`, so an attacker who grooms those generic kmalloc caches gains object-overlap and arbitrary-free primitives readily converted into kernel memory disclosure.\nI:H - `kfree()` of an attacker-controlled pointer read from the freed request, a double free of the `usb_request` itself, and an indirect call through a reclaimable `ep->ops` table together yield classic heap-corruption primitives leading to arbitrary write and privilege escalation.\nA:H - The directly observed effect is a kernel oops — NULL/garbage `ep->ops` dereference in `usb_ep_free_request()` — and the double free independently causes slab corruption and panic, which an unprivileged holder of the configfs tree can trigger repeatedly."}]}],"affected":[{"product":"Linux","vendor":"Linux","defaultStatus":"unaffected","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/usb/gadget/function/f_ecm.c"],"versions":[{"version":"da741b8c56d612b5dd26ffa31341911a5fea23ee","lessThan":"d3745aaef19198d0c81637a7dd50ef53c4f879b7","status":"affected","versionType":"git"},{"version":"da741b8c56d612b5dd26ffa31341911a5fea23ee","lessThan":"070f341d86cf2c098d63e484a86c7c1d2696a868","status":"affected","versionType":"git"},{"version":"da741b8c56d612b5dd26ffa31341911a5fea23ee","lessThan":"15b9faf53ba8719700596e7ef78879ce200e8c2e","status":"affected","versionType":"git"},{"version":"da741b8c56d612b5dd26ffa31341911a5fea23ee","lessThan":"4630c68bade82f087eaaab22e9a361da2f18d139","status":"affected","versionType":"git"},{"version":"da741b8c56d612b5dd26ffa31341911a5fea23ee","lessThan":"42988380ac67c76bb9dff8f77d7ef3eefd50b7b5","status":"affected","versionType":"git"}]},{"product":"Linux","vendor":"Linux","defaultStatus":"affected","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/usb/gadget/function/f_ecm.c"],"versions":[{"version":"2.6.27","status":"affected"},{"version":"0","lessThan":"2.6.27","status":"unaffected","versionType":"semver"},{"version":"6.1.158","lessThanOrEqual":"6.1.*","status":"unaffected","versionType":"semver"},{"version":"6.6.114","lessThanOrEqual":"6.6.*","status":"unaffected","versionType":"semver"},{"version":"6.12.55","lessThanOrEqual":"6.12.*","status":"unaffected","versionType":"semver"},{"version":"6.17.5","lessThanOrEqual":"6.17.*","status":"unaffected","versionType":"semver"},{"version":"6.18","lessThanOrEqual":"*","status":"unaffected","versionType":"original_commit_for_fix"}]}],"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.27","versionEndExcluding":"6.1.158"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.27","versionEndExcluding":"6.6.114"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.27","versionEndExcluding":"6.12.55"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.27","versionEndExcluding":"6.17.5"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.27","versionEndExcluding":"6.18"}]}]}],"references":[{"url":"https://git.kernel.org/stable/c/d3745aaef19198d0c81637a7dd50ef53c4f879b7"},{"url":"https://git.kernel.org/stable/c/070f341d86cf2c098d63e484a86c7c1d2696a868"},{"url":"https://git.kernel.org/stable/c/15b9faf53ba8719700596e7ef78879ce200e8c2e"},{"url":"https://git.kernel.org/stable/c/4630c68bade82f087eaaab22e9a361da2f18d139"},{"url":"https://git.kernel.org/stable/c/42988380ac67c76bb9dff8f77d7ef3eefd50b7b5"}],"title":"usb: gadget: f_ecm: Refactor bind path to use __free()","x_generator":{"engine":"bippy-1.2.0"}}}}