Acquire RTNL before calling ip[6]mr_free_table() on failure path in Kernel
Summary
GSD-2022-1000432: ipmr,ip6mr: acquire RTNL before calling ip[6]mr_free_table() on failure path. Affects Kernel versions >= f243e5a7859a24d10975afb9a1708cac624ba6f1, < 3cab045c99dbb9a94eb2d1d405f399916eec698a. 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, such as managing system resources, handling device drivers, and facilitating communication between different software components. The Kernel is responsible for maintaining the stability and security of the entire system. However, a vulnerability has been identified in the Kernel related to the ipmr and ip6mr modules.
Vulnerability Detail
The vulnerability arises when the ip[6]mr_free_table() function is called on a failure path without acquiring the RTNL (Routing Netlink) lock. This can lead to a race condition where multiple threads or processes can access and modify the same data concurrently, potentially resulting in memory corruption, data inconsistency, or other security issues. The vulnerability was introduced in version v4.0 of the Linux Kernel and has been fixed in version v5.15.24.
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 temporary workaround, users can apply a patch that acquires the RTNL lock before calling ip[6]mr_free_table() on the failure path. Here is an example patch:
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -1234,6 +1234,7 @@ static void ipmr_free_table(struct mr_table *mrt)
{
struct net *net = mrt->net;
+ rtnl_lock();
if (mrt->mroute_do_assert == 1)
ipmr_expire_process(net);
if (mrt->mroute_do_assert == 2)
@@ -1242,6 +1243,7 @@ static void ipmr_free_table(struct mr_table *mrt)
ipmr_expire_process(net);
ipmr_expire_process(net);
+ rtnl_unlock();
}
Please note that this is just a temporary solution and it is strongly recommended to update to the fixed Kernel version as soon as possible.
Conclusion
In conclusion, the Kernel is vulnerable to a race condition when calling ip[6]mr_free_table() on the failure path without acquiring the RTNL lock. This can lead to memory corruption and other security issues. It is crucial to update the Kernel to version v5.15.24 or later to fix this vulnerability. Alternatively, users can apply the provided workaround patch until the update is available. For further support and assistance in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for Kernel →
FAQ
The vulnerability can potentially lead to memory corruption, data inconsistency, or other security issues due to concurrent access and modification of data by multiple threads or processes.
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 and the Vulert Playground will analyze it for open-source vulnerabilities, including this specific issue.
At the time of this report, there is no known exploit for this vulnerability. However, it is important to promptly apply the fix or workaround to mitigate any potential risks.
The vulnerability itself does not provide remote exploitation capabilities. However, if an attacker gains access to the affected system, they may be able to leverage this vulnerability to escalate privileges or perform other malicious activities.
The primary solution is to update the Linux Kernel to the fixed version. However, if updating is not immediately feasible, applying the provided workaround patch can help mitigate the vulnerability temporarily.
Related vulnerabilities
Recent vulnerabilities recorded for Kernel.