🇰🇷 한글 설명
리눅스 커널의 blk-mq 블록 계층에서 I/O 완료 보고 전 암호화 키 슬롯을 해제하지 않아 발생하는 레이스 컨디션 취약점입니다. 이로 인해 키 제거 과정에서 slot_refs가 0이 아닌 상태로 인식되어, 결과적으로 blk_crypto_reprogram_all_keys() 함수에서 Use-After-Free(UAF) 오류가 발생할 수 있습니다.
💡 쉬운 설명
데이터를 읽고 쓰는 작업이 끝났다고 시스템에 알리기 전에 암호화 키를 정리하지 않아 발생하는 문제입니다. 이 과정에서 타이밍 오류가 생기면 이미 사용 중이지 않은 메모리에 접근하게 되어 시스템 오류나 보안 문제가 생길 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
blk-mq: release crypto keyslot before reporting I/O complete
Once all I/O using a blk_crypto_key has completed, filesystems can call
blk_crypto_evict_key(). However, the block layer currently doesn't call
blk_crypto_put_keyslot() until the request is being freed, which happens
after upper layers have been told (via bio_endio()) the I/O has
completed. This causes a race condition where blk_crypto_evict_key()
can see 'slot_refs != 0' without there being an actual bug.
This makes __blk_crypto_evict_key() hit the
'WARN_ON_ONCE(atomic_read(&slot->slot_refs) != 0)' and return without
doing anything, eventually causing a use-after-free in
blk_crypto_reprogram_all_keys(). (This is a very rare bug and has only
been seen when per-file keys are being used with fscrypt.)
There are two options to fix this: either release the keyslot before
bio_endio() is called on the request's last bio, or make
__blk_crypto_evict_key() ignore slot_refs. Let's go with the first
solution, since it preserves the ability to report bugs (via
WARN_ON_ONCE) where a key is evicted while still in-use.
📍 영향받는 시스템
fscrypt와 per-file keys를 사용하는 리눅스 커널 (blk-mq 구성)
⚔️ 공격 벡터
특정 조건(fscrypt 사용 시)에서 I/O 완료와 키 제거가 동시에 일어나는 레이스 컨디션을 유도하여 메모리 오류 유발
🛡️ 대응 방법
리눅스 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 I/O 완료 보고 전 키 슬롯이 해제되도록 수정
🔧 검증 코드
현재 실행 중인 커널 버전을 확인하여 해당 취약점이 해결된 패치 버전인지 확인