Memory Leak in tcp_bpf_sendmsg in Kernel
Summary
GSD-2022-1002079: bpf, sockmap: Fix memleak in tcp_bpf_sendmsg while sk msg is full. Affects Kernel versions >= 604326b41a6fb9b4a78b6179335decee0365cd8c, < bec34a91eba3483e1830c02bdd36f8f968642047. 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 manages system resources and facilitates communication between hardware and software. It provides essential functionalities such as process management, memory management, and device drivers. The tcp_bpf_sendmsg function is responsible for sending messages over TCP sockets using Berkeley Packet Filter (BPF) programs. BPF programs allow users to define custom packet filtering and manipulation logic. However, a memory leak vulnerability has been discovered in the tcp_bpf_sendmsg function, which can lead to resource exhaustion and potential denial-of-service attacks.
Vulnerability Detail
The memory leak vulnerability in tcp_bpf_sendmsg occurs when the socket message (sk_msg) is full. This can happen when the BPF program attached to the socket generates a large number of messages without consuming them. As a result, memory allocated for these messages is not properly freed, leading to a gradual depletion of system resources. An attacker could potentially exploit this vulnerability by repeatedly triggering the creation of full socket messages, causing the system to run out of memory and become unresponsive. This vulnerability was introduced in version v4.20 of the Linux Kernel and has been fixed in version v5.10.110.
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 disable the use of BPF programs with TCP sockets. This can be achieved by unloading or disabling any BPF programs that are attached to TCP sockets. However, this workaround may impact the functionality of applications that rely on BPF programs for packet filtering or manipulation.
Conclusion
The memory leak vulnerability in tcp_bpf_sendmsg can have serious consequences, including resource exhaustion and denial-of-service attacks. It is crucial to update the Linux Kernel to version v5.10.110 or later to mitigate this vulnerability. Additionally, users can use the Vulert Playground (https://vulert.com/scanner) to check if their systems are affected and obtain real-time alerts for open-source vulnerabilities. For further support and assistance in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for Kernel →
FAQ
This vulnerability can lead to resource exhaustion and potential denial-of-service attacks. By repeatedly triggering the creation of full socket messages, an attacker can cause the system to run out of memory and become unresponsive.
You can use the Vulert Playground (https://vulert.com/scanner) to check if your system is affected by this vulnerability. Simply upload your manifest file (e.g., package-lock.json) to the playground, and it will analyze the dependencies and alert you if any open-source vulnerabilities, including this one, are detected.
Yes, a patch for this vulnerability is available in the Linux Kernel version v5.10.110. It is recommended to update your Kernel to this version or later to mitigate the risk.
As a temporary workaround, you can disable the use of BPF programs with TCP sockets by unloading or disabling any attached BPF programs. However, this may impact the functionality of applications relying on BPF programs for packet filtering or manipulation.
You can find more information about this vulnerability, including the specific commit that fixes it, in the vulnerability database maintained by the Cloud Security Alliance: https://github.com/cloudsecurityalliance/gsd-database/blob/main/2022/1002xxx/GSD-2022-1002079.json
Related vulnerabilities
Recent vulnerabilities recorded for Kernel.