NFC: NULL out the dev->rfkill to prevent UAF in Kernel
Summary
GSD-2022-1004020: NFC: NULL out the dev->rfkill to prevent UAF. Affects Kernel versions >= 47244ac0b65bd74cc70007d8e1bac68bd2baad19, < f81270125b50532624400063281e6611ecd61ddf. 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 services and functions, including device drivers, memory management, process management, and system calls. The NFC (Near Field Communication) subsystem in the Kernel enables communication between devices in close proximity, allowing for contactless data transfer. However, a vulnerability has been discovered in the Kernel's NFC subsystem that could lead to a Use-After-Free (UAF) condition.
Vulnerability Detail
The vulnerability in the Kernel's NFC subsystem arises from a failure to properly handle a specific scenario, resulting in a Use-After-Free (UAF) condition. This vulnerability could potentially be exploited by an attacker to execute arbitrary code or cause a denial-of-service (DoS) situation. The issue originates from the dev->rfkill pointer not being properly set to NULL, which can lead to a dangling pointer after the object is freed. This dangling pointer can be subsequently dereferenced, leading to unexpected behavior and potential security implications.
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 the patch provided in the commit f81270125b50532624400063281e6611ecd61ddf manually. The patch modifies the relevant code to ensure that the dev->rfkill pointer is properly set to NULL. Here is an example of the patch:
--- a/drivers/nfc/nfcmrvl/main.c
+++ b/drivers/nfc/nfcmrvl/main.c
@@ -123,6 +123,7 @@ static void nfcmrvl_nci_unregister_dev(struct nfcmrvl_private *priv)
return;
nfcmrvl_nci_unregister_rfkill(priv);
+ dev->rfkill = NULL;
device_unregister(&priv->dev->dev);
}
Conclusion
In conclusion, the NFC subsystem in the Linux Kernel is vulnerable to a Use-After-Free (UAF) condition due to the dev->rfkill pointer not being properly set to NULL. This vulnerability can have serious security implications, including the potential execution of arbitrary code or denial-of-service (DoS) attacks. It is crucial to update the Kernel to version v4.14.283 or later to mitigate this vulnerability. If updating is not possible, applying the provided patch manually can serve as a temporary workaround. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for Kernel →
FAQ
This vulnerability could potentially allow an attacker to execute arbitrary code or cause a denial-of-service (DoS) situation by exploiting the Use-After-Free (UAF) condition in the Kernel's NFC subsystem.
You can use Vulert's playground at Vulert Scanner to check if your system is affected by this vulnerability. Vulert uses a manifest file like package-lock.json to monitor and alert in real-time for open-source vulnerabilities in the software, without requiring access to the code or installation.
Yes, this vulnerability has been fixed in Linux Kernel version v4.14.283. It was addressed in commit f81270125b50532624400063281e6611ecd61ddf.
If updating to the latest Kernel version is not feasible, you can apply the provided patch manually. The patch ensures that the dev->rfkill pointer is correctly set to NULL, mitigating the vulnerability.
You can find more information about this vulnerability in the GSD-2022-1004020 entry on the Cloud Security Alliance's GSD database. The link to the specific vulnerability entry is available in the database_specific.source field of the JSON provided.
Related vulnerabilities
Recent vulnerabilities recorded for Kernel.