🇰🇷 한글 설명
Linux kernel ksmbd의 durable file handle 처리에서 발생하는 use-after-free 취약점. 세션 연결이 끊긴 후 fp->conn이 NULL로 설정되지만 byte-range locks 목록이 정리되지 않아, durable scavenger가 해제된 메모리의 잠금 목록에 접근하려 할 때 crash 또는 권한 상승이 발생.
💡 쉬운 설명
SMB 파일 서버가 클라이언트 연결 후 파일 잠금 정보를 제대로 정리하지 않음. 나중에 이 파일에 접근할 때 이미 해제된 메모리에 접근해서 시스템이 강제 종료될 수 있음.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
ksmbd: fix use-after-free in __ksmbd_close_fd() via durable scavenger
When a durable file handle survives session disconnect (TCP close without
SMB2_LOGOFF), session_fd_check() sets fp->conn = NULL to preserve the
handle for later reconnection. However, it did not clean up the byte-range
locks on fp->lock_list.
Later, when the durable scavenger thread times out and calls
__ksmbd_close_fd(NULL, fp), the lock cleanup loop did:
spin_lock(&fp->conn->llist_lock);
This caused a slab use-after-free because fp->conn was NULL and the
original connection object had already been freed by
ksmbd_tcp_disconnect().
The root cause is asymmetric cleanup: lock entries (smb_lock->clist) were
left dangling on the freed conn->lock_list while fp->conn was nulled out.
To fix this issue properly, we need to handle the lifetime of
smb_lock->clist across three paths:
- Safely skip clist deletion when list is empty and fp->conn is NULL.
- Remove the lock from the old connection's lock_list in
session_fd_check()
- Re-add the lock to the new connection's lock_list in
ksmbd_reopen_durable_fd().
📍 영향받는 시스템
Linux kernel ksmbd (SMB 서버), 최근 버전들 (정확한 버전은 배포판별 패치 시점에 따라 다름)
⚔️ 공격 벡터
로컬 SMB 클라이언트가 durable file handle을 생성한 후 TCP 연결을 끊고 재연결 시도 시 발생
🛡️ 대응 방법
Linux kernel을 CVE-2026-31718 패치가 포함된 최신 버전으로 업데이트
🔧 검증 코드
커널 버전이 표시되고 ksmbd가 /proc/modules에 나타나면 취약한 환경. 배포판의 보안 공지에서 해당 커널 버전에 대한 패치 여부 확인 필요.
uname -r && grep -i ksmbd /proc/modules 2>/dev/null || echo 'ksmbd not loaded'