CVE-2024-27050: libbpf: Use OPTS_SET() macro in bpf_xdp_query()
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.
Security readout for executives and security teams
Plain-English summary
A compatibility bug in Linux libbpf can corrupt an application's stack when older software calls bpf_xdp_query() through a newer, vulnerable library. The resulting out-of-bounds writes could crash the process or compromise its confidentiality and integrity. The supplied CVSS score is 7.8, rated high.
Executive priority
Treat as a high-priority compatibility and memory-safety issue on hosts using XDP/libbpf, especially where locally accessible workloads process sensitive traffic. Patch through supported vendor channels after testing. Broad emergency action is not supported by the supplied evidence because active exploitation has not been reported.
Technical view
libbpf wrote feature_flags and xdp_zc_max_segs into bpf_xdp_query_opts without checking whether the caller's older, smaller structure contained those fields. The stable fixes use OPTS_SET() for size-aware assignments, preventing CWE-787 out-of-bounds stack writes.
Likely exposure
Exposure requires software compiled against an older libbpf structure layout to call bpf_xdp_query() using a vulnerable libbpf implementation. The bundle identifies affected Linux release points including 6.6, 6.6.23, 6.7.11, 6.8.2, and 6.9, but does not provide complete distribution-package mappings.
Exploitation context
The supplied record is not in CISA KEV and provides no evidence of active exploitation or a public exploit. Its CVSS vector describes a local, low-complexity condition requiring low privileges and no user interaction. Practical exploitability is not established by the sources.
Researcher notes
The vulnerable boundary is the caller-provided opts size, not merely the presence of the new fields. One earlier change checked feature_flags with OPTS_HAS(), while xdp_zc_max_segs lacked equivalent protection. The resolution consistently routes both writes through OPTS_SET(). Branch-specific fixed-release mapping remains incomplete in the supplied bundle.
Mitigation direction
Install vendor-supported Linux or libbpf packages containing the corresponding stable fix.
Prioritize systems running XDP applications built against older libbpf headers.
Consult distribution advisories when package-to-upstream version mapping is unclear.
Rebuild affected applications against supported headers where vendor guidance recommends it.
Validation and detection
Inventory installed Linux and libbpf versions, including distribution backports.
Identify applications calling bpf_xdp_query() and record their build-time libbpf headers.
Confirm both affected assignments use OPTS_SET() in the deployed source or vendor patch.
Exercise affected applications under memory-safety instrumentation in a controlled environment.
Verify package provenance and restart affected applications after remediation.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cwe · low confidence lookup
CWE-787: Exact CWE lookup
Use the exact CWE identifier as the starting point before reviewing related ATT&CK behavior. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.
CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.
CWE-787 · source CWE mapping
Out-of-bounds Write
Out-of-bounds Write represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.