Skip to main content

CVE-2021-47376: Vulnerability in Linux Linux

Medium
VulnerabilityCVE-2021-47376cvecve-2021-47376
Published: Tue May 21 2024 (05/21/2024, 15:03:39 UTC)
Source: CVE
Vendor/Project: Linux
Product: Linux

Description

In the Linux kernel, the following vulnerability has been resolved: bpf: Add oversize check before call kvcalloc() Commit 7661809d493b ("mm: don't allow oversized kvmalloc() calls") add the oversize check. When the allocation is larger than what kmalloc() supports, the following warning triggered: WARNING: CPU: 0 PID: 8408 at mm/util.c:597 kvmalloc_node+0x108/0x110 mm/util.c:597 Modules linked in: CPU: 0 PID: 8408 Comm: syz-executor221 Not tainted 5.14.0-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:kvmalloc_node+0x108/0x110 mm/util.c:597 Call Trace: kvmalloc include/linux/mm.h:806 [inline] kvmalloc_array include/linux/mm.h:824 [inline] kvcalloc include/linux/mm.h:829 [inline] check_btf_line kernel/bpf/verifier.c:9925 [inline] check_btf_info kernel/bpf/verifier.c:10049 [inline] bpf_check+0xd634/0x150d0 kernel/bpf/verifier.c:13759 bpf_prog_load kernel/bpf/syscall.c:2301 [inline] __sys_bpf+0x11181/0x126e0 kernel/bpf/syscall.c:4587 __do_sys_bpf kernel/bpf/syscall.c:4691 [inline] __se_sys_bpf kernel/bpf/syscall.c:4689 [inline] __x64_sys_bpf+0x78/0x90 kernel/bpf/syscall.c:4689 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae

AI-Powered Analysis

AILast updated: 07/04/2025, 06:39:37 UTC

Technical Analysis

CVE-2021-47376 is a vulnerability identified in the Linux kernel related to the handling of memory allocation within the BPF (Berkeley Packet Filter) subsystem. Specifically, the issue arises from the lack of an oversize check before calling the kvcalloc() function, which is used to allocate zeroed memory arrays. The vulnerability was addressed by adding an oversize check in the kernel's memory management code (commit 7661809d493b), preventing allocations larger than what kmalloc() supports. Without this check, an attacker could potentially trigger oversized allocations leading to kernel warnings or crashes. The vulnerability is rooted in the kernel's memory allocator functions kvmalloc_node(), kvmalloc_array(), and kvcalloc(), which are used during BPF program verification and loading. The trace provided shows the vulnerability manifests during BPF program verification in the kernel's verifier code, which could be exploited by submitting crafted BPF programs. Although no known exploits are currently reported in the wild, the vulnerability could allow denial of service (DoS) conditions by causing kernel warnings or crashes due to improper memory allocation handling. The BPF subsystem is critical for packet filtering, tracing, and security monitoring, making this vulnerability significant in contexts where untrusted users can load BPF programs. The vulnerability affects Linux kernel versions prior to the patch and is relevant for systems running kernel version 5.14.0-syzkaller and similar. The fix involves adding a size check to prevent oversized allocations, thereby improving kernel stability and security during BPF program verification and execution.

Potential Impact

For European organizations, this vulnerability poses a risk primarily in environments where unprivileged or semi-privileged users have the ability to load or verify BPF programs, such as multi-tenant cloud infrastructures, containerized environments, or systems using advanced networking and monitoring tools that leverage BPF. Exploitation could lead to denial of service by crashing the kernel or causing instability, impacting availability of critical systems. This could disrupt services, especially in sectors relying heavily on Linux-based infrastructure such as telecommunications, finance, and cloud service providers. While the vulnerability does not appear to allow privilege escalation or remote code execution directly, the resulting DoS could be leveraged as part of a broader attack chain. Additionally, given the widespread use of Linux in European data centers and cloud platforms, unpatched systems could be vulnerable to targeted attacks or accidental crashes caused by malformed BPF programs. The absence of known exploits reduces immediate risk but does not eliminate the potential for future weaponization, especially as BPF usage grows in security and networking applications.

Mitigation Recommendations

European organizations should prioritize patching Linux kernels to versions that include the fix for CVE-2021-47376. Specifically, update to kernel versions incorporating commit 7661809d493b or later. For environments where immediate patching is challenging, consider restricting the ability to load or verify BPF programs to trusted users only, using Linux capabilities and seccomp filters to limit exposure. Employ kernel security modules (e.g., SELinux, AppArmor) to enforce strict policies around BPF program loading. Monitor kernel logs for warnings related to kvmalloc_node or kvcalloc to detect potential exploitation attempts. In containerized or cloud environments, isolate workloads and limit privileges to reduce the attack surface. Regularly audit and update kernel versions as part of vulnerability management programs. Additionally, educate system administrators about the risks associated with untrusted BPF programs and enforce strict code review and validation processes for any custom BPF code deployed in production.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
Linux
Date Reserved
2024-05-21T14:58:30.811Z
Cisa Enriched
true
Cvss Version
null
State
PUBLISHED

Threat ID: 682cd0fa1484d88663aebf4c

Added to database: 5/20/2025, 6:59:06 PM

Last enriched: 7/4/2025, 6:39:37 AM

Last updated: 8/1/2025, 12:41:09 AM

Views: 17

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats