netdevsim: Zero-initialize memory for new map's value in function nsim_bpf_map_alloc
Summary
GSD-2021-1002654: netdevsim: Zero-initialize memory for new map's value in function nsim_bpf_map_alloc. Affects Kernel versions >= 395cacb5f1a0a290f1ae9ca4692c400d2b57a705, < d861443c4dc88650eed113310d933bd593d37b23. 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 netdevsim package is a part of the Linux Kernel ecosystem. It provides a network device simulator that allows developers to test and experiment with various networking features without the need for physical hardware. The package includes functionality for creating and managing BPF maps, which are data structures used by the Berkeley Packet Filter (BPF) to store and manipulate network data. These maps are crucial for efficient packet filtering and processing.
Vulnerability Detail
The vulnerability identified as GSD-2021-1002654 in the netdevsim package arises from a failure to zero-initialize memory for a new map's value in the nsim_bpf_map_alloc function. This oversight can lead to uninitialized memory being accessed and potentially exploited by an attacker. While the actual impact and attack plausibility have not been proven, this vulnerability highlights a potential security risk that should be addressed.
How To Fix
No fixed version is published for this vulnerability.
To fix this vulnerability, it is recommended to update the Linux Kernel to version v4.19.222 or later. The fix for this issue was implemented in commit d861443c4dc88650eed113310d933bd593d37b23. By applying this update, the netdevsim package will ensure that memory for new map values is properly zero-initialized, mitigating the risk of uninitialized memory access.
Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →
Workaround
As a workaround, developers can manually modify the nsim_bpf_map_alloc function in the netdevsim package to include zero-initialization of the memory for new map values. Here is an example of the modified code:
void *nsim_bpf_map_alloc(struct nsim_bpf_map *nmap)
{
void *value;
value = kzalloc(nmap->value_size, GFP_KERNEL);
if (!value)
return NULL;
return value;
}
By incorporating this modification, the vulnerability can be addressed until the package is updated to the fixed version.
Conclusion
The netdevsim package in the Linux Kernel is vulnerable to a zero-initialization issue in the nsim_bpf_map_alloc function. This vulnerability can potentially lead to security risks through uninitialized memory access. It is recommended to update the package to the fixed version or apply the provided workaround. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for Kernel →
FAQ
The netdevsim package is a network device simulator included in the Linux Kernel ecosystem. It allows developers to test and experiment with networking features without physical hardware.
BPF maps are data structures used by the Berkeley Packet Filter (BPF) to store and manipulate network data. They play a crucial role in efficient packet filtering and processing.
The impact of this vulnerability is not yet proven. However, it has the potential to allow attackers to exploit uninitialized memory, leading to potential security risks.
To fix this vulnerability, it is recommended to update the Linux Kernel to version v4.19.222 or later, which includes the necessary fix for this issue.
Yes, developers can manually modify the nsim_bpf_map_alloc function in the netdevsim package to include zero-initialization of memory for new map values. The provided code snippet demonstrates the necessary modification.
Related vulnerabilities
Recent vulnerabilities recorded for Kernel.
Follow Vulert in Google
Get more Vulert vulnerability and dependency-security updates in Google Search and AI results.