CVE-2024-50164: bpf: Fix overloading of MEM_UNINIT's meaning
In the Linux kernel, the following vulnerability has been resolved:
bpf: Fix overloading of MEM_UNINIT's meaning
Lonial reported an issue in the BPF verifier where check_mem_size_reg()
has the following code:
if (!tnum_is_const(reg->var_off))
/* For unprivileged variable accesses, disable raw
* mode so that the program is required to
* initialize all the memory that the helper could
* just partially fill up.
*/
meta = NULL;
This means that writes are not checked when the register containing the
size of the passed buffer has not a fixed size. Through this bug, a BPF
program can write to a map which is marked as read-only, for example,
.rodata global maps.
The problem is that MEM_UNINIT's initial meaning that "the passed buffer
to the BPF helper does not need to be initialized" which was added back
in commit 435faee1aae9 ("bpf, verifier: add ARG_PTR_TO_RAW_STACK type")
got overloaded over time with "the passed buffer is being written to".
The problem however is that checks such as the above which were added later
via 06c1c049721a ("bpf: allow helpers access to variable memory") set meta
to NULL in order force the user to always initialize the passed buffer to
the helper. Due to the current double meaning of MEM_UNINIT, this bypasses
verifier write checks to the memory (not boundary checks though) and only
assumes the latter memory is read instead.
Fix this by reverting MEM_UNINIT back to its original meaning, and having
MEM_WRITE as an annotation to BPF helpers in order to then trigger the
BPF verifier checks for writing to memory.
Some notes: check_arg_pair_ok() ensures that for ARG_CONST_SIZE{,_OR_ZERO}
we can access fn->arg_type[arg - 1] since it must contain a preceding
ARG_PTR_TO_MEM. For check_mem_reg() the meta argument can be removed
altogether since we do check both BPF_READ and BPF_WRITE. Same for the
equivalent check_kfunc_mem_size_reg().
Security readout for executives and security teams
Plain-English summary
CVE-2024-50164 is a Linux kernel BPF verifier flaw. A BPF program could write to memory that should be read-only, such as read-only BPF map data. This is a kernel integrity issue, but the sources do not provide a CVSS score, impact rating, or evidence of active exploitation.
Executive priority
Treat as a routine-to-accelerated Linux kernel patching item, higher priority for shared compute and container hosts. There is no sourced evidence of exploitation, but kernel integrity issues can become important quickly when BPF is exposed.
Technical view
The BPF verifier overloaded MEM_UNINIT to mean both uninitialized buffer and write target. When a helper buffer size was variable, meta could be set to NULL, bypassing write checks while retaining boundary checks. The fix restores MEM_UNINIT’s original meaning and adds MEM_WRITE annotations for helper write validation.
Likely exposure
Exposure is likely limited to Linux systems running affected kernel builds where BPF program loading is available to local users, services, or workloads. The source data lists Linux kernel ranges and stable commits, but exact exposure depends on distributor backports and product packaging.
Exploitation context
No KEV entry or provided source states active exploitation. The described issue requires submitting a BPF program that reaches the verifier path. Sources indicate a write-check bypass, not a remote network attack path.
Researcher notes
The core bug is verifier state confusion around MEM_UNINIT and MEM_WRITE semantics in helper memory arguments. Source evidence names read-only BPF map writes, including .rodata globals. Boundary checks were reportedly not bypassed. Validate against exact stable commits or downstream backports, not only version strings.
Mitigation direction
Apply Linux kernel updates containing the referenced stable fixes or distributor backports.
If updates are unavailable, follow vendor guidance for temporary BPF exposure reduction.
Prioritize shared hosts, container platforms, and systems allowing less-trusted BPF program loading.
Track Debian LTS and Siemens advisories if those environments are in scope.
Validation and detection
Inventory running kernel versions and distributor package builds.
Confirm the installed kernel includes a referenced stable fix or vendor backport.
Check Debian LTS and Siemens advisories for affected product applicability.
Document whether untrusted users or workloads can load BPF programs.
Reboot into the updated kernel and verify the active kernel changed.
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.
cve · low confidence lookup
CVE-2024-50164 mapping review
Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.
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.
0CVSS vectors
3Timeline events
2ADP providers
7Source links
Vulnerability timeline
Timeline events are normalized from CVE metadata, CNA source timelines, ADP timelines, and KEV metadata when present.
CVE reservedCVE Program
The CVE ID was reserved by the assigning CNA.
CVE publishedCVE Program
The CVE record was published.
Nov 7, 2024, 09:31 UTC (UTC+00:00)
CVE updatedCVE Program
The CVE record metadata indicates this as the latest update time.