CVE-2024-50164: Vulnerability in Linux Linux
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().
AI Analysis
Technical Summary
CVE-2024-50164 is a vulnerability identified in the Linux kernel's Berkeley Packet Filter (BPF) verifier component. The issue arises from an overloaded meaning of the MEM_UNINIT flag within the BPF verifier's memory checking logic. Originally, MEM_UNINIT indicated that the passed buffer to a BPF helper did not require initialization. Over time, this flag's meaning was extended to also imply that the buffer was being written to. This dual meaning caused a logical flaw in the verifier's checks. Specifically, in the function check_mem_size_reg(), when the size register of a buffer is not a constant, the verifier disables raw mode and sets a metadata pointer to NULL to enforce initialization requirements. However, due to the overloaded MEM_UNINIT semantics, this leads to bypassing write checks on memory, although boundary checks remain enforced. Consequently, a BPF program can exploit this flaw to write to read-only maps, such as .rodata global maps, which should be immutable. The root cause is that the verifier incorrectly assumes memory marked as MEM_UNINIT is only read, not written, allowing unauthorized writes. The fix involves reverting MEM_UNINIT to its original meaning and introducing a separate MEM_WRITE annotation for BPF helpers to properly trigger write verification. This correction ensures that the verifier accurately enforces memory write restrictions and prevents unauthorized modifications to read-only maps. The vulnerability affects multiple recent Linux kernel versions as identified by specific commit hashes. No known exploits are currently reported in the wild, and no CVSS score has been assigned yet.
Potential Impact
For European organizations, this vulnerability poses a significant risk primarily to systems running Linux kernels with vulnerable BPF verifier implementations. Since BPF is widely used for network packet filtering, tracing, and security monitoring, exploitation could allow attackers to bypass memory safety checks and write to read-only kernel maps. This could lead to privilege escalation, kernel data corruption, or subversion of security controls relying on BPF maps. The ability to write to .rodata maps could enable attackers to alter kernel behavior or disable security features, potentially compromising system integrity and confidentiality. Given the prevalence of Linux in European enterprise servers, cloud infrastructure, and embedded devices, exploitation could impact critical infrastructure, financial institutions, and government systems. The lack of authentication or user interaction requirements for BPF programs running in kernel space increases the severity, especially if unprivileged users or containerized workloads can load malicious BPF code. However, exploitation complexity is moderate as it requires crafting specific BPF programs and kernel access. The absence of known exploits suggests limited immediate threat but warrants proactive patching to prevent future attacks.
Mitigation Recommendations
European organizations should prioritize updating Linux kernels to versions where this vulnerability is patched, reverting MEM_UNINIT semantics and adding MEM_WRITE annotations. Kernel maintainers and distributors should release and deploy security updates promptly. System administrators should audit and restrict the ability to load BPF programs, especially for unprivileged users and containerized environments, using Linux Security Modules (LSMs) like SELinux or AppArmor to enforce strict policies. Employing seccomp filters to limit BPF syscalls can reduce attack surface. Monitoring kernel logs and BPF program loading activities can help detect anomalous behavior. For environments using container orchestration, enforce runtime security policies that prevent unauthorized BPF program loading. Additionally, organizations should review and harden configurations of BPF maps, ensuring sensitive maps are not exposed unnecessarily. Since the vulnerability involves kernel-level memory checks, running kernel integrity monitoring tools can help detect unauthorized modifications. Finally, maintain an incident response plan to quickly address potential exploitation attempts.
Affected Countries
Germany, France, United Kingdom, Netherlands, Sweden, Finland, Italy, Spain, Poland, Belgium
CVE-2024-50164: Vulnerability in Linux Linux
Description
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().
AI-Powered Analysis
Technical Analysis
CVE-2024-50164 is a vulnerability identified in the Linux kernel's Berkeley Packet Filter (BPF) verifier component. The issue arises from an overloaded meaning of the MEM_UNINIT flag within the BPF verifier's memory checking logic. Originally, MEM_UNINIT indicated that the passed buffer to a BPF helper did not require initialization. Over time, this flag's meaning was extended to also imply that the buffer was being written to. This dual meaning caused a logical flaw in the verifier's checks. Specifically, in the function check_mem_size_reg(), when the size register of a buffer is not a constant, the verifier disables raw mode and sets a metadata pointer to NULL to enforce initialization requirements. However, due to the overloaded MEM_UNINIT semantics, this leads to bypassing write checks on memory, although boundary checks remain enforced. Consequently, a BPF program can exploit this flaw to write to read-only maps, such as .rodata global maps, which should be immutable. The root cause is that the verifier incorrectly assumes memory marked as MEM_UNINIT is only read, not written, allowing unauthorized writes. The fix involves reverting MEM_UNINIT to its original meaning and introducing a separate MEM_WRITE annotation for BPF helpers to properly trigger write verification. This correction ensures that the verifier accurately enforces memory write restrictions and prevents unauthorized modifications to read-only maps. The vulnerability affects multiple recent Linux kernel versions as identified by specific commit hashes. No known exploits are currently reported in the wild, and no CVSS score has been assigned yet.
Potential Impact
For European organizations, this vulnerability poses a significant risk primarily to systems running Linux kernels with vulnerable BPF verifier implementations. Since BPF is widely used for network packet filtering, tracing, and security monitoring, exploitation could allow attackers to bypass memory safety checks and write to read-only kernel maps. This could lead to privilege escalation, kernel data corruption, or subversion of security controls relying on BPF maps. The ability to write to .rodata maps could enable attackers to alter kernel behavior or disable security features, potentially compromising system integrity and confidentiality. Given the prevalence of Linux in European enterprise servers, cloud infrastructure, and embedded devices, exploitation could impact critical infrastructure, financial institutions, and government systems. The lack of authentication or user interaction requirements for BPF programs running in kernel space increases the severity, especially if unprivileged users or containerized workloads can load malicious BPF code. However, exploitation complexity is moderate as it requires crafting specific BPF programs and kernel access. The absence of known exploits suggests limited immediate threat but warrants proactive patching to prevent future attacks.
Mitigation Recommendations
European organizations should prioritize updating Linux kernels to versions where this vulnerability is patched, reverting MEM_UNINIT semantics and adding MEM_WRITE annotations. Kernel maintainers and distributors should release and deploy security updates promptly. System administrators should audit and restrict the ability to load BPF programs, especially for unprivileged users and containerized environments, using Linux Security Modules (LSMs) like SELinux or AppArmor to enforce strict policies. Employing seccomp filters to limit BPF syscalls can reduce attack surface. Monitoring kernel logs and BPF program loading activities can help detect anomalous behavior. For environments using container orchestration, enforce runtime security policies that prevent unauthorized BPF program loading. Additionally, organizations should review and harden configurations of BPF maps, ensuring sensitive maps are not exposed unnecessarily. Since the vulnerability involves kernel-level memory checks, running kernel integrity monitoring tools can help detect unauthorized modifications. Finally, maintain an incident response plan to quickly address potential exploitation attempts.
For access to advanced analysis and higher rate limits, contact root@offseq.com
Technical Details
- Data Version
- 5.1
- Assigner Short Name
- Linux
- Date Reserved
- 2024-10-21T19:36:19.962Z
- Cisa Enriched
- false
- Cvss Version
- null
- State
- PUBLISHED
Threat ID: 682d9820c4522896dcbdcf60
Added to database: 5/21/2025, 9:08:48 AM
Last enriched: 6/27/2025, 9:56:40 PM
Last updated: 8/17/2025, 8:53:53 AM
Views: 14
Related Threats
CVE-2025-53948: CWE-415 Double Free in Santesoft Sante PACS Server
HighCVE-2025-52584: CWE-122 Heap-based Buffer Overflow in Ashlar-Vellum Cobalt
HighCVE-2025-46269: CWE-122 Heap-based Buffer Overflow in Ashlar-Vellum Cobalt
HighCVE-2025-54862: CWE-79 Improper Neutralization of Input During Web Page Generation (XSS or 'Cross-site Scripting') in Santesoft Sante PACS Server
MediumCVE-2025-54759: CWE-79 Improper Neutralization of Input During Web Page Generation (XSS or 'Cross-site Scripting') in Santesoft Sante PACS Server
MediumActions
Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.
External Links
Need enhanced features?
Contact root@offseq.com for Pro access with improved analysis and higher rate limits.