🇰🇷 한글 설명
Linux 커널의 Ceph 구성 요소에서 check_new_map() 함수 실행 중 세션이 해제될 때 발생하는 Use-After-Free(UAF) 취약점입니다. 특정 경로에서 세션 참조 횟수(reference count)를 적절히 관리하지 않아, 세션이 해제된 후에도 해당 메모리에 접근을 시도하여 시스템 오류나 권한 상승을 유발할 수 있습니다.
💡 쉬운 설명
컴퓨터가 사용 중인 데이터가 갑자기 삭제되었음에도 불구하고, 시스템이 삭제된 데이터를 계속 사용하려고 시도하면서 발생하는 오류입니다. 이 과정에서 시스템이 멈추거나 해커가 시스템 제어권을 뺏을 위험이 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
ceph: fix UAF in check_new_map() on session freed during unlock
check_new_map() iterates mdsc->sessions[] and for each active session
drops mdsc->mutex to perform per-session operations. The forced-close
path (rank removed from map) correctly takes a reference on s via
ceph_get_mds_session() before releasing mdsc->mutex, but three other
paths do not:
Path A (address changed): mutex_unlock → mutex_lock(&s->s_mutex)
Path B (reconnect): mutex_unlock → send_mds_reconnect(mdsc, s)
Path C (active transition): mutex_unlock → mutex_lock(&s->s_mutex)
Without the extra reference, another thread can acquire mdsc->mutex
during the unlock window, call __unregister_session() which drops the
last reference on s, and free it. The original thread then accesses
freed memory via s->s_mutex.
Fix by adding ceph_get_mds_session(s) before each mutex_unlock and
ceph_put_mds_session(s) after the corresponding mutex_lock, matching
the pattern already used in the forced-close path.
Race timeline (Path A):
Thread A (check_new_map) Thread B (another map update
holds mdsc->mutex or session teardown)
-------------------------- --------------------------
s = mdsc->sessions[i]
(refcount == 1, held only by
sessions[] array)
mutex_unlock(&mdsc->mutex)
---> acquires mdsc->mutex
__unregister_session(mdsc, s)
sessions[i] = NULL
ceph_put_mds_session(s)
refcount: 1 -> 0
kfree(s) <--- freed!
mutex_lock(&s->s_mutex)
UAF on freed s->s_mutex
📍 영향받는 시스템
Linux Kernel (Ceph 모듈이 포함된 버전)
⚔️ 공격 벡터
Ceph MDS 맵 업데이트 또는 세션 연결/해제 과정에서의 레이스 컨디션(Race Condition) 유도
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 ceph_get_mds_session() 참조 로직을 적용해야 합니다.
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 패치 버전 이후인지 확인합니다.