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

CVE-2024-50067: Linux Kernel Use-After-Free Vulnerability

CVE-2024-50067 is a use-after-free flaw in Linux kernel uprobe that causes out-of-bounds memory access when fetching arguments. 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-50067 Overview

CVE-2024-50067 is an out-of-bounds memory access vulnerability in the Linux kernel's uprobe (user-space probes) subsystem. The flaw resides in the store_trace_args() function, which fails to validate whether user-space strings or arrays exceed the per-CPU buffer size of a single page. When a uprobe fetches arguments larger than one page, the kernel writes beyond the allocated percpu buffer, triggering a use-after-free condition detectable by KASAN. A local user with the ability to configure uprobes can trigger memory corruption in kernel space. The vulnerability affects the Linux kernel and Debian Linux distributions, with CWE classifications of [CWE-787] (Out-of-Bounds Write) and [CWE-416] (Use After Free).

Critical Impact

Local attackers with uprobe configuration privileges can cause kernel memory corruption, leading to denial of service or potential privilege escalation on affected Linux systems.

Affected Products

  • Linux Kernel versions through 6.12-rc4
  • Debian Linux 11.0
  • Linux kernel release candidates 6.12-rc1, rc2, rc3, and rc4

Discovery Timeline

  • 2024-10-28 - CVE-2024-50067 published to NVD
  • 2026-06-18 - Last updated in NVD database

Technical Details for CVE-2024-50067

Vulnerability Analysis

The vulnerability exists in the Linux kernel's uprobe tracing infrastructure. Uprobes fetch arguments from user space into a per-CPU buffer before copying them to the trace ring buffer. This two-step process avoids non-atomic context issues during probe handling.

The per-CPU buffer is allocated at a fixed page size. However, the store_trace_args() function does not verify that fetched user-space data fits within this buffer. When a uprobe is configured to capture strings or arrays, large payloads cause writes past the buffer boundary.

The strncpy_from_user() call inside process_fetch_insn() writes attacker-controlled data beyond the allocated page. KASAN reports the condition as a use-after-free write of 8 bytes at the overflow address. The resulting kernel memory corruption can crash the system or be shaped into further exploitation.

Root Cause

The root cause is missing bounds checking in store_trace_args() and prepare_uprobe_buffer(). The function fetch_store_strlen() returns zero for strings larger than MAX_STRING_SIZE (4096 bytes), which normally short-circuits the fetch. For strings between the per-CPU buffer size and MAX_STRING_SIZE, no such protection exists. The buffer's maximum length was never clamped against the single-page allocation.

Attack Vector

Exploitation requires local access and privileges sufficient to configure uprobe events through /sys/kernel/debug/tracing/uprobe_events. An attacker writes a uprobe definition referencing a user-space string argument via +0(%di):ustring, enables the event, and runs a target binary that passes a string between 4093 and 4096 bytes to the probed function. The uprobe handler then writes past the per-CPU buffer during argument capture, corrupting adjacent kernel memory. See the Linux Kernel Commit 537ad4a for the complete reproducer and fix.

Detection Methods for CVE-2024-50067

Indicators of Compromise

  • KASAN reports in kernel logs referencing strncpy_from_user+0x1d6/0x1f0 and process_fetch_insn call stacks.
  • Unexpected kernel oops or panic events correlated with uprobe event activity.
  • Modifications to /sys/kernel/debug/tracing/uprobe_events by non-administrative users or unexpected processes.

Detection Strategies

  • Audit kernel version and patch level against the fixed commits in the Linux stable tree.
  • Monitor tracefs and debugfs for write operations to uprobe configuration files.
  • Review eBPF and ftrace program loads that may interact with uprobe infrastructure on production hosts.

Monitoring Recommendations

  • Enable kernel audit rules on /sys/kernel/debug/tracing/uprobe_events and /sys/kernel/tracing/uprobe_events.
  • Collect dmesg output centrally and alert on KASAN or BUG messages involving uprobe or ftrace symbols.
  • Track processes that invoke perf_event_open() with uprobe attachment flags, correlating with user context.

How to Mitigate CVE-2024-50067

Immediate Actions Required

  • Apply the upstream kernel patches referenced in the Linux stable tree commits as soon as distribution packages become available.
  • Restrict access to tracefs and debugfs mount points to privileged users only.
  • Review which accounts hold CAP_SYS_ADMIN or equivalent capabilities needed to configure uprobes.

Patch Information

The upstream fix enforces a maximum buffer length less than a page size, preventing store_trace_args() from writing beyond the per-CPU allocation. The fix is distributed across the following stable tree commits: Linux Kernel Commit 0dc3ad9, Linux Kernel Commit 373b933, Linux Kernel Commit 537ad4a, and Linux Kernel Commit 9e5f937. Debian LTS users should consult the Debian LTS Announcement for package updates.

Workarounds

  • Unmount or restrict debugfs and tracefs to prevent unprivileged uprobe configuration where feasible.
  • Disable uprobe event creation on systems that do not require dynamic tracing by removing write permissions on the uprobe_events file.
  • Remove CAP_SYS_ADMIN and related tracing capabilities from accounts and containers that do not require them.
bash
# Restrict access to uprobe configuration interface
chmod 600 /sys/kernel/debug/tracing/uprobe_events
mount -o remount,mode=700 /sys/kernel/debug

# Verify kernel version includes the fix
uname -r

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.