🇰🇷 한글 설명
Linux kernel ocfs2 파일시스템의 ocfs2_write_end_inline 함수에서 손상된 id_count 값을 검증하지 않아 발생하는 out-of-bounds write 취약점. 공격자가 특수 제작된 ocfs2 파일시스템으로 인접 메모리에 임의 데이터를 쓸 수 있음.
💡 쉬운 설명
Linux 파일시스템의 데이터 쓰기 기능이 손상된 파일시스템 구조를 신뢰하여 메모리 범위를 초과해 데이터를 기록하는 문제. 악의적인 파일시스템을 loop 장치로 마운트한 후 파일 복사 작업을 통해 커널 메모리에 접근 가능.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
ocfs2: fix out-of-bounds write in ocfs2_write_end_inline
KASAN reports a use-after-free write of 4086 bytes in
ocfs2_write_end_inline, called from ocfs2_write_end_nolock during a
copy_file_range splice fallback on a corrupted ocfs2 filesystem mounted on
a loop device. The actual bug is an out-of-bounds write past the inode
block buffer, not a true use-after-free. The write overflows into an
adjacent freed page, which KASAN reports as UAF.
The root cause is that ocfs2_try_to_write_inline_data trusts the on-disk
id_count field to determine whether a write fits in inline data. On a
corrupted filesystem, id_count can exceed the physical maximum inline data
capacity, causing writes to overflow the inode block buffer.
Call trace (crash path):
vfs_copy_file_range (fs/read_write.c:1634)
do_splice_direct
splice_direct_to_actor
iter_file_splice_write
ocfs2_file_write_iter
generic_perform_write
ocfs2_write_end
ocfs2_write_end_nolock (fs/ocfs2/aops.c:1949)
ocfs2_write_end_inline (fs/ocfs2/aops.c:1915)
memcpy_from_folio <-- KASAN: write OOB
So add id_count upper bound check in ocfs2_validate_inode_block() to
alongside the existing i_size check to fix it.
📍 영향받는 시스템
Linux kernel의 ocfs2 파일시스템을 지원하는 모든 버전 (Red Hat Enterprise Linux, Oracle Linux 등)
⚔️ 공격 벡터
특수 제작된 ocfs2 파일시스템을 loop device에 마운트한 후 copy_file_range 또는 splice 작업 실행
🛡️ 대응 방법
Linux kernel 패치 적용: ocfs2_validate_inode_block() 함수에 id_count 상한값 검증 추가
🔧 검증 코드
패치 적용 시 id_count 상한값 검증 코드가 출력되면 보안 업데이트 적용됨
grep -A5 'ocfs2_validate_inode_block' /lib/modules/$(uname -r)/build/fs/ocfs2/inode.c 2>/dev/null | grep -i 'id_count'