{"id":"CVE-2025-38555","state":"PUBLISHED","title":"usb: gadget : fix use-after-free in composite_dev_cleanup()","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nusb: gadget : fix use-after-free in composite_dev_cleanup()\n\n1. In func configfs_composite_bind() -> composite_os_desc_req_prepare():\nif kmalloc fails, the pointer cdev->os_desc_req will be freed but not\nset to NULL. Then it will return a failure to the upper-level function.\n2. in func configfs_composite_bind() -> composite_dev_cleanup():\nit will checks whether cdev->os_desc_req is NULL. If it is not NULL, it\nwill attempt to use it.This will lead to a use-after-free issue.\n\nBUG: KASAN: use-after-free in composite_dev_cleanup+0xf4/0x2c0\nRead of size 8 at addr 0000004827837a00 by task init/1\n\nCPU: 10 PID: 1 Comm: init Tainted: G           O      5.10.97-oh #1\n kasan_report+0x188/0x1cc\n __asan_load8+0xb4/0xbc\n composite_dev_cleanup+0xf4/0x2c0\n configfs_composite_bind+0x210/0x7ac\n udc_bind_to_driver+0xb4/0x1ec\n usb_gadget_probe_driver+0xec/0x21c\n gadget_dev_desc_UDC_store+0x264/0x27c","publishedAt":"2025-08-19T17:02:34.110Z","updatedAt":"2026-08-05T12:02:53.142Z","severity":{"score":7.8,"label":"High","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","source":"Linux"},"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"37a3a533429ef9b3cc9f15a656c19623f0e88df7","status":"affected","lessThan":"dba96dfa5a0f685b959dd28a52ac8dab0b805204","versionType":"git"},{"version":"37a3a533429ef9b3cc9f15a656c19623f0e88df7","status":"affected","lessThan":"2db29235e900a084a656dea7e0939b0abb7bb897","versionType":"git"},{"version":"37a3a533429ef9b3cc9f15a656c19623f0e88df7","status":"affected","lessThan":"8afb22aa063f706f3343707cdfb8cda4d021dd33","versionType":"git"},{"version":"37a3a533429ef9b3cc9f15a656c19623f0e88df7","status":"affected","lessThan":"e624bf26127645a2f7821e73fdf6dc64bad07835","versionType":"git"},{"version":"37a3a533429ef9b3cc9f15a656c19623f0e88df7","status":"affected","lessThan":"aada327a9f8028c573636fa60c0abc80fb8135c9","versionType":"git"},{"version":"37a3a533429ef9b3cc9f15a656c19623f0e88df7","status":"affected","lessThan":"5f06ee9f9a3665d43133f125c17e5258a13f3963","versionType":"git"},{"version":"37a3a533429ef9b3cc9f15a656c19623f0e88df7","status":"affected","lessThan":"bd3c4ef60baf7f65c963f3e12d9d7b2b091e20ba","versionType":"git"},{"version":"37a3a533429ef9b3cc9f15a656c19623f0e88df7","status":"affected","lessThan":"e1be1f380c82a69f80c68c96a7cfe8759fb30355","versionType":"git"},{"version":"37a3a533429ef9b3cc9f15a656c19623f0e88df7","status":"affected","lessThan":"151c0aa896c47a4459e07fee7d4843f44c1bb18e","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/usb/gadget/composite.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"3.16","status":"affected"},{"version":"0","status":"unaffected","lessThan":"3.16","versionType":"semver"},{"version":"5.4.297","status":"unaffected","lessThanOrEqual":"5.4.*","versionType":"semver"},{"version":"5.10.241","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.190","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.1.148","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.102","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.42","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.15.10","status":"unaffected","lessThanOrEqual":"6.15.*","versionType":"semver"},{"version":"6.16.1","status":"unaffected","lessThanOrEqual":"6.16.*","versionType":"semver"},{"version":"6.17","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/usb/gadget/composite.c"]}],"references":["https://git.kernel.org/stable/c/dba96dfa5a0f685b959dd28a52ac8dab0b805204","https://git.kernel.org/stable/c/2db29235e900a084a656dea7e0939b0abb7bb897","https://git.kernel.org/stable/c/8afb22aa063f706f3343707cdfb8cda4d021dd33","https://git.kernel.org/stable/c/e624bf26127645a2f7821e73fdf6dc64bad07835","https://git.kernel.org/stable/c/aada327a9f8028c573636fa60c0abc80fb8135c9","https://git.kernel.org/stable/c/5f06ee9f9a3665d43133f125c17e5258a13f3963","https://git.kernel.org/stable/c/bd3c4ef60baf7f65c963f3e12d9d7b2b091e20ba","https://git.kernel.org/stable/c/e1be1f380c82a69f80c68c96a7cfe8759fb30355","https://git.kernel.org/stable/c/151c0aa896c47a4459e07fee7d4843f44c1bb18e","https://lists.debian.org/debian-lts-announce/2025/10/msg00008.html","https://lists.debian.org/debian-lts-announce/2025/10/msg00007.html"],"weaknesses":[],"ingestedAt":"2026-10-29T20:09:09.358Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2025/38xxx/CVE-2025-38555.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2025-38555","state":"PUBLISHED","datePublished":"2025-08-19T17:02:34.110Z","dateUpdated":"2026-08-05T12:02:53.142Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2025-04-16T04:51:24.025Z"},"containers":{"cna":{"title":"usb: gadget : fix use-after-free in composite_dev_cleanup()","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nusb: gadget : fix use-after-free in composite_dev_cleanup()\n\n1. In func configfs_composite_bind() -> composite_os_desc_req_prepare():\nif kmalloc fails, the pointer cdev->os_desc_req will be freed but not\nset to NULL. Then it will return a failure to the upper-level function.\n2. in func configfs_composite_bind() -> composite_dev_cleanup():\nit will checks whether cdev->os_desc_req is NULL. If it is not NULL, it\nwill attempt to use it.This will lead to a use-after-free issue.\n\nBUG: KASAN: use-after-free in composite_dev_cleanup+0xf4/0x2c0\nRead of size 8 at addr 0000004827837a00 by task init/1\n\nCPU: 10 PID: 1 Comm: init Tainted: G           O      5.10.97-oh #1\n kasan_report+0x188/0x1cc\n __asan_load8+0xb4/0xbc\n composite_dev_cleanup+0xf4/0x2c0\n configfs_composite_bind+0x210/0x7ac\n udc_bind_to_driver+0xb4/0x1ec\n usb_gadget_probe_driver+0xec/0x21c\n gadget_dev_desc_UDC_store+0x264/0x27c"}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"37a3a533429ef9b3cc9f15a656c19623f0e88df7","status":"affected","lessThan":"dba96dfa5a0f685b959dd28a52ac8dab0b805204","versionType":"git"},{"version":"37a3a533429ef9b3cc9f15a656c19623f0e88df7","status":"affected","lessThan":"2db29235e900a084a656dea7e0939b0abb7bb897","versionType":"git"},{"version":"37a3a533429ef9b3cc9f15a656c19623f0e88df7","status":"affected","lessThan":"8afb22aa063f706f3343707cdfb8cda4d021dd33","versionType":"git"},{"version":"37a3a533429ef9b3cc9f15a656c19623f0e88df7","status":"affected","lessThan":"e624bf26127645a2f7821e73fdf6dc64bad07835","versionType":"git"},{"version":"37a3a533429ef9b3cc9f15a656c19623f0e88df7","status":"affected","lessThan":"aada327a9f8028c573636fa60c0abc80fb8135c9","versionType":"git"},{"version":"37a3a533429ef9b3cc9f15a656c19623f0e88df7","status":"affected","lessThan":"5f06ee9f9a3665d43133f125c17e5258a13f3963","versionType":"git"},{"version":"37a3a533429ef9b3cc9f15a656c19623f0e88df7","status":"affected","lessThan":"bd3c4ef60baf7f65c963f3e12d9d7b2b091e20ba","versionType":"git"},{"version":"37a3a533429ef9b3cc9f15a656c19623f0e88df7","status":"affected","lessThan":"e1be1f380c82a69f80c68c96a7cfe8759fb30355","versionType":"git"},{"version":"37a3a533429ef9b3cc9f15a656c19623f0e88df7","status":"affected","lessThan":"151c0aa896c47a4459e07fee7d4843f44c1bb18e","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/usb/gadget/composite.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"3.16","status":"affected"},{"version":"0","status":"unaffected","lessThan":"3.16","versionType":"semver"},{"version":"5.4.297","status":"unaffected","lessThanOrEqual":"5.4.*","versionType":"semver"},{"version":"5.10.241","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.190","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.1.148","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.102","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.42","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.15.10","status":"unaffected","lessThanOrEqual":"6.15.*","versionType":"semver"},{"version":"6.16.1","status":"unaffected","lessThanOrEqual":"6.16.*","versionType":"semver"},{"version":"6.17","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/usb/gadget/composite.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/dba96dfa5a0f685b959dd28a52ac8dab0b805204"},{"url":"https://git.kernel.org/stable/c/2db29235e900a084a656dea7e0939b0abb7bb897"},{"url":"https://git.kernel.org/stable/c/8afb22aa063f706f3343707cdfb8cda4d021dd33"},{"url":"https://git.kernel.org/stable/c/e624bf26127645a2f7821e73fdf6dc64bad07835"},{"url":"https://git.kernel.org/stable/c/aada327a9f8028c573636fa60c0abc80fb8135c9"},{"url":"https://git.kernel.org/stable/c/5f06ee9f9a3665d43133f125c17e5258a13f3963"},{"url":"https://git.kernel.org/stable/c/bd3c4ef60baf7f65c963f3e12d9d7b2b091e20ba"},{"url":"https://git.kernel.org/stable/c/e1be1f380c82a69f80c68c96a7cfe8759fb30355"},{"url":"https://git.kernel.org/stable/c/151c0aa896c47a4459e07fee7d4843f44c1bb18e"}],"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 vulnerability is reached entirely from local userspace by writing to the gadget's configfs `UDC` attribute (`gadget_dev_desc_UDC_store()` → `udc_bind_to_driver()` → `configfs_composite_bind()`); no USB bus traffic, attached host, or physical device access participates in triggering it. Despite being in the USB gadget stack, the trigger is a plain local file write, so Local is both accurate and higher severity than Physical.\nAC:L - Once the 4 KB `kmalloc()` returns NULL the dangling `cdev->os_desc_req` is dereferenced deterministically on the unwind path with no race to win, and the attacker controls every other precondition (`os_desc` group enabled to set `use_os_string`, unlimited retries of the `UDC` write) while driving the system toward the allocation failure with ordinary memory pressure. The long `purge_configs_funcs()` window between free and use also lets the attacker reliably spray the freed slab object rather than depending on unknowable layout.\nPR:L - configfs is not mountable from a user namespace, but the `/sys/kernel/config/usb_gadget` tree is commonly delegated to a non-root service account (Android's system-uid USB gadget HAL, embedded gadget managers), so an unprivileged-but-delegated local account can create the `os_desc` configuration and write `UDC`. No capability check guards the store handler itself beyond file ownership.\nUI:N - The attacker performs the whole sequence — building the gadget, enabling OS descriptors, generating memory pressure, and writing `UDC` — with no action required from any other user or administrator. The use-after-free fires inside the attacker's own write syscall.\nS:U - The corruption occurs in kernel slab memory during the calling task's own syscall and stays within the kernel's security authority; no VM, IOMMU, or sandbox boundary is crossed.\nC:H - `composite_dev_cleanup()` reads `cdev->os_desc_req->buf` out of a freed slab object after a long reclaim window, and an attacker who sprays that object controls the value used for a subsequent `kfree()`, turning the UAF into a heap-manipulation primitive that can be leveraged to read arbitrary kernel memory. Per kernel scoring guidance, a use-after-free is High confidentiality impact.\nI:H - The stale pointer yields `kfree()` of an attacker-influenced pointer plus a NULL write into the reclaimed object and then a second free of the already-freed `usb_request` — an arbitrary-free and double-free combination that is a well-established route to slab corruption, arbitrary write, and control-flow hijack.\nA:H - Even without exploitation the double free and freeing of a bogus `buf` pointer corrupt the SLUB freelist and reliably produce a KASAN report, BUG, or kernel panic — the reporter's own trace shows the oops occurring in PID 1 (`init`), which is fatal to the system."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-08-05T12:02:53.142Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"3.16","versionEndExcluding":"5.4.297"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"3.16","versionEndExcluding":"5.10.241"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"3.16","versionEndExcluding":"5.15.190"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"3.16","versionEndExcluding":"6.1.148"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"3.16","versionEndExcluding":"6.6.102"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"3.16","versionEndExcluding":"6.12.42"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"3.16","versionEndExcluding":"6.15.10"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"3.16","versionEndExcluding":"6.16.1"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"3.16","versionEndExcluding":"6.17"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}},"adp":[{"title":"CVE Program Container","references":[{"url":"https://lists.debian.org/debian-lts-announce/2025/10/msg00008.html"},{"url":"https://lists.debian.org/debian-lts-announce/2025/10/msg00007.html"}],"providerMetadata":{"shortName":"CVE","orgId":"af854a3a-2127-422b-91ae-364da2661108","dateUpdated":"2025-11-03T17:39:48.711Z"}}]}}}