CVE-2021-47608·Kernel vulnerability
In the Linux kernel, the following vulnerability has been resolved: bpf: Fix kernel address leakage in atomic fetch The change in commit 37086bfdc737 ("bpf: Propagate stack bounds to registers in atomics w/ BPF_FETCH") around check_mem_access() handling is buggy since this would allow for unprivileged users to leak kernel pointers. For example, an atomic fetch/and with -1 on a stack destination which holds a spilled pointer will migrate the spilled register type into a scalar, which can then be exported out of the program (since scalar != pointer) by dumping it into a map value. The original implementation of XADD was preventing this situation by using a double call to check_mem_access() one with BPF_READ and a subsequent one with BPF_WRITE, in both cases passing -1 as a placeholder value instead of register as per XADD semantics since it didn't contain a value fetch. The BPF_READ also included a check in check_stack_read_fixed_off() which rejects the program if the stack slot is of __is_pointer_value() if dst_regno < 0. The latter is to distinguish whether we're dealing with a regular stack spill/ fill or some arithmetical operation which is disallowed on non-scalars, see also 6e7e63cbb023 ("bpf: Forbid XADD on spilled pointers for unprivileged users") for more context on check_mem_access() and its handling of placeholder value -1. One minimally intrusive option to fix the leak is for the BPF_FETCH case to initially check the BPF_READ case via check_mem_access() with -1 as register, followed by the actual load case with non-negative load_reg to propagate stack bounds to registers.
- Severity
- medium
- Software
- Kernel
- Fixed in
- 5.15.11
- Published
- 2024-06-19
Affected versions
From: 5.12
Until: 5.15.11
Fixed in: 5.15.11
How to fix this CVE
Update your Linux kernel to version 5.15.11 or later to patch a memory disclosure vulnerability in BPF atomic operations. Unprivileged users could previously leak kernel pointers by performing atomic fetch operations on spilled pointers on the stack. Apply the patch immediately, especially on systems running kernels 5.12 through 5.15.10.
sudo dnf update kernel kernel-develDefensia detects this vulnerability
How to check if you are affected
- Step 1: Check your kernel version with `uname -r` and verify if it falls in the range 5.12.x to 5.15.10
- Step 2: Confirm BPF is enabled in your kernel with `grep CONFIG_BPF /boot/config-$(uname -r)` — if it returns 'y', the vulnerable code path is compiled
- Step 3: Search system logs for failed BPF program loads with `journalctl -xe | grep -i bpf` or check dmesg with `dmesg | grep -i 'bpf\|atomic'`
- Step 4: After patching, verify the new kernel version with `uname -r` to confirm it is 5.15.11 or later
FAQ
What is CVE-2021-47608?
CVE-2021-47608 is a kernel memory disclosure flaw in BPF atomic operations that allows unprivileged users to leak kernel pointers by performing atomic fetch operations on spilled pointers stored on the stack, converting them to scalars that can be extracted from BPF programs.
Is CVE-2021-47608 being actively exploited?
No, according to CISA's Known Exploited Vulnerabilities catalog, CVE-2021-47608 is not being actively exploited, and no public exploits are currently available.
What versions of Kernel are affected by CVE-2021-47608?
Linux kernel versions 5.12 through 5.15.10 are affected; version 5.15.11 and later include the fix.
How do I check if my server is vulnerable to CVE-2021-47608?
Run `uname -r` and confirm your kernel version is between 5.12 and 5.15.10, then verify BPF is enabled with `grep CONFIG_BPF /boot/config-$(uname -r)` returning 'y'.
Does Defensia detect CVE-2021-47608?
Yes — Defensia's CVE advisory scanner compares installed package versions against the NVD database. If Kernel is installed on a monitored server, CVE-2021-47608 will appear in your dashboard with remediation steps.
Related Kernel CVEs
References
Track CVEs across your fleet automatically
Defensia scans your Linux servers and tells you exactly which ones are running vulnerable versions — including CVE-2021-47608. Free for 1 server.
Get started free