CVE-2024-53177

Severity CVSS v4.0:
Pending analysis
Type:
CWE-416 Use After Free
Publication date:
27/12/2024
Last modified:
24/03/2025

Description

In the Linux kernel, the following vulnerability has been resolved:<br /> <br /> smb: prevent use-after-free due to open_cached_dir error paths<br /> <br /> If open_cached_dir() encounters an error parsing the lease from the<br /> server, the error handling may race with receiving a lease break,<br /> resulting in open_cached_dir() freeing the cfid while the queued work is<br /> pending.<br /> <br /> Update open_cached_dir() to drop refs rather than directly freeing the<br /> cfid.<br /> <br /> Have cached_dir_lease_break(), cfids_laundromat_worker(), and<br /> invalidate_all_cached_dirs() clear has_lease immediately while still<br /> holding cfids-&gt;cfid_list_lock, and then use this to also simplify the<br /> reference counting in cfids_laundromat_worker() and<br /> invalidate_all_cached_dirs().<br /> <br /> Fixes this KASAN splat (which manually injects an error and lease break<br /> in open_cached_dir()):<br /> <br /> ==================================================================<br /> BUG: KASAN: slab-use-after-free in smb2_cached_lease_break+0x27/0xb0<br /> Read of size 8 at addr ffff88811cc24c10 by task kworker/3:1/65<br /> <br /> CPU: 3 UID: 0 PID: 65 Comm: kworker/3:1 Not tainted 6.12.0-rc6-g255cf264e6e5-dirty #87<br /> Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 11/12/2020<br /> Workqueue: cifsiod smb2_cached_lease_break<br /> Call Trace:<br /> <br /> dump_stack_lvl+0x77/0xb0<br /> print_report+0xce/0x660<br /> kasan_report+0xd3/0x110<br /> smb2_cached_lease_break+0x27/0xb0<br /> process_one_work+0x50a/0xc50<br /> worker_thread+0x2ba/0x530<br /> kthread+0x17c/0x1c0<br /> ret_from_fork+0x34/0x60<br /> ret_from_fork_asm+0x1a/0x30<br /> <br /> <br /> Allocated by task 2464:<br /> kasan_save_stack+0x33/0x60<br /> kasan_save_track+0x14/0x30<br /> __kasan_kmalloc+0xaa/0xb0<br /> open_cached_dir+0xa7d/0x1fb0<br /> smb2_query_path_info+0x43c/0x6e0<br /> cifs_get_fattr+0x346/0xf10<br /> cifs_get_inode_info+0x157/0x210<br /> cifs_revalidate_dentry_attr+0x2d1/0x460<br /> cifs_getattr+0x173/0x470<br /> vfs_statx_path+0x10f/0x160<br /> vfs_statx+0xe9/0x150<br /> vfs_fstatat+0x5e/0xc0<br /> __do_sys_newfstatat+0x91/0xf0<br /> do_syscall_64+0x95/0x1a0<br /> entry_SYSCALL_64_after_hwframe+0x76/0x7e<br /> <br /> Freed by task 2464:<br /> kasan_save_stack+0x33/0x60<br /> kasan_save_track+0x14/0x30<br /> kasan_save_free_info+0x3b/0x60<br /> __kasan_slab_free+0x51/0x70<br /> kfree+0x174/0x520<br /> open_cached_dir+0x97f/0x1fb0<br /> smb2_query_path_info+0x43c/0x6e0<br /> cifs_get_fattr+0x346/0xf10<br /> cifs_get_inode_info+0x157/0x210<br /> cifs_revalidate_dentry_attr+0x2d1/0x460<br /> cifs_getattr+0x173/0x470<br /> vfs_statx_path+0x10f/0x160<br /> vfs_statx+0xe9/0x150<br /> vfs_fstatat+0x5e/0xc0<br /> __do_sys_newfstatat+0x91/0xf0<br /> do_syscall_64+0x95/0x1a0<br /> entry_SYSCALL_64_after_hwframe+0x76/0x7e<br /> <br /> Last potentially related work creation:<br /> kasan_save_stack+0x33/0x60<br /> __kasan_record_aux_stack+0xad/0xc0<br /> insert_work+0x32/0x100<br /> __queue_work+0x5c9/0x870<br /> queue_work_on+0x82/0x90<br /> open_cached_dir+0x1369/0x1fb0<br /> smb2_query_path_info+0x43c/0x6e0<br /> cifs_get_fattr+0x346/0xf10<br /> cifs_get_inode_info+0x157/0x210<br /> cifs_revalidate_dentry_attr+0x2d1/0x460<br /> cifs_getattr+0x173/0x470<br /> vfs_statx_path+0x10f/0x160<br /> vfs_statx+0xe9/0x150<br /> vfs_fstatat+0x5e/0xc0<br /> __do_sys_newfstatat+0x91/0xf0<br /> do_syscall_64+0x95/0x1a0<br /> entry_SYSCALL_64_after_hwframe+0x76/0x7e<br /> <br /> The buggy address belongs to the object at ffff88811cc24c00<br /> which belongs to the cache kmalloc-1k of size 1024<br /> The buggy address is located 16 bytes inside of<br /> freed 1024-byte region [ffff88811cc24c00, ffff88811cc25000)

Vulnerable products and versions

CPE From Up to
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 6.6.64 (excluding)
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 6.7 (including) 6.11.11 (excluding)
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 6.12 (including) 6.12.2 (excluding)