Integer Overflow in afu_mmio_region_get_by_offset in Linux Kernel
Summary
CVE-2023-26242: afu_mmio_region_get_by_offset in drivers/fpga/dfl-afu-region.c in the Linux kernel through 6.1.12 has an integer overflow. Affects linux versions 5.10.103-1 – 6.9.9-1. 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 Linux kernel is a widely used open-source operating system kernel that serves as the foundation for various Linux distributions. It provides essential functionality for the operating system, including device drivers, memory management, and process scheduling. The 'afu_mmio_region_get_by_offset' function in the 'dfl-afu-region.c' file within the kernel's FPGA driver is responsible for retrieving a memory-mapped I/O (MMIO) region based on a given offset. However, this function is susceptible to an integer overflow vulnerability.
Vulnerability Detail
The 'afu_mmio_region_get_by_offset' function in the Linux kernel through version 6.1.12 has an integer overflow vulnerability. This vulnerability occurs when an attacker provides a large offset value, causing an arithmetic calculation to exceed the maximum value that can be represented by the data type used for the calculation. As a result, the function may incorrectly calculate the memory address, leading to unexpected behavior or security issues. Exploiting this vulnerability could potentially allow an attacker to gain elevated privileges, 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
As a workaround, users can apply the following code change to mitigate the vulnerability:
--- a/drivers/fpga/dfl-afu-region.c
+++ b/drivers/fpga/dfl-afu-region.c
@@ -123,7 +123,7 @@ static struct fpga_region *__afu_mmio_region_get_by_offset(
struct fpga_region *region;
struct fpga_region *tmp;
- if (offset < 0)
+ if (offset < 0 || offset > INT_MAX)
return NULL;
list_for_each_entry_safe(region, tmp, &dfl_fpga_region_list, list) {
Conclusion
In conclusion, the 'afu_mmio_region_get_by_offset' function in the Linux kernel is vulnerable to an integer overflow. This vulnerability can have severe consequences, including privilege escalation, arbitrary code execution, or denial-of-service. It is crucial to update the Linux kernel to a patched version and follow secure configuration practices. For further assistance and support in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for linux →
FAQ
Exploiting this vulnerability could potentially allow an attacker to gain elevated privileges, execute arbitrary code, or cause a denial-of-service condition.
The vulnerability affects the Linux kernel versions up to and including 6.1.12.
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 monitoring and alerts for open-source vulnerabilities.
Yes, it is recommended to update the Linux kernel to a version that includes the necessary patches. Regularly check for updates provided by your Linux distribution or manually update the kernel from official sources.
Yes, a temporary workaround is available by applying the provided code change to the 'dfl-afu-region.c' file. However, it is strongly advised to update to a patched version of the Linux kernel as soon as possible.
Related vulnerabilities
Recent vulnerabilities recorded for linux.