🇰🇷 한글 설명
Linux 커널의 ksmbd 모듈에서 발생하는 Use-After-Free 취약점으로, 두 개의 SMB2 지속적 재연결(durable reconnect)이 동시에 발생할 때 경합 조건이 발생합니다. 이로 인해 이미 해제된 메모리 영역인 fp->owner.name을 참조하여 시스템 충돌이나 보안 위협을 초래할 수 있습니다.
💡 쉬운 설명
서버에 동시에 두 번의 연결 요청이 들어올 때, 시스템이 이미 삭제된 정보를 읽으려고 시도하면서 발생하는 오류입니다. 이 과정에서 컴퓨터가 멈추거나 해커가 시스템 권한을 탈취할 위험이 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
ksmbd: fix use-after-free of fp->owner.name in durable handle owner check
Two concurrent SMB2 durable reconnects (DH2C/DHnC) on the same
persistent_id race the fp->owner.name compare-read in
ksmbd_vfs_compare_durable_owner() against the kfree() in
ksmbd_reopen_durable_fd()'s reopen-success path. fp->owner.name is a
standalone kstrdup() buffer whose lifetime is independent of the fp
refcount, and the two sites share no lock: the compare reads the buffer
while the reopen frees it, so the strcmp() can dereference freed memory.
Commit 7ce4fc40018d ("ksmbd: fix durable reconnect double-bind race in
ksmbd_reopen_durable_fd") made the fp->conn claim atomic under
global_ft.lock (closing the owner.name double-free and the ksmbd_file
write-UAF), but the compare-read versus reopen-free pair was left
unserialized.
BUG: KASAN: slab-use-after-free in strcmp+0x2c/0x80
Read of size 1 by task kworker
strcmp
ksmbd_vfs_compare_durable_owner
smb2_check_durable_oplock
smb2_open
Freed by task kworker:
kfree
ksmbd_reopen_durable_fd
smb2_open
Allocated by task kworker:
kstrdup
session_fd_check
smb2_session_logoff
The buggy address belongs to the cache kmalloc-8
Serialize both sides of the race with fp->f_lock. The global durable
file-table lock still protects the durable reconnect claim, but
fp->owner.name is per-open state and does not need to block unrelated
durable table lookups or reconnects. The teardown is left at its
existing location after the reopen-success point so that an __open_id()
rollback still retains owner.name for a later legitimate reconnect to
verify.
📍 영향받는 시스템
Linux kernel (ksmbd module 포함 버전)
⚔️ 공격 벡터
동시에 발생하는 SMB2 지속적 재연결(durable reconnect) 요청을 통한 경합 조건 유도
🛡️ 대응 방법
커널 패치(Commit 7ce4fc40018d 관련 수정사항 포함)를 적용하여 fp->f_lock을 통한 직렬화 수행
🔧 검증 코드
출력된 커널 버전을 확인하여 해당 취약점이 해결된 최신 패치 버전인지 확인합니다.