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

CVE-2024-41049: Linux Kernel use-after-free Vulnerability

CVE-2024-41049 is a use-after-free vulnerability in the Linux Kernel filelock mechanism affecting posix_lock_inode. This race condition allows freed memory access during tracing operations. This article covers technical details, affected versions, impact assessment, 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-41049 Overview

CVE-2024-41049 is a use-after-free vulnerability in the Linux kernel's file locking subsystem, specifically in the posix_lock_inode() function within the filelock code. The flaw was reported by Light Hsieh after a Kernel Address Sanitizer (KASAN) warning fired inside trace_posix_lock_inode(). The request pointer referenced a lock entry already added to the inode's list, but a concurrent task could free that lock before the tracepoint executed. The upstream fix moves the tracepoint inside the spinlock to prevent the race. This weakness is tracked as [CWE-416] Use After Free.

Critical Impact

A local, authenticated attacker able to trigger concurrent POSIX file lock operations can corrupt kernel memory, leading to privilege escalation, information disclosure, or denial of service.

Affected Products

  • Linux kernel stable branches prior to the fix commits listed in kernel.org
  • Debian LTS distributions updated via the January 2025 advisory
  • Downstream Linux distributions shipping affected stable kernels

Discovery Timeline

  • 2024-07-29 - CVE-2024-41049 published to the National Vulnerability Database
  • 2025-01 - Debian LTS advisory issued for affected kernel packages
  • 2026-08-04 - Last updated in the NVD database

Technical Details for CVE-2024-41049

Vulnerability Analysis

The vulnerability lives in the POSIX advisory file locking path, specifically posix_lock_inode() in fs/locks.c. During lock insertion, the function updates the request pointer to reference a file_lock entry that was just linked into the inode's lock list. The tracepoint trace_posix_lock_inode() is invoked after the spinlock protecting that list is released. In the time window between unlocking and tracing, another thread performing an unlock or merge operation can remove and free the referenced file_lock. The tracepoint then dereferences freed memory, producing the use-after-free condition detected by KASAN.

Exploitation requires an attacker to run arbitrary code locally and win a tight timing race between concurrent lock operations on the same inode. Successful exploitation of a kernel use-after-free can be leveraged for arbitrary kernel memory corruption, which can escalate to full root privileges on affected systems.

Root Cause

The root cause is a scope mismatch between the lifetime of the file_lock object and the tracing instrumentation that reads it. The spinlock protecting the inode's lock list was dropped before the tracepoint accessed the lock entry, breaking the invariant that references to list entries remain valid only while the lock is held.

Attack Vector

An attacker with local, unprivileged shell access can trigger the race by issuing concurrent fcntl() POSIX lock and unlock requests from multiple threads against the same file descriptor. One thread races to free a lock entry while another is still being traced, triggering the dangling-pointer dereference inside kernel context.

No code example is provided because no public proof-of-concept exploit was identified in the enriched data. Refer to the kernel.org commit 7d4c14f for the authoritative patch and reproduction context.

Detection Methods for CVE-2024-41049

Indicators of Compromise

  • KASAN splats in dmesg or kernel logs referencing posix_lock_inode or trace_posix_lock_inode
  • Unexpected kernel oops, panics, or general protection fault entries tied to fs/locks.c
  • Processes repeatedly invoking fcntl(F_SETLK) and fcntl(F_SETLKW) from multiple threads against shared inodes

Detection Strategies

  • Enable KASAN on test and staging kernels to surface use-after-free conditions during QA
  • Monitor kernel ring buffer output for file-locking subsystem warnings and forward them to a central log store
  • Baseline fcntl() syscall patterns per workload and alert on anomalous bursts of concurrent lock requests from a single user

Monitoring Recommendations

  • Collect /var/log/kern.log and journalctl -k output centrally and parse for BUG: KASAN, use-after-free, and locks.c strings
  • Track installed kernel package versions across the fleet and flag hosts running kernels older than the fixed stable releases
  • Audit setuid binaries and container escape pathways on multi-tenant Linux hosts where local users could trigger the race

How to Mitigate CVE-2024-41049

Immediate Actions Required

  • Update affected Linux kernels to a stable release that includes the fix from the kernel.org commits listed below, then reboot
  • Apply the Debian LTS kernel update referenced in the Debian LTS Announcement January 2025 on Debian systems
  • Restrict untrusted local shell access on multi-user and shared hosting systems until patched kernels are deployed

Patch Information

The upstream fix moves trace_posix_lock_inode() inside the spinlock protecting the inode's lock list, ensuring the file_lock entry cannot be freed during tracing. Backports are available across multiple stable branches in the following commits: 02a8964, 116599f, 1b3ec4f, 1cbbb3d, 432b06b, 5cb36e3, and 7d4c14f.

Workarounds

  • Disable the filelock:posix_lock_inode tracepoint if it is enabled in production tracing configurations, reducing exposure of the racy code path
  • Limit local, unprivileged account access on affected hosts and enforce least privilege on containers and shared systems
  • Prioritize kernel upgrades on multi-tenant, shared-hosting, and container host systems where local attackers are most likely
bash
# Verify running kernel version and confirm fix is applied
uname -r

# Debian/Ubuntu: apply the latest kernel update and reboot
sudo apt update && sudo apt upgrade linux-image-$(uname -r | sed 's/.*-//')
sudo reboot

# Confirm the filelock tracepoint state (optional hardening)
cat /sys/kernel/debug/tracing/events/filelock/posix_lock_inode/enable

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.