🇰🇷 한글 설명
Linux 커널의 F2FS 파일 시스템에서 압축 해제 작업 중 Use-After-Free(UAF) 취약점이 발견되었습니다. 파일 읽기 직후 삭제가 발생할 경우, 비동기적으로 처리되는 I/O 완료 작업이 이미 해제된 inode 메모리에 접근하여 시스템 불안정성을 초래할 수 있습니다.
💡 쉬운 설명
파일을 읽자마자 바로 삭제할 때, 컴퓨터가 아직 읽기 작업을 마무리하지 못한 상태에서 메모리 정보를 지워버려 발생하는 오류입니다. 이로 인해 시스템이 멈추거나 보안 문제가 생길 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
f2fs: compress: fix UAF of f2fs_inode_info in f2fs_free_dic
The decompress_io_ctx may be released asynchronously after
I/O completion. If this file is deleted immediately after read,
and the kworker of processing post_read_wq has not been executed yet
due to high workloads, It is possible that the inode(f2fs_inode_info)
is evicted and freed before it is used f2fs_free_dic.
The UAF case as below:
Thread A Thread B
- f2fs_decompress_end_io
- f2fs_put_dic
- queue_work
add free_dic work to post_read_wq
- do_unlink
- iput
- evict
- call_rcu
This file is deleted after read.
Thread C kworker to process post_read_wq
- rcu_do_batch
- f2fs_free_inode
- kmem_cache_free
inode is freed by rcu
- process_scheduled_works
- f2fs_late_free_dic
- f2fs_free_dic
- f2fs_release_decomp_mem
read (dic->inode)->i_compress_algorithm
This patch store compress_algorithm and sbi in dic to avoid inode UAF.
In addition, the previous solution is deprecated in [1] may cause system hang.
[1] https://lore.kernel.org/all/
[email protected]
📍 영향받는 시스템
F2FS 파일 시스템을 사용하는 Linux 커널 버전
⚔️ 공격 벡터
압축된 파일을 읽은 직후 즉시 삭제하는 특정 파일 시스템 작업 시나리오를 통한 메모리 오류 유도
🛡️ 대응 방법
F2FS의 inode UAF 문제를 해결한 최신 Linux 커널 패치를 적용하여 업데이트하십시오.
🔧 검증 코드
현재 실행 중인 커널 버전을 확인하여 해당 취약점이 해결된 최신 패치 버전인지 확인합니다.