Linux Kernel up to 5.10.37/5.11.21/5.12.4 dwc3 dwc3_gadget_release use after free

CVSS Meta Temp Score | Current Exploit Price (≈) | CTI Interest Score |
---|---|---|
6.6 | $0-$5k | 0.00 |
A vulnerability, which was classified as critical, was found in Linux Kernel up to 5.10.37/5.11.21/5.12.4 (Operating System). This affects the function dwc3_gadget_release
of the component dwc3. The manipulation with an unknown input leads to a use after free vulnerability. CWE is classifying the issue as CWE-416. Referencing memory after it has been freed can cause a program to crash, use unexpected values, or execute code. This is going to have an impact on confidentiality, integrity, and availability. The summary by CVE is:
In the Linux kernel, the following vulnerability has been resolved: usb: dwc3: gadget: Free gadget structure only after freeing endpoints As part of commit e81a7018d93a ("usb: dwc3: allocate gadget structure dynamically") the dwc3_gadget_release() was added which will free the dwc->gadget structure upon the device's removal when usb_del_gadget_udc() is called in dwc3_gadget_exit(). However, simply freeing the gadget results a dangling pointer situation: the endpoints created in dwc3_gadget_init_endpoints() have their dep->endpoint.ep_list members chained off the list_head anchored at dwc->gadget->ep_list. Thus when dwc->gadget is freed, the first dwc3_ep in the list now has a dangling prev pointer and likewise for the next pointer of the dwc3_ep at the tail of the list. The dwc3_gadget_free_endpoints() that follows will result in a use-after-free when it calls list_del(). This was caught by enabling KASAN and performing a driver unbind. The recent commit 568262bf5492 ("usb: dwc3: core: Add shutdown callback for dwc3") also exposes this as a panic during shutdown. There are a few possibilities to fix this. One could be to perform a list_del() of the gadget->ep_list itself which removes it from the rest of the dwc3_ep chain. Another approach is what this patch does, by splitting up the usb_del_gadget_udc() call into its separate "del" and "put" components. This allows dwc3_gadget_free_endpoints() to be called before the gadget is finally freed with usb_put_gadget().
The weakness was disclosed 02/28/2024. It is possible to read the advisory at git.kernel.org. This vulnerability is uniquely identified as CVE-2021-46986 since 02/27/2024. Technical details of the vulnerability are known, but there is no available exploit. The pricing for an exploit might be around USD $0-$5k at the moment (estimation calculated on 12/31/2024).
Upgrading to version 5.10.38, 5.11.22, 5.12.5 or 5.13 eliminates this vulnerability. Applying the patch 1ea775021282/bc0cdd724932/b4b8e9601d7e/bb9c74a5bd14 is able to eliminate this problem. The bugfix is ready for download at git.kernel.org. The best possible mitigation is suggested to be upgrading to the latest version.
Statistical analysis made it clear that VulDB provides the best quality for vulnerability data.
Product
Type
Vendor
Name
Version
- 5.10.0
- 5.10.1
- 5.10.2
- 5.10.3
- 5.10.4
- 5.10.5
- 5.10.6
- 5.10.7
- 5.10.8
- 5.10.9
- 5.10.10
- 5.10.11
- 5.10.12
- 5.10.13
- 5.10.14
- 5.10.15
- 5.10.16
- 5.10.17
- 5.10.18
- 5.10.19
- 5.10.20
- 5.10.21
- 5.10.22
- 5.10.23
- 5.10.24
- 5.10.25
- 5.10.26
- 5.10.27
- 5.10.28
- 5.10.29
- 5.10.30
- 5.10.31
- 5.10.32
- 5.10.33
- 5.10.34
- 5.10.35
- 5.10.36
- 5.10.37
- 5.11.0
- 5.11.1
- 5.11.2
- 5.11.3
- 5.11.4
- 5.11.5
- 5.11.6
- 5.11.7
- 5.11.8
- 5.11.9
- 5.11.10
- 5.11.11
- 5.11.12
- 5.11.13
- 5.11.14
- 5.11.15
- 5.11.16
- 5.11.17
- 5.11.18
- 5.11.19
- 5.11.20
- 5.11.21
- 5.12.0
- 5.12.1
- 5.12.2
- 5.12.3
- 5.12.4
License
CPE 2.3
CPE 2.2
CVSSv4
VulDB Vector: 🔍VulDB Reliability: 🔍
CVSSv3
VulDB Meta Base Score: 6.8VulDB Meta Temp Score: 6.6
VulDB Base Score: 8.0
VulDB Temp Score: 7.6
VulDB Vector: 🔍
VulDB Reliability: 🔍
NVD Base Score: 5.5
NVD Vector: 🔍
CVSSv2
AV | AC | Au | C | I | A |
---|---|---|---|---|---|
💳 | 💳 | 💳 | 💳 | 💳 | 💳 |
💳 | 💳 | 💳 | 💳 | 💳 | 💳 |
💳 | 💳 | 💳 | 💳 | 💳 | 💳 |
Vector | Complexity | Authentication | Confidentiality | Integrity | Availability |
---|---|---|---|---|---|
unlock | unlock | unlock | unlock | unlock | unlock |
unlock | unlock | unlock | unlock | unlock | unlock |
unlock | unlock | unlock | unlock | unlock | unlock |
VulDB Base Score: 🔍
VulDB Temp Score: 🔍
VulDB Reliability: 🔍
Exploiting
Class: Use after freeCWE: CWE-416 / CWE-119
CAPEC: 🔍
ATT&CK: 🔍
Local: No
Remote: Partially
Availability: 🔍
Status: Not defined
EPSS Score: 🔍
EPSS Percentile: 🔍
Price Prediction: 🔍
Current Price Estimation: 🔍
0-Day | unlock | unlock | unlock | unlock |
---|---|---|---|---|
Today | unlock | unlock | unlock | unlock |
Threat Intelligence
Interest: 🔍Active Actors: 🔍
Active APT Groups: 🔍
Countermeasures
Recommended: UpgradeStatus: 🔍
0-Day Time: 🔍
Upgrade: Kernel 5.10.38/5.11.22/5.12.5/5.13
Patch: 1ea775021282/bc0cdd724932/b4b8e9601d7e/bb9c74a5bd14
Timeline
02/27/2024 🔍02/28/2024 🔍
02/28/2024 🔍
12/31/2024 🔍
Sources
Vendor: kernel.orgAdvisory: git.kernel.org
Status: Confirmed
CVE: CVE-2021-46986 (🔍)
GCVE (CVE): GCVE-0-2021-46986
GCVE (VulDB): GCVE-100-255027
Entry
Created: 02/28/2024 10:52 AMUpdated: 12/31/2024 06:26 PM
Changes: 02/28/2024 10:52 AM (44), 12/31/2024 06:26 PM (27)
Complete: 🔍
Cache ID: 18:263:40
No comments yet. Languages: en.
Please log in to comment.