Vulnerability in Kernel: nbd_cleanup() Function
Summary
GSD-2022-1003467: nbd: call genl_unregister_family() first in nbd_cleanup(). Affects Kernel versions < c0868f6e728c3c28bef0e8bee89d2daf86a8bbca. 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, responsible for managing system resources and facilitating communication between hardware and software. One of its functionalities is the Network Block Device (NBD) subsystem, which allows remote storage devices to be accessed over a network. The nbd_cleanup() function is part of this subsystem and is responsible for cleaning up resources when an NBD connection is terminated.
Vulnerability Detail
The vulnerability identified in the nbd_cleanup() function is related to the order in which certain operations are performed during cleanup. Specifically, the genl_unregister_family() function, which unregisters a Generic Netlink family, is not called before other cleanup operations. This can lead to a use-after-free vulnerability, where a reference to a freed memory object is still accessible. An attacker could potentially exploit this vulnerability to execute arbitrary code or cause a denial-of-service condition.
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
If updating the Kernel is not immediately feasible, a possible workaround is to manually modify the nbd_cleanup() function to call genl_unregister_family() before other cleanup operations. Here is an example of the modified code:
static void nbd_cleanup(void)
{
genl_unregister_family(&nbd_genl_family);
// Other cleanup operations
}
Conclusion
In conclusion, the nbd_cleanup() function in the Kernel's NBD subsystem is vulnerable to a use-after-free issue due to the incorrect order of cleanup operations. This vulnerability can be mitigated by updating the Kernel to version v5.10.122 or later. If immediate updating is not possible, a workaround involving manual code modification is available. For further support and assistance in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for Kernel →
FAQ
The vulnerability in the nbd_cleanup() function can potentially allow an attacker to execute arbitrary code or cause a denial-of-service condition.
You can use the Vulert Playground (https://vulert.com/scanner) to check if your system is affected by this vulnerability. Simply upload your package-lock.json file to the playground, and it will provide real-time alerts for open-source vulnerabilities.
Yes, the vulnerability has been fixed in Linux Kernel version v5.10.122. Updating to this version or a later one will address the issue.
Yes, a possible workaround is to manually modify the nbd_cleanup() function to call genl_unregister_family() before other cleanup operations. Refer to the provided code example for guidance.
You can find more information about this vulnerability in the GSD-2022-1003467 entry of the GSD Database maintained by the Cloud Security Alliance. The source link is provided in the vulnerability details.
Related vulnerabilities
Recent vulnerabilities recorded for Kernel.