Skip to main content

CVE-2024-53218: Vulnerability in Linux Linux

High
VulnerabilityCVE-2024-53218cvecve-2024-53218
Published: Fri Dec 27 2024 (12/27/2024, 13:50:03 UTC)
Source: CVE
Vendor/Project: Linux
Product: Linux

Description

In the Linux kernel, the following vulnerability has been resolved: f2fs: fix race in concurrent f2fs_stop_gc_thread In my test case, concurrent calls to f2fs shutdown report the following stack trace: Oops: general protection fault, probably for non-canonical address 0xc6cfff63bb5513fc: 0000 [#1] PREEMPT SMP PTI CPU: 0 UID: 0 PID: 678 Comm: f2fs_rep_shutdo Not tainted 6.12.0-rc5-next-20241029-g6fb2fa9805c5-dirty #85 Call Trace: <TASK> ? show_regs+0x8b/0xa0 ? __die_body+0x26/0xa0 ? die_addr+0x54/0x90 ? exc_general_protection+0x24b/0x5c0 ? asm_exc_general_protection+0x26/0x30 ? kthread_stop+0x46/0x390 f2fs_stop_gc_thread+0x6c/0x110 f2fs_do_shutdown+0x309/0x3a0 f2fs_ioc_shutdown+0x150/0x1c0 __f2fs_ioctl+0xffd/0x2ac0 f2fs_ioctl+0x76/0xe0 vfs_ioctl+0x23/0x60 __x64_sys_ioctl+0xce/0xf0 x64_sys_call+0x2b1b/0x4540 do_syscall_64+0xa7/0x240 entry_SYSCALL_64_after_hwframe+0x76/0x7e The root cause is a race condition in f2fs_stop_gc_thread() called from different f2fs shutdown paths: [CPU0] [CPU1] ---------------------- ----------------------- f2fs_stop_gc_thread f2fs_stop_gc_thread gc_th = sbi->gc_thread gc_th = sbi->gc_thread kfree(gc_th) sbi->gc_thread = NULL < gc_th != NULL > kthread_stop(gc_th->f2fs_gc_task) //UAF The commit c7f114d864ac ("f2fs: fix to avoid use-after-free in f2fs_stop_gc_thread()") attempted to fix this issue by using a read semaphore to prevent races between shutdown and remount threads, but it fails to prevent all race conditions. Fix it by converting to write lock of s_umount in f2fs_do_shutdown().

AI-Powered Analysis

AILast updated: 07/02/2025, 23:10:00 UTC

Technical Analysis

CVE-2024-53218 is a high-severity vulnerability in the Linux kernel's F2FS (Flash-Friendly File System) implementation, specifically involving a race condition in the f2fs_stop_gc_thread() function. The flaw arises during concurrent shutdown operations of the F2FS garbage collection (GC) thread. The vulnerability manifests as a use-after-free (UAF) condition due to improper synchronization when stopping the GC thread. The root cause is that multiple CPUs can concurrently invoke f2fs_stop_gc_thread(), leading to a scenario where one CPU frees the GC thread structure and sets the pointer to NULL, while another CPU still accesses the freed memory, causing a general protection fault and potential kernel crash. Previous attempts to fix this issue by using a read semaphore to prevent races between shutdown and remount threads were insufficient. The final fix involves converting to a write lock on the s_umount semaphore in f2fs_do_shutdown(), ensuring exclusive access during shutdown and preventing concurrent thread stops. 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 (low attack vector), low complexity, and no user interaction, but partial privileges (PR:L) are needed. The impact includes full compromise of confidentiality, integrity, and availability of affected systems due to kernel memory corruption and potential system crashes. No known exploits are currently reported in the wild. The vulnerability affects Linux kernel versions including the 6.12.0-rc5-next-20241029-g6fb2fa9805c5-dirty build and likely other versions using the vulnerable F2FS implementation prior to the patch.

Potential Impact

For European organizations, this vulnerability poses a significant risk, especially for those relying on Linux servers and systems using the F2FS filesystem, which is optimized for flash storage devices. The vulnerability can lead to kernel panics, system crashes, and potential privilege escalation or denial of service, impacting critical infrastructure, cloud services, and enterprise environments. Organizations running containerized workloads, embedded systems, or IoT devices with Linux kernels using F2FS are also at risk. The compromise of confidentiality and integrity could lead to unauthorized data access or manipulation, while availability impacts could disrupt business operations. Given the local privilege requirement, attackers would need some level of access, but insider threats or compromised accounts could exploit this flaw to escalate privileges or cause system outages. The absence of known exploits in the wild suggests a window for proactive patching before widespread exploitation occurs.

Mitigation Recommendations

European organizations should prioritize applying the official Linux kernel patches that address CVE-2024-53218, specifically those that implement the write lock on s_umount in f2fs_do_shutdown(). System administrators should audit their environments to identify systems running vulnerable Linux kernel versions with F2FS enabled. For systems where immediate patching is not feasible, consider disabling F2FS or restricting access to systems and users with local privileges to minimize exploitation risk. Employ kernel hardening techniques such as Kernel Address Space Layout Randomization (KASLR) and enable security modules like SELinux or AppArmor to limit damage from potential exploits. Regularly monitor system logs for kernel oops or general protection faults indicative of exploitation attempts. Additionally, implement strict access controls and multi-factor authentication to reduce the likelihood of unauthorized local access. Coordinate with hardware vendors and Linux distribution maintainers to ensure timely updates and backports for enterprise Linux distributions.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
Linux
Date Reserved
2024-11-19T17:17:25.024Z
Cisa Enriched
true
Cvss Version
3.1
State
PUBLISHED

Threat ID: 682d9823c4522896dcbdef89

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

Last enriched: 7/2/2025, 11:10:00 PM

Last updated: 8/4/2025, 7:00:28 AM

Views: 15

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