Skip to main content

CVE-2024-56759: Vulnerability in Linux Linux

High
VulnerabilityCVE-2024-56759cvecve-2024-56759
Published: Mon Jan 06 2025 (01/06/2025, 16:20:39 UTC)
Source: CVE
Vendor/Project: Linux
Product: Linux

Description

In the Linux kernel, the following vulnerability has been resolved: btrfs: fix use-after-free when COWing tree bock and tracing is enabled When a COWing a tree block, at btrfs_cow_block(), and we have the tracepoint trace_btrfs_cow_block() enabled and preemption is also enabled (CONFIG_PREEMPT=y), we can trigger a use-after-free in the COWed extent buffer while inside the tracepoint code. This is because in some paths that call btrfs_cow_block(), such as btrfs_search_slot(), we are holding the last reference on the extent buffer @buf so btrfs_force_cow_block() drops the last reference on the @buf extent buffer when it calls free_extent_buffer_stale(buf), which schedules the release of the extent buffer with RCU. This means that if we are on a kernel with preemption, the current task may be preempted before calling trace_btrfs_cow_block() and the extent buffer already released by the time trace_btrfs_cow_block() is called, resulting in a use-after-free. Fix this by moving the trace_btrfs_cow_block() from btrfs_cow_block() to btrfs_force_cow_block() before the COWed extent buffer is freed. This also has a side effect of invoking the tracepoint in the tree defrag code, at defrag.c:btrfs_realloc_node(), since btrfs_force_cow_block() is called there, but this is fine and it was actually missing there.

AI-Powered Analysis

AILast updated: 07/02/2025, 22:25:53 UTC

Technical Analysis

CVE-2024-56759 is a high-severity use-after-free vulnerability in the Linux kernel's Btrfs filesystem implementation. The flaw occurs in the Copy-On-Write (COW) mechanism for tree blocks within Btrfs when kernel tracing is enabled (tracepoint trace_btrfs_cow_block()) and kernel preemption is configured (CONFIG_PREEMPT=y). Specifically, during the execution of btrfs_cow_block(), if the system is preempted after the last reference to an extent buffer is dropped but before the tracepoint is called, the extent buffer may be freed prematurely. This results in a use-after-free condition when the tracepoint code accesses the now-invalid buffer. The root cause is that the tracepoint invocation was placed after the buffer release, allowing a race condition under preemption. The fix involved moving the tracepoint call earlier in the code path, specifically into btrfs_force_cow_block(), ensuring the buffer remains valid during tracing. This change also causes the tracepoint to be invoked in additional code paths (e.g., tree defragmentation), which is considered acceptable. The vulnerability is identified as CWE-416 (Use After Free) and has a CVSS v3.1 score of 7.8, indicating high severity. Exploitation requires local privileges with low complexity and no user interaction, but it can lead to full confidentiality, integrity, and availability compromise of affected systems. No known exploits are reported in the wild yet. The affected versions correspond to specific Linux kernel commits prior to the patch. This vulnerability is critical for systems using Btrfs with tracing and preemption enabled, which are common in many Linux distributions, especially in server and enterprise environments.

Potential Impact

For European organizations, this vulnerability poses a significant risk, particularly for those relying on Linux servers with Btrfs filesystems. The use-after-free can be exploited by a local attacker with limited privileges to execute arbitrary code in kernel context, potentially leading to privilege escalation, data corruption, or denial of service. This undermines system confidentiality, integrity, and availability. Organizations in sectors such as finance, healthcare, government, and critical infrastructure, which often use Linux-based systems for their robustness and scalability, could face operational disruptions or data breaches if exploited. Additionally, the vulnerability could be leveraged to bypass security controls or maintain persistence within compromised environments. Given the widespread adoption of Linux in European data centers and cloud infrastructures, the impact could be broad, affecting both on-premises and cloud-hosted services. The absence of known exploits currently provides a window for proactive patching to prevent compromise.

Mitigation Recommendations

European organizations should prioritize applying the official Linux kernel patches that address CVE-2024-56759 as soon as they become available. Since the vulnerability requires local access and specific kernel configurations (Btrfs with tracing and preemption enabled), organizations should audit their systems to identify affected hosts. If immediate patching is not feasible, consider temporarily disabling kernel tracing related to Btrfs or disabling preemption where possible, though these may impact system performance or functionality. Implement strict access controls to limit local user privileges and monitor for unusual kernel tracepoint activity or system crashes that could indicate exploitation attempts. Employ kernel integrity monitoring and leverage security modules like SELinux or AppArmor to restrict unauthorized kernel interactions. Regularly update and test incident response plans to handle potential exploitation scenarios. For cloud environments, coordinate with providers to ensure underlying infrastructure is patched and secure. Finally, maintain comprehensive backups and verify their integrity to recover from potential data corruption or ransomware attacks stemming from exploitation.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
Linux
Date Reserved
2024-12-29T11:26:39.761Z
Cisa Enriched
true
Cvss Version
3.1
State
PUBLISHED

Threat ID: 682d9822c4522896dcbde758

Added to database: 5/21/2025, 9:08:50 AM

Last enriched: 7/2/2025, 10:25:53 PM

Last updated: 8/13/2025, 4:59:51 PM

Views: 11

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats