🇰🇷 한글 설명
Linux 커널의 may_decode_fh() 함수에서 mnt_ns를 읽을 때 잠금(lock)을 사용하지 않아 발생하는 Use-After-Free(UAF) 취약점입니다. 경합 조건(Race Condition)이 발생할 경우 마운트 네임스페이스가 해제된 후 접근을 시도하여 커널 충돌이나 정보 유출을 초래할 수 있습니다.
💡 쉬운 설명
컴퓨터의 핵심 시스템인 리눅스 커널에서 데이터가 삭제되는 도중에 해당 데이터를 읽으려고 시도할 때 발생하는 오류입니다. 이로 인해 시스템이 갑자기 멈추거나 예상치 못한 동작을 할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
fhandle: fix UAF due to unlocked ->mnt_ns read in may_decode_fh()
may_decode_fh() accesses mount::mnt_ns without holding any locks; that
means the mount can concurrently be unmounted, and the mnt_namespace can
concurrently be freed after an RCU grace period.
This race can happens as follows, assuming that the mount point was
created by open_tree(..., OPEN_TREE_CLONE):
thread 1 thread 2 RCU
__do_sys_open_by_handle_at
do_handle_open
handle_to_path
may_decode_fh
is_mounted
[mount::mnt_ns access]
[mount::mnt_ns access]
__do_sys_close
fput_close_sync
__fput
dissolve_on_fput
umount_tree
class_namespace_excl_destructor
namespace_unlock
free_mnt_ns
mnt_ns_tree_remove
call_rcu(mnt_ns_release_rcu)
mnt_ns_release_rcu
mnt_ns_release
kfree
[mnt_namespace::user_ns access] **UAF**
Fix it by taking rcu_read_lock() around the mount::mnt_ns access, like
in __prepend_path().
Additionally, document the semantics of mount::mnt_ns, and use WRITE_ONCE()
for writers that can race with lockless readers.
This bug is unreachable unless one of the following is set:
- CONFIG_PREEMPTION
- CONFIG_RCU_STRICT_GRACE_PERIOD
because it requires an RCU grace period to happen during a syscall without
an explicit preemption.
This doesn't seem to have interesting security impact; worst-case, it could
leak the result of an integer comparison to userspace (from the level
check in cap_capable()), cause an endless loop, or crash the kernel by
dereferencing an invalid address.
📍 영향받는 시스템
CONFIG_PREEMPTION 또는 CONFIG_RCU_STRICT_GRACE_PERIOD가 설정된 Linux Kernel
⚔️ 공격 벡터
특정 시스템 호출(open_by_handle_at 등)을 이용한 정밀한 타이밍의 경합 조건 유도
🛡️ 대응 방법
커널 패치를 적용하여 mnt_ns 접근 시 rcu_read_lock()을 사용하도록 업데이트
🔧 검증 코드
출력된 커널 버전을 확인하여 해당 취약점이 해결된 패치 버전인지 제조사의 보안 공지와 대조하십시오.