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

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

CVE-2024-57951 is a use-after-free vulnerability in Linux Kernel hrtimers during CPU hotplug operations that can cause dangling pointers and system instability. This article covers technical details, impact analysis, and mitigation strategies.

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-57951 Overview

CVE-2024-57951 is a Linux kernel vulnerability in the high-resolution timer (hrtimers) subsystem. The flaw affects how the kernel handles per-CPU state during CPU hotplug transitions. When a CPU moves from CPUHP_ONLINE partway through hotunplug down to CPUHP_HRTIMERS_PREPARE and then returns to CPUHP_ONLINE, the hrtimers_prepare_cpu() routine does not run again. This leaves stale cpu_base state, including an unset online flag and dangling pointers. The condition is classified as a use-after-free weakness [CWE-416]. The vulnerability affects multiple Linux kernel versions including 6.13 release candidates. Exploitation requires local access with low privileges.

Critical Impact

Local attackers with low privileges can trigger kernel memory corruption through CPU hotplug operations, leading to denial of service or potential privilege escalation.

Affected Products

  • Linux Kernel (multiple stable branches)
  • Linux Kernel 6.13 release candidates (rc1 through rc7)
  • Debian Linux (addressed via Debian LTS advisories, March 2025)

Discovery Timeline

  • 2025-02-12 - CVE-2024-57951 published to NVD
  • 2025-03 - Debian LTS advisories released addressing the vulnerability
  • 2026-10-15 - Last updated in NVD database

Technical Details for CVE-2024-57951

Vulnerability Analysis

The vulnerability resides in the Linux kernel's hrtimers subsystem during CPU hotplug state transitions. When a CPU descends from CPUHP_ONLINE through hotunplug states and reverses direction before reaching CPUHP_HRTIMERS_PREPARE, the hrtimers_prepare_cpu() callback never executes. As a result, cpu_base.hres_active remains set to 1 even though the tick and clockevents were shut down at CPUHP_AP_TICK_DYING.

On return to the online state, the Completely Fair Scheduler (CFS) assumes the hrtick is already active. The clockevent device also loses its chance to transition to oneshot mode. Additionally, cpu_base.online is not reset to 1, triggering a WARN_ON_ONCE in enqueue_hrtimer(). The bulk of per-CPU state remains unreset, leaving dangling pointers that can be dereferenced.

Root Cause

The root cause is incomplete state reset logic in the CPU hotplug callback chain. The hrtimers_prepare_cpu() function was responsible for initializing per-CPU hrtimer state, but it only runs when a CPU descends through CPUHP_HRTIMERS_PREPARE. Partial hotunplug transitions bypass this reinitialization, leaving stale pointers and inconsistent flags [CWE-416].

Attack Vector

An attacker with local access and low privileges can trigger CPU hotplug operations through standard sysfs interfaces such as /sys/devices/system/cpu/cpuN/online. By orchestrating partial hotunplug sequences, an attacker causes the kernel to re-enter the online state with inconsistent hrtimer state. This can produce kernel warnings, timer subsystem malfunctions, or memory corruption through dangling pointer dereferences in enqueue_hrtimer() and related paths.

The vulnerability manifests entirely within kernel timer management code. See the upstream patches linked in Vendor Advisories for technical details on the state transitions involved.

Detection Methods for CVE-2024-57951

Indicators of Compromise

  • Kernel warnings matching WARN_ON_ONCE in enqueue_hrtimer() appearing in dmesg or /var/log/kern.log
  • Unexpected scheduler behavior or timer-related soft lockups following CPU hotplug operations
  • Repeated writes to /sys/devices/system/cpu/cpuN/online from unprivileged processes

Detection Strategies

  • Monitor kernel ring buffer messages for hrtimer-related warnings and stack traces referencing enqueue_hrtimer or hrtimers_prepare_cpu
  • Audit process activity invoking CPU hotplug sysfs paths through Linux Audit (auditd) rules on /sys/devices/system/cpu/
  • Correlate kernel version metadata against the fixed commits published on git.kernel.org stable branches

Monitoring Recommendations

  • Enable kernel log forwarding to centralized logging infrastructure for inspection of WARN_ON_ONCE events
  • Track unexpected CPU state transitions using tracepoints such as cpuhp_enter and cpuhp_exit via perf or ftrace
  • Alert on anomalous local processes manipulating CPU online status outside of maintenance windows

How to Mitigate CVE-2024-57951

Immediate Actions Required

Patch Information

The fix adds a dedicated startup() callback to the hrtimers CPU hotplug state machine. This callback resets stale per-CPU state and sets the online flag unconditionally. Refer to the upstream commit 14984139f1f and the backports to stable branches for exact kernel versions containing the fix.

Workarounds

  • Disable runtime CPU hotplug operations on affected systems where feasible by removing write permissions on /sys/devices/system/cpu/cpuN/online
  • Restrict local user access on multi-tenant systems to reduce the pool of principals who can trigger hotplug transitions
  • Monitor kernel logs continuously and reboot systems exhibiting repeated hrtimer warnings until patches are deployed
bash
# Configuration example: restrict CPU hotplug sysfs access to root only
find /sys/devices/system/cpu/cpu[0-9]*/online -exec chmod 600 {} \;

# Verify installed kernel version against patched stable releases
uname -r
apt list --installed 2>/dev/null | grep linux-image

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.