🇰🇷 한글 설명
Linux 커널의 GFS2 파일시스템에서 슈퍼블록의 sb_bsize_shift 값을 검증하지 않아 발생하는 문제입니다. 퍼저 등이 해당 값을 손상시키면 잘못된 계산으로 마운트 오류나 UBSAN 경고가 발생할 수 있어, 이후 패치에서 기대되는 고정값과 비교하여 검사하도록 수정되었습니다.
💡 쉬운 설명
GFS2 파일시스템의 디스크 정보 중 한 값이 잘못되어도 확인하지 않아 시스템이 이상 동작할 수 있었습니다. 이제는 값이 올바른지 검사하여 잘못된 경우 마운트를 즉시 거부합니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
gfs2: Check sb_bsize_shift after reading superblock
Fuzzers like to scribble over sb_bsize_shift but in reality it's very
unlikely that this field would be corrupted on its own. Nevertheless it
should be checked to avoid the possibility of messy mount errors due to
bad calculations. It's always a fixed value based on the block size so
we can just check that it's the expected value.
Tested with:
mkfs.gfs2 -O -p lock_nolock /dev/vdb
for i in 0 -1 64 65 32 33; do
gfs2_edit -p sb field sb_bsize_shift $i /dev/vdb
mount /dev/vdb /mnt/test && umount /mnt/test
done
Before this patch we get a withdraw after
[ 76.413681] gfs2: fsid=loop0.0: fatal: invalid metadata block
[ 76.413681] bh = 19 (type: exp=5, found=4)
[ 76.413681] function = gfs2_meta_buffer, file = fs/gfs2/meta_io.c, line = 492
and with UBSAN configured we also get complaints like
[ 76.373395] UBSAN: shift-out-of-bounds in fs/gfs2/ops_fstype.c:295:19
[ 76.373815] shift exponent 4294967287 is too large for 64-bit type 'long unsigned int'
After the patch, these complaints don't appear, mount fails immediately
and we get an explanation in dmesg.
📍 영향받는 시스템
GFS2 파일시스템을 사용하는 Linux 커널 (패치 적용 이전 버전)
⚔️ 공격 벡터
손상되거나 조작된 GFS2 파일시스템 이미지를 마운트하도록 유도하여 잘못된 시프트 연산 및 마운트 오류를 유발
🛡️ 대응 방법
배포판에서 제공하는 Linux 커널 보안 업데이트를 적용하고 재부팅
🔧 검증 코드
커널 버전이 CVE 수정이 포함된 배포판 업데이트 이후인지 확인하고, gfs2 모듈 로드 여부 및 파일시스템 지원 여부를 확인하며, 모듈이 없으면 해당 취약점 영향권 밖입니다.
uname -r; lsmod | grep gfs2; grep -i gfs2 /proc/filesystems 2>/dev/null