Skip to main content
Vulnerability Database/CVE-2024-26588

CVE-2024-26588: Linux Kernel Buffer Overflow Vulnerability

CVE-2024-26588 is a buffer overflow vulnerability in Linux Kernel that causes out-of-bounds memory access in LoongArch BPF implementation. This post explains its technical details, affected versions, impact, and mitigation steps.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2024-26588 Overview

CVE-2024-26588 is a vulnerability in the Linux kernel's LoongArch Berkeley Packet Filter (BPF) just-in-time (JIT) compiler. The flaw allows out-of-bounds memory access during BPF program compilation on LoongArch architecture systems. A local user running the test_tag BPF selftest can trigger an unhandled kernel page fault, resulting in a kernel oops and denial of service. The issue surfaces when the JIT compiler builds the body of larger BPF programs on systems configured with CONFIG_PAGE_SIZE_16KB=y.

Critical Impact

A local, authenticated user can trigger an unhandled kernel page fault via BPF program loading, causing kernel instability and potential memory corruption on LoongArch systems.

Affected Products

  • Linux Kernel on LoongArch architecture (prior to patched stable releases)
  • Linux Kernel builds with CONFIG_PAGE_SIZE_16KB=y on LoongArch
  • Linux Kernel versions containing the LoongArch BPF JIT compiler before commits 36a87385, 4631c2dd, 7924ade1, and 9aeb09f4

Discovery Timeline

  • 2024-02-22 - CVE-2024-26588 published to NVD
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2024-26588

Vulnerability Analysis

The vulnerability resides in the LoongArch BPF JIT compiler's build_body() function in the Linux kernel. When compiling a BPF program containing a sufficient number of instructions (observed at 2039 instructions during the test_tag selftest), the JIT reads past the allocated instruction buffer. The resulting access targets an unmapped virtual address and triggers a kernel paging request failure.

The call path leading to the fault is sys_bpf → bpf_prog_load → bpf_prog_select_runtime → bpf_int_jit_compile → build_body. Successful exploitation renders the calling process tainted and crashes the kernel path handling the syscall. Classified under [CWE-119] (Improper Restriction of Operations within the Bounds of a Memory Buffer) and [CWE-125] (Out-of-bounds Read), the condition requires local access with the ability to load BPF programs.

Root Cause

The LoongArch BPF JIT does not correctly validate instruction buffer boundaries during multi-pass compilation. When the generated code exceeds expected size thresholds, offset calculations reach beyond the end of the allocated bpf_prog->insnsi region. On 16KB page configurations, this misalignment reliably crosses into unmapped memory, producing the observed BADV: ffff80001b898004 fault.

Attack Vector

Exploitation requires local access and the ability to invoke the bpf() syscall with BPF_PROG_LOAD. On systems where unprivileged BPF is disabled, the attacker needs CAP_SYS_ADMIN or CAP_BPF. By crafting or loading a BPF program large enough to trigger the out-of-bounds access during JIT compilation, a local user causes a kernel oops. The vulnerability manifests only on LoongArch systems; other architectures are unaffected.

See the upstream fix commits for the exact buffer boundary corrections applied to the LoongArch JIT compiler.

Detection Methods for CVE-2024-26588

Indicators of Compromise

  • Kernel log entries containing Unable to handle kernel paging request with era pointing into build_body or bpf_int_jit_compile
  • Oops stack traces referencing bpf_prog_load, bpf_int_jit_compile, and build_body on LoongArch hosts
  • Process entries showing non-root users invoking the bpf() syscall followed by kernel taint flags (Tainted: G D O)

Detection Strategies

  • Monitor /var/log/kern.log and dmesg output for BPF JIT related oops traces on LoongArch systems
  • Audit the bpf() syscall using auditd rules targeting BPF_PROG_LOAD operations and correlate with system instability
  • Inventory LoongArch kernels and compare running versions against the patched stable release commits

Monitoring Recommendations

  • Enable kernel crash collection (kdump) to capture oops traces for forensic review
  • Track invocations of large BPF programs by instruction count where telemetry is available
  • Alert on repeated kernel taint events on hosts that expose unprivileged BPF

How to Mitigate CVE-2024-26588

Immediate Actions Required

  • Update LoongArch Linux systems to a kernel release that includes commits 36a87385, 4631c2dd, 7924ade1, or 9aeb09f4
  • Restrict bpf() syscall access by setting kernel.unprivileged_bpf_disabled=1 to limit attack surface
  • Audit which users and workloads require BPF program loading privileges and remove unneeded capabilities

Patch Information

The Linux kernel maintainers released fixes across stable branches. Reference the upstream commits: Linux Kernel Commit 36a87385, Linux Kernel Commit 4631c2dd, Linux Kernel Commit 7924ade1, and Linux Kernel Commit 9aeb09f4. Apply the fix from your Linux distribution's security update channel.

Workarounds

  • Disable unprivileged BPF via sysctl -w kernel.unprivileged_bpf_disabled=1 and persist the setting in /etc/sysctl.d/
  • Disable the LoongArch BPF JIT by setting net.core.bpf_jit_enable=0 where interpreter fallback is acceptable
  • Limit CAP_BPF and CAP_SYS_ADMIN assignments on affected LoongArch hosts until patches are deployed
bash
# Configuration example
# Disable unprivileged BPF program loading
sysctl -w kernel.unprivileged_bpf_disabled=1

# Disable BPF JIT compilation (fallback to interpreter)
sysctl -w net.core.bpf_jit_enable=0

# Persist settings across reboots
echo 'kernel.unprivileged_bpf_disabled=1' | sudo tee /etc/sysctl.d/90-bpf-hardening.conf
echo 'net.core.bpf_jit_enable=0' | sudo tee -a /etc/sysctl.d/90-bpf-hardening.conf

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.