🇰🇷 한글 설명
Linux 커널의 Squashfs 파일 시스템에서 sb_min_blocksize의 반환 값을 적절히 검증하지 않아 발생하는 취약점입니다. 특정 조건에서 ioctl 호출이 동시에 발생할 경우 반환값이 0이 되어 비트 시프트 연산 시 범위를 벗어나는 오류가 발생합니다.
💡 쉬운 설명
파일 시스템을 사용하는 과정에서 특정 명령이 동시에 실행되면 컴퓨터가 계산 오류를 일으키는 문제입니다. 이로 인해 시스템이 불안정해지거나 예상치 못한 동작을 할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
Squashfs: check return result of sb_min_blocksize
Syzkaller reports an "UBSAN: shift-out-of-bounds in squashfs_bio_read" bug.
Syzkaller forks multiple processes which after mounting the Squashfs
filesystem, issues an ioctl("/dev/loop0", LOOP_SET_BLOCK_SIZE, 0x8000).
Now if this ioctl occurs at the same time another process is in the
process of mounting a Squashfs filesystem on /dev/loop0, the failure
occurs. When this happens the following code in squashfs_fill_super()
fails.
----
msblk->devblksize = sb_min_blocksize(sb, SQUASHFS_DEVBLK_SIZE);
msblk->devblksize_log2 = ffz(~msblk->devblksize);
----
sb_min_blocksize() returns 0, which means msblk->devblksize is set to 0.
As a result, ffz(~msblk->devblksize) returns 64, and msblk->devblksize_log2
is set to 64.
This subsequently causes the
UBSAN: shift-out-of-bounds in fs/squashfs/block.c:195:36
shift exponent 64 is too large for 64-bit type 'u64' (aka
'unsigned long long')
This commit adds a check for a 0 return by sb_min_blocksize().
📍 영향받는 시스템
Squashfs 파일 시스템을 사용하는 Linux 커널 버전
⚔️ 공격 벡터
Squashfs 마운트와 LOOP_SET_BLOCK_SIZE ioctl 호출을 동시에 수행하는 로컬 공격
🛡️ 대응 방법
sb_min_blocksize()의 반환값이 0인지 확인하는 로직이 포함된 최신 Linux 커널로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 패치된 최신 보안 업데이트 버전인지 확인합니다.