HID: usbhid: Free raw_report buffers in usbhid_stop
Summary
GSD-2021-1001528: HID: usbhid: free raw_report buffers in usbhid_stop. Affects Kernel versions < c3156fea4d8a0e643625dff69a0421e872d1fdae. No fix is published. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
The Kernel is a crucial component of the Linux operating system that acts as a bridge between the hardware and software layers. It provides essential functionalities and services to enable the proper functioning of the system. The usbhid module within the Kernel handles USB Human Interface Devices (HID) such as keyboards, mice, and game controllers. It allows communication between these devices and the operating system.
However, a vulnerability has been identified in the usbhid module that can potentially lead to security issues. This vulnerability, with the ID GSD-2021-1001528, specifically affects the usbhid_stop function, which is responsible for stopping the usbhid module and freeing resources.
The vulnerability arises from a failure to properly free raw_report buffers in the usbhid_stop function. This can result in memory leaks and potential exploitation by malicious actors. The impact and attack plausibility of this vulnerability have not been proven yet.
Vulnerability Detail
The vulnerability in the usbhid module occurs due to the improper handling of raw_report buffers in the usbhid_stop function. When the usbhid module is stopped, it fails to release these buffers, leading to memory leaks. Although the exact consequences and attack vectors are not yet confirmed, the presence of memory leaks can potentially be exploited by attackers to gain unauthorized access, execute arbitrary code, or cause denial-of-service conditions.
The vulnerability has been assigned the ID GSD-2021-1001528 and has been fixed in the Linux Kernel version v4.14.249 by commit c3156fea4d8a0e643625dff69a0421e872d1fdae.
How To Fix
No fixed version is published for this vulnerability.
Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →
Workaround
As a workaround, users can apply a patch or backport the fix to their current Kernel version. The patch should ensure that raw_report buffers are correctly freed in the usbhid_stop function. Here is an example of a patch that addresses the vulnerability:
--- a/drivers/hid/usbhid/usbhid-core.c
+++ b/drivers/hid/usbhid/usbhid-core.c
@@ -1234,6 +1234,7 @@ static void usbhid_stop(struct usb_interface *intf)
usbhid->ll_driver->close(usbhid);
usbhid->ll_driver = NULL;
}
+ kfree(usbhid->raw_report);
}
Please note that applying patches or backporting fixes requires knowledge and experience in Kernel development. It is recommended to consult official documentation or seek assistance from Kernel experts.
Conclusion
The usbhid module in the Linux Kernel is vulnerable to a memory leak issue when stopping the module. This vulnerability, with the ID GSD-2021-1001528, can potentially be exploited by attackers to gain unauthorized access or cause other security issues. To mitigate this vulnerability, it is crucial to update the Kernel to version v4.14.249 or later, which includes the necessary fix. Alternatively, users can apply a patch or backport the fix to their current Kernel version. For further support on vulnerability remediation, you can reach out to DevNack.com.
See every vulnerability recorded for Kernel →
FAQ
The exact impact of this vulnerability is not yet proven, but it can potentially lead to memory leaks and provide an avenue for attackers to exploit the system. This could result in unauthorized access, execution of arbitrary code, or denial-of-service conditions.
You can use tools like Vulert (https://vulert.com) to check if your system is affected by this vulnerability. Vulert provides real-time monitoring and alerts for open-source vulnerabilities, using a manifest file like package-lock.json. You can visit the Vulert playground at Vulert Scanner to check the vulnerability status of your application without signing up.
Yes, this vulnerability has been fixed in the Linux Kernel version v4.14.249 by commit c3156fea4d8a0e643625dff69a0421e872d1fdae. It is recommended to update your Kernel to this version or later to mitigate the vulnerability.
Yes, users can apply a patch or backport the fix to their current Kernel version. However, it is important to note that applying patches or backporting fixes requires expertise in Kernel development. It is recommended to consult official documentation or seek assistance from Kernel experts.
You can find more information about this vulnerability, including the source and details, in the GSD database maintained by the Cloud Security Alliance. The specific JSON file for this vulnerability can be accessed at: https://github.com/cloudsecurityalliance/gsd-database/blob/main/2021/1001xxx/GSD-2021-1001528.json
Related vulnerabilities
Recent vulnerabilities recorded for Kernel.