CVE-2021-46974 bpf: Fix masking negation logic upon negative dst register
Incorrect masking logic in the Linux kernel BPF verifier allows attackers to bypass bounds checks, potentially leading to arbitrary code execution.
- Exploited in the wild
- Not known
- Login needed
- Any signed-in user
- Attackable
- Local or same network only
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2021-46974?
CVE-2021-46974 is a high-severity vulnerability in Linux kernel, published on 27 Feb 2024. It can only be exploited from the same machine or local network, with no action from the victim.
Official description
In the Linux kernel, the following vulnerability has been resolved:
bpf: Fix masking negation logic upon negative dst register
The negation logic for the case where the off_reg is sitting in the dst register is not correct given then we cannot just invert the add to a sub or vice versa. As a fix, perform the final bitwise and-op unconditionally into AX from the off_reg, then move the pointer from the src to dst and finally use AX as the source for the original pointer arithmetic operation such that the inversion yields a correct result. The single non-AX mov in between is possible given constant blinding is retaining it as it's not an immediate based operation.
Which versions are affected by CVE-2021-46974?
It affects 1 product.
Products include Linux kernel.
How do I fix CVE-2021-46974?
Apply the vendor's patch.
Is CVE-2021-46974 being exploited?
There is no known exploitation of CVE-2021-46974 in the wild and no public exploit code.
Other vulnerabilities in Linux kernel
Sources
Also known as DEBIAN-CVE-2021-46974, GHSA-78xq-q56p-fpwx, UBUNTU-CVE-2021-46974.