CVE-2024-27050 libbpf: Use OPTS_SET() macro in bpf_xdp_query()
Out-of-bounds write in libbpf's bpf_xdp_query allows stack corruption, potentially leading to code execution or denial of service.
- 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-2024-27050?
CVE-2024-27050 is a high-severity memory corruption vulnerability in Linux kernel, published on 1 May 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:
libbpf: Use OPTS_SET() macro in bpf_xdp_query()
When the feature_flags and xdp_zc_max_segs fields were added to the libbpf bpf_xdp_query_opts, the code writing them did not use the OPTS_SET() macro. This causes libbpf to write to those fields unconditionally, which means that programs compiled against an older version of libbpf (with a smaller size of the bpf_xdp_query_opts struct) will have its stack corrupted by libbpf writing out of bounds.
The patch adding the feature_flags field has an early bail out if the feature_flags field is not part of the opts struct (via the OPTS_HAS) macro, but the patch adding xdp_zc_max_segs does not. For consistency, this fix just changes the assignments to both fields to use the OPTS_SET() macro.
Weakness: CWE-787
Which versions are affected by CVE-2024-27050?
It affects 1 product.
Products include Linux kernel.
How do I fix CVE-2024-27050?
Apply the vendor's patch.
Upgrade to the fixed version. Memory-safe languages, compiler hardening and fuzzing prevent most new cases. More about Memory corruption.
Is CVE-2024-27050 being exploited?
There is no known exploitation of CVE-2024-27050 in the wild and no public exploit code.
Other vulnerabilities in Linux kernel
Sources
Also known as BELL-CVE-2024-27050, DEBIAN-CVE-2024-27050, GHSA-cw72-f9mw-h9c4, OESA-2025-1576, OESA-2025-1577, UBUNTU-CVE-2024-27050.