🇰🇷 한글 설명
Linux 커널 ntfs3 파일시스템에서 'nocase' 마운트 옵션 사용 시, RCU 경로 탐색 중 superblock 전용 정보(sbi)가 유예 기간 없이 해제되어 use-after-free(UAF)가 발생할 수 있습니다. 이 문제는 sbi를 RCU 유예 기간 이후에 해제하도록 수정되었으며, s_shared_lock을 spin_lock_bh()로 변경하여 교착 상태를 방지합니다.
💡 쉬운 설명
NTFS 파일시스템을 대소문자 무시 옵션으로 마운트한 상태에서 파일 경로를 찾는 도중, 이미 메모리에서 지워진 데이터를 읽으려 하면서 시스템이 불안정해질 수 있습니다. 이 문제는 데이터를 안전한 시점에 지우도록 커널이 수정되어 해결되었습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
ntfs3: free the sbi after a grace period
If the "nocase" mount option ntfs3 uses custom hash and dentry compare
functions. Both access ntfs3 superblock private information in rcu
pathwalk. ntfs_put_super() and ntfs3_kill_sb() drop the info without any
rcu delay. A lookup that's still inside the filesystem when the last
reference to the mount is dropped causes a UAF. With a pathwalk held up
in ntfs_d_hash() while the last reference to the mount goes away:
BUG: KASAN: slab-use-after-free in ntfs_nls_to_utf16+0x752/0x940
Read of size 8 at addr ff1100010453c850 by task walker/99
Call Trace:
<TASK>
ntfs_nls_to_utf16+0x752/0x940
ntfs_d_hash+0x22b/0x500
link_path_walk+0x11ad/0x1d30
path_lookupat+0x63/0xb00
filename_lookup+0x1f1/0x5b0
vfs_statx+0xd7/0x3b0
[...]
Allocated by task 95:
__kmalloc_cache_noprof+0x249/0x560
ntfs_init_fs_context+0x2db/0x5a0
alloc_fs_context+0x52e/0xc70
[...]
Freed by task 98:
kfree+0x1db/0x5b0
deactivate_locked_super+0x9c/0xf0
cleanup_mnt+0x9f/0x130
task_work_run+0x131/0x250
The bug is currently masked by the grace period in namespace_unlock()
for umount(2). Keep the necessary information until the filesystem
private info is freed and free it with an rcu delay.
ntfs3_free_sbi() now runs from an rcu callback and drops the upcase
table via ntfs_put_shared(). So switch s_shared_lock over to
spin_lock_bh(). Otherwise the callback can deadlock against a task
holding the lock on the same cpu.
📍 영향받는 시스템
수정 이전의 Linux 커널 (ntfs3 파일시스템 드라이버 포함 버전, 정확한 영향 버전은 커널 패치 이력 확인 필요)
⚔️ 공격 벡터
로컬 사용자가 nocase 옵션의 ntfs3 마운트를 대상으로 경로 탐색과 마운트 해제를 경합시켜 커널 메모리 손상 또는 정보 노출을 유도할 수 있음
🛡️ 대응 방법
배포판의 최신 커널 업데이트를 적용하고 재부팅하거나, 불필요한 경우 ntfs3 모듈 로드를 제한
🔧 검증 코드
출력된 커널 버전을 배포판의 보안 권고에서 패치된 버전과 비교하고, ntfs3 항목이 없으면 드라이버가 로드되지 않아 영향이 제한적임을 의미합니다.
uname -r && (grep -E 'ntfs3' /proc/filesystems 2>/dev/null || echo 'ntfs3 not loaded')