🇰🇷 한글 설명
Linux 커널의 ksmbd 모듈에서 RPC 핸들 리스트를 관리하는 XArray 접근 시 레이스 컨디션(경쟁 상태) 취약점이 발견되었습니다. ksmbd_session_rpc_open 함수에서 쓰기 잠금 대신 읽기 잠금을 사용하여 데이터 손상이 발생할 수 있으며, ksmbd_session_rpc_method 함수는 잠금 없이 리스트에 접근하여 Use-After-Free 취약점을 유발할 수 있습니다.
💡 쉬운 설명
여러 작업이 동시에 같은 데이터를 수정하려고 할 때 발생하는 충돌 문제입니다. 이로 인해 시스템 데이터가 깨지거나, 해커가 시스템 권한을 탈취할 수 있는 보안 허점이 생길 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
ksmbd: Fix race condition in RPC handle list access
The 'sess->rpc_handle_list' XArray manages RPC handles within a ksmbd
session. Access to this list is intended to be protected by
'sess->rpc_lock' (an rw_semaphore). However, the locking implementation was
flawed, leading to potential race conditions.
In ksmbd_session_rpc_open(), the code incorrectly acquired only a read lock
before calling xa_store() and xa_erase(). Since these operations modify
the XArray structure, a write lock is required to ensure exclusive access
and prevent data corruption from concurrent modifications.
Furthermore, ksmbd_session_rpc_method() accessed the list using xa_load()
without holding any lock at all. This could lead to reading inconsistent
data or a potential use-after-free if an entry is concurrently removed and
the pointer is dereferenced.
Fix these issues by:
1. Using down_write() and up_write() in ksmbd_session_rpc_open()
to ensure exclusive access during XArray modification, and ensuring
the lock is correctly released on error paths.
2. Adding down_read() and up_read() in ksmbd_session_rpc_method()
to safely protect the lookup.
📍 영향받는 시스템
ksmbd 모듈을 사용하는 Linux 커널 버전
⚔️ 공격 벡터
동시에 다수의 RPC 요청을 보내 XArray 구조를 조작하여 메모리 오류 유도
🛡️ 대응 방법
ksmbd 관련 커널 패치 적용 및 최신 커널로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 최신 패치 버전인지 확인