CVE-2024-56759·Kernel vulnerability
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.
- Severity
- high
- Software
- Kernel
- Fixed in
- 6.12.8
- Published
- 2025-01-06
Affected versions
Until: 6.12.8
Fixed in: 6.12.8
How to fix this CVE
Update your Linux kernel to version 6.12.8 or later to resolve a use-after-free vulnerability in the btrfs filesystem that can be triggered when copy-on-write operations occur with kernel tracing enabled. This issue affects systems with CONFIG_PREEMPT enabled and can lead to memory corruption and system instability. Reboot your system after applying the kernel update to ensure the fix takes effect.
sudo dnf update kernel kernel-develDefensia detects this vulnerability
How to check if you are affected
- Step 1: Check current kernel version with: uname -r
- Step 2: Verify btrfs is in use on your system: mount | grep btrfs
- Step 3: Check if preemption is enabled: grep CONFIG_PREEMPT /boot/config-$(uname -r) | grep -v CONFIG_PREEMPT_NONE
- Step 4: Review kernel logs for memory corruption or null pointer dereference errors: dmesg | grep -iE '(use-after-free|UAF|memory corruption|general protection fault)' | tail -20
- Step 5: After patching, verify the new kernel version: uname -r and confirm it is 6.12.8 or later
FAQ
What is CVE-2024-56759?
CVE-2024-56759 is a use-after-free vulnerability in the Linux kernel's btrfs filesystem that occurs during copy-on-write tree block operations when kernel tracing is active. The vulnerability allows memory to be accessed after it has been freed, potentially causing system crashes or data corruption.
Is CVE-2024-56759 being actively exploited?
No, CVE-2024-56759 is not listed on the CISA Known Exploited Vulnerabilities (KEV) catalog and there are no public exploits available. However, the vulnerability should still be patched promptly due to its high severity rating.
What versions of Kernel are affected by CVE-2024-56759?
Kernel versions prior to 6.12.8 are affected by this vulnerability. The fix is available in kernel version 6.12.8 and later stable releases.
How do I check if my server is vulnerable to CVE-2024-56759?
Run: uname -r to check your kernel version. If the version is lower than 6.12.8 and your system uses btrfs with CONFIG_PREEMPT enabled (check: grep CONFIG_PREEMPT /boot/config-$(uname -r)), your system is vulnerable.
Does Defensia detect CVE-2024-56759?
Yes — Defensia's CVE advisory scanner compares installed package versions against the NVD database. If the Linux kernel is installed on a monitored server, CVE-2024-56759 will appear in your dashboard with remediation steps.
Related Kernel CVEs
References
- https://git.kernel.org/stable/c/44f52bbe96dfdbe4aca3818a2534520082a07040
- https://git.kernel.org/stable/c/526ff5b27f090fb15040471f892cd2c9899ce314
- https://git.kernel.org/stable/c/66376f1a73cba57fd0af2631d7888605b738e499
- https://git.kernel.org/stable/c/9a466b8693b9add05de99af00c7bdff8259ecf19
- https://git.kernel.org/stable/c/ba5120a2fb5f23b4d39d302e181aa5d4e28a90d1
Track CVEs across your fleet automatically
Defensia scans your Linux servers and tells you exactly which ones are running vulnerable versions — including CVE-2024-56759. Free for 1 server.
Get started free