Memory Leak in tcp_bpf_sendmsg in Kernel
Summary
GSD-2022-1001518: bpf, sockmap: Fix memleak in tcp_bpf_sendmsg while sk msg is full. Affects Kernel versions >= 604326b41a6fb9b4a78b6179335decee0365cd8c, < f677328f05f52d535cbdc15cb04476db49477eb4. 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 critical component of the Linux operating system that provides core functionalities and interfaces between hardware and software. It manages system resources, facilitates communication between processes, and ensures security and stability. The tcp_bpf_sendmsg function is responsible for sending messages over TCP sockets using Berkeley Packet Filter (BPF) programs. BPF allows users to define custom filters and transformations for network packets. However, a memory leak vulnerability has been discovered in tcp_bpf_sendmsg, which can lead to resource exhaustion and potential denial-of-service attacks.
Vulnerability Detail
The vulnerability in tcp_bpf_sendmsg arises when the socket message (sk msg) is full. In this scenario, the function fails to release allocated memory, resulting in a memory leak. An attacker could exploit this vulnerability by repeatedly sending messages to a TCP socket until the system's memory resources are exhausted. This could lead to a denial-of-service condition, causing the affected system to become unresponsive or crash. The vulnerability was introduced in version v4.20 of the Linux Kernel and has been fixed in version v5.16.19.
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 a patch or backport the fix to their current Kernel version. The patch can be obtained from the commit f677328f05f52d535cbdc15cb04476db49477eb4. Here is an example of how to apply the patch:
- Download the patch file from the commit: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=f677328f05f52d535cbdc15cb04476db49477eb4
- Navigate to the Kernel source code directory.
- Apply the patch using the following command:
patch -p1 < path/to/patch/file - Recompile and reinstall the Kernel.
Conclusion
The memory leak vulnerability in tcp_bpf_sendmsg can have severe consequences, including denial-of-service attacks. It is crucial to update the Linux Kernel to version v5.16.19 or later to mitigate this vulnerability. Users can also apply the provided patch as a temporary workaround. For further assistance or support in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for Kernel →
FAQ
The vulnerability can lead to a memory leak, causing resource exhaustion and potential denial-of-service attacks. It can make the affected system unresponsive or crash.
You can use the Vulert Playground at Vulert Scanner to check if your system is affected by this vulnerability. Simply upload your package-lock.json file, and Vulert will analyze it for any open-source vulnerabilities, including this one.
There is no evidence of this vulnerability being exploited in the wild at the time of discovery. However, it is crucial to apply the fix or update the Kernel to mitigate any potential risks.
Yes, users can apply a patch or backport the fix to their current Kernel version. The workaround details can be found in the 'workaround' section of this report.
For more information about this vulnerability, you can refer to the vulnerability database entry at https://github.com/cloudsecurityalliance/gsd-database/blob/main/2022/1001xxx/GSD-2022-1001518.json
Related vulnerabilities
Recent vulnerabilities recorded for Kernel.