CVE-2021-47303
📋 TL;DR
A use-after-free vulnerability in the Linux kernel's BPF subsystem allows attackers to access freed memory when running BPF programs. This can lead to kernel crashes, information leaks, or potential privilege escalation. Systems running vulnerable Linux kernel versions with BPF enabled are affected.
💻 Affected Systems
- Linux Kernel
📦 What is this software?
Linux Kernel by Linux
The Linux Kernel is the core component of the Linux operating system, serving as the critical interface between computer hardware and software processes. As the heart of millions of servers, cloud infrastructure, embedded systems, Android devices, and IoT deployments worldwide, the Linux Kernel mana...
Learn more about Linux Kernel →Linux Kernel by Linux
The Linux Kernel is the core component of the Linux operating system, serving as the critical interface between computer hardware and software processes. As the heart of millions of servers, cloud infrastructure, embedded systems, Android devices, and IoT deployments worldwide, the Linux Kernel mana...
Learn more about Linux Kernel →Linux Kernel by Linux
The Linux Kernel is the core component of the Linux operating system, serving as the critical interface between computer hardware and software processes. As the heart of millions of servers, cloud infrastructure, embedded systems, Android devices, and IoT deployments worldwide, the Linux Kernel mana...
Learn more about Linux Kernel →⚠️ Risk & Real-World Impact
Worst Case
Kernel panic leading to system crash, potential privilege escalation to root, or arbitrary code execution in kernel context.
Likely Case
Kernel crash causing system instability or denial of service, potentially leading to information disclosure through memory leaks.
If Mitigated
Limited impact if BPF is disabled or systems are properly patched, though unpatched systems remain vulnerable to crashes.
🎯 Exploit Status
Exploitation requires ability to load and execute BPF programs, which typically requires CAP_BPF or similar capabilities. The vulnerability is in kernel memory management logic.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: Fixed in stable kernel versions via commits: 599148d40366bd5d1d504a3a8fcd65e21107e500, a9f36bf3613c65cb587c70fac655c775d911409b, f263a81451c12da5a342d90572e317e611846f2c
Vendor Advisory: https://git.kernel.org/stable/c/599148d40366bd5d1d504a3a8fcd65e21107e500
Restart Required: Yes
Instructions:
1. Update to a patched kernel version from your distribution vendor. 2. For custom kernels, apply the relevant fix commits from kernel.org. 3. Reboot the system to load the new kernel.
🔧 Temporary Workarounds
Disable BPF subsystem
linuxPrevents loading of BPF programs that could trigger the vulnerability
echo 1 > /proc/sys/kernel/unprivileged_bpf_disabled
sysctl -w kernel.unprivileged_bpf_disabled=1
Restrict BPF capabilities
linuxLimit which users can load BPF programs using Linux capabilities
setcap -r /path/to/binary
Use Linux Security Modules (LSM) like SELinux or AppArmor to restrict BPF
🧯 If You Can't Patch
- Implement strict access controls to prevent unauthorized users from loading BPF programs
- Monitor system logs for BPF-related errors or crashes and implement immediate incident response procedures
🔍 How to Verify
Check if Vulnerable:
Check kernel version and verify if it's between vulnerable ranges. Examine dmesg for KASAN reports related to prog_array_map_poke_run.
Check Version:
uname -r
Verify Fix Applied:
Verify kernel version includes the fix commits or is newer than the patched versions. Test BPF functionality to ensure stability.
📡 Detection & Monitoring
Log Indicators:
- KASAN reports in dmesg/kernel logs mentioning 'use-after-free' in 'prog_array_map_poke_run'
- Kernel panic or oops messages related to BPF
Network Indicators:
- Unusual BPF program loading activity from unexpected users or processes
SIEM Query:
source="kernel" AND ("KASAN" OR "use-after-free" OR "prog_array_map_poke_run")
🔗 References
- https://git.kernel.org/stable/c/599148d40366bd5d1d504a3a8fcd65e21107e500
- https://git.kernel.org/stable/c/a9f36bf3613c65cb587c70fac655c775d911409b
- https://git.kernel.org/stable/c/f263a81451c12da5a342d90572e317e611846f2c
- https://git.kernel.org/stable/c/599148d40366bd5d1d504a3a8fcd65e21107e500
- https://git.kernel.org/stable/c/a9f36bf3613c65cb587c70fac655c775d911409b
- https://git.kernel.org/stable/c/f263a81451c12da5a342d90572e317e611846f2c