🇰🇷 한글 설명
Linux 커널의 nfsd에서 세션 슬롯을 해제할 때 현재 사용 중인 슬롯을 확인하지 않아 발생하는 취약점입니다. 공격자가 특정 조건을 충족하는 슬롯을 사용하면 메모리 해제 후 해당 영역에 데이터를 쓰는 Use-After-Free 및 메모리 오염이 발생할 수 있습니다.
💡 쉬운 설명
컴퓨터가 사용 중인 메모리 공간을 실수로 지워버린 뒤, 그 자리에 다른 데이터를 덮어씌워 시스템을 망가뜨릴 수 있는 문제입니다. 이를 통해 해커가 시스템의 제어권을 뺏거나 오류를 일으킬 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
nfsd: don't free session slots that are still in use
nfsd4_sequence() can free the very slot it is currently processing.
When the session shrinker has reduced se_target_maxslots below
se_fchannel.maxreqs, the shrink path checks three conditions before
calling free_session_slots():
1. se_target_maxslots < maxreqs (shrink was advertised)
2. slot->sl_generation == se_slot_gen (slot is up-to-date)
3. seq->maxslots <= se_target_maxslots (client acknowledges)
However, seq->slotid is never checked against se_target_maxslots.
A client using a slot in the range [se_target_maxslots, maxreqs) can
satisfy all three conditions: its slot has the current generation
(set by a prior SEQUENCE), and it sends sa_highest_slotid <=
se_target_maxslots to acknowledge the reduction.
free_session_slots() then kfrees every slot at index >=
se_target_maxslots, including the caller's own slot. The function
continues to write sl_seqid, sl_flags, sl_generation, and stores the
dangling pointer in cstate->slot. Later, nfsd4_store_cache_entry()
copies up to maxresp_cached bytes of the compound reply into the freed
sl_data[] array, corrupting whatever slab object now occupies that
address.
Additionally, a concurrent thread processing SEQUENCE on a different
high-numbered slot can have its slot freed out from under it.
NFSD4_SLOT_INUSE is set under nn->client_lock before the lock is
released, so any concurrent thread past SEQUENCE will have its slot
marked. However, free_session_slots() does not check NFSD4_SLOT_INUSE
before freeing.
Fix both problems by:
1. Checking that the current request's slotid is below the shrink
boundary.
2. Scanning slots in the to-be-freed range for NFSD4_SLOT_INUSE and
deferring the shrink if any are active.
📍 영향받는 시스템
Linux kernel (nfsd 구성 요소 포함 버전)
⚔️ 공격 벡터
조작된 NFSv4 SEQUENCE 요청을 통해 세션 슬롯 해제 로직을 트리거하여 메모리 오염 유도
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 패치 버전 이후인지 확인