🇰🇷 한글 설명
Linux 커널의 btrfs 파일 시스템에서 btrfs_encode_fh() 함수가 세 가지 케이스를 적절히 처리하지 못해 발생하는 경계 외 쓰기(Out-of-bounds write) 취약점입니다. 부모 루트 ID가 다른 경우 예상보다 큰 데이터를 쓰게 되어 8바이트의 메모리 오염이 발생할 수 있습니다.
💡 쉬운 설명
파일 정보를 저장할 때 필요한 공간보다 더 많은 데이터를 쓰려고 시도하여 메모리의 잘못된 영역을 건드리는 오류입니다. 이로 인해 시스템이 불안정해지거나 보안 문제가 생길 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
btrfs: avoid potential out-of-bounds in btrfs_encode_fh()
The function btrfs_encode_fh() does not properly account for the three
cases it handles.
Before writing to the file handle (fh), the function only returns to the
user BTRFS_FID_SIZE_NON_CONNECTABLE (5 dwords, 20 bytes) or
BTRFS_FID_SIZE_CONNECTABLE (8 dwords, 32 bytes).
However, when a parent exists and the root ID of the parent and the
inode are different, the function writes BTRFS_FID_SIZE_CONNECTABLE_ROOT
(10 dwords, 40 bytes).
If *max_len is not large enough, this write goes out of bounds because
BTRFS_FID_SIZE_CONNECTABLE_ROOT is greater than
BTRFS_FID_SIZE_CONNECTABLE originally returned.
This results in an 8-byte out-of-bounds write at
fid->parent_root_objectid = parent_root_id.
A previous attempt to fix this issue was made but was lost.
https://lore.kernel.org/all/
[email protected]/
Although this issue does not seem to be easily triggerable, it is a
potential memory corruption bug that should be fixed. This patch
resolves the issue by ensuring the function returns the appropriate size
for all three cases and validates that *max_len is large enough before
writing any data.
📍 영향받는 시스템
btrfs 파일 시스템을 사용하는 Linux 커널 버전
⚔️ 공격 벡터
특수하게 조작된 파일 핸들(File Handle)을 생성하거나 처리하도록 유도하여 메모리 오염 유발
🛡️ 대응 방법
btrfs_encode_fh() 함수가 수정된 최신 Linux 커널로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 패치된 최신 보안 업데이트 버전인지 확인