🇰🇷 한글 설명
Linux 커널의 btrfs 파일 시스템에서 LZO 압축을 사용하는 인라인 익스텐트 처리 중 발생하는 취약점입니다. 조작된 btrfs 이미지를 사용하여 세그먼트 헤더가 없는 데이터를 읽을 경우, lzo_decompress 함수가 경계를 벗어난 메모리 영역을 참조하여 KASAN slab-out-of-bounds 오류를 유발합니다.
💡 쉬운 설명
파일을 압축해서 읽는 과정에서 데이터가 중간에 잘려 있어도 이를 확인하지 않고 계속 읽으려다 발생하는 오류입니다. 공격자가 특수하게 만든 파일을 시스템에 올리면 컴퓨터의 메모리 관리 체계에 혼란을 줄 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
btrfs: lzo: reject inline extents without valid headers
[BUG]
For a crafted btrfs image, the following KASAN can be triggered when
reading an inline lzo compressed file extent:
BUG: KASAN: slab-out-of-bounds in lzo_decompress+0x57d/0x700
Read of size 4 at addr ffff888006f2e644 by task btrfs_lzo_inlin/77
Call Trace:
<TASK>
dump_stack_lvl+0x5b/0x70
print_report+0xd1/0x610
kasan_report+0xe0/0x110
__asan_report_load_n_noabort+0x13/0x20
lzo_decompress+0x57d/0x700
btrfs_decompress+0x140/0x1c0
uncompress_inline+0x147/0x1b0
btrfs_get_extent+0xb23/0x10a0
btrfs_do_readpage.constprop.0+0x538/0x1ac0
btrfs_readahead+0x32f/0x5f0
read_pages+0x16f/0x850
page_cache_ra_unbounded+0x296/0x490
do_page_cache_ra+0xd9/0x130
page_cache_sync_ra+0x3ee/0x6f0
filemap_get_pages+0x306/0x15c0
filemap_read+0x329/0xd00
btrfs_file_read_iter+0x1f8/0x2b0
vfs_read+0x4ef/0x720
ksys_read+0xf8/0x1d0
__x64_sys_read+0x71/0xb0
x64_sys_call+0x1ab0/0x1b70
do_syscall_64+0x61/0x470
entry_SYSCALL_64_after_hwframe+0x4b/0x53
</TASK>
[CAUSE]
For an inline lzo compressed file extent, there should always be one lzo
header, recording the total length of the compressed data, followed by
one segment header, recording the compressed lzo payload.
But if a crafted inline lzo compressed file extent contains only an lzo
header, without the segment header or payload, lzo_decompress() will
still try to read the segment header, causing a read beyond the item
boundary.
Furthermore if the inline lzo compressed file extent is the first item
of the leaf, it will be at the extent buffer boundary. The above
out-of-boundary read will go beyond the extent buffer boundary,
triggering the above KASAN report.
[FIX]
Validate the total length of the inlined lzo compressed file extent, to
make sure there is at least one LZO header and one segment header, and a
non-zero payload.
[ Rework the commit message to remove slop ]
📍 영향받는 시스템
LZO 압축 기능을 사용하는 Linux 커널 기반의 btrfs 파일 시스템 환경
⚔️ 공격 벡터
조작된(crafted) btrfs 이미지 또는 파일을 시스템에 마운트하거나 읽기 시도
🛡️ 대응 방법
LZO 헤더와 세그먼트 헤더, 페이로드가 모두 존재하는지 검증하는 최신 커널 패치 적용
🔧 검증 코드
현재 실행 중인 커널 버전을 확인하여 해당 취약점이 수정된 최신 보안 패치 버전인지 확인합니다.