🇰🇷 한글 설명
Linux 커널의 SMB 클라이언트에서 smb3_insert_range() 함수가 새로운 파일 크기(EOF)의 유효성을 검사하지 않는 취약점이 발견되었습니다. 이로 인해 FALLOC_FL_INSERT_RANGE 작업 시 파일 크기 제한(RLIMIT_FSIZE)을 우회하거나, 최대 파일 크기(s_maxbytes)를 초과하거나, loff_t 범위를 벗어나는 크기를 생성할 수 있습니다.
💡 쉬운 설명
파일의 크기를 제한하는 설정이 있어도 특정 명령어를 사용하면 제한을 무시하고 파일을 비정상적으로 크게 만들 수 있는 문제입니다. 이는 시스템의 저장 공간 관리나 파일 크기 제한 규칙을 무력화할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
smb/client: validate new EOF for insert range
smb3_insert_range() does not check if the new file size
(i_size + len) is valid. This allows FALLOC_FL_INSERT_RANGE to bypass
RLIMIT_FSIZE, exceed s_maxbytes, or produce a size outside the loff_t
range.
Use check_add_overflow() to calculate the new EOF. Validate it with
inode_newsize_ok() before modifying the file.
Reproducer, using a file on a CIFS mount:
bash -c '
FILE=/mnt/cifs/repro
trap "" SIGXFSZ
ulimit -f 3072 # RLIMIT_FSIZE = 3 MiB
# A regular write is stopped at 3 MiB.
dd if=/dev/zero of="$FILE" bs=1M count=4 status=none
stat -c "size after write: %s" "$FILE"
# Insert 2 MiB into a 2 MiB file.
truncate -s 2M "$FILE"
fallocate -i -o 0 -l 2M "$FILE"
stat -c "size after insert: %s" "$FILE"
'
Before this change, the regular write stops at the 3 MiB limit, but
insert range grows the file to 4 MiB:
dd: error writing '/mnt/cifs/repro': File too large
size after write: 3145728
size after insert: 4194304
After this change, insert range also fails at the limit and leaves the
2 MiB file unchanged:
dd: error writing '/mnt/cifs/repro': File too large
size after write: 3145728
fallocate: fallocate failed: File too large
size after insert: 2097152
📍 영향받는 시스템
Linux kernel (SMB client module)
⚔️ 공격 벡터
CIFS 마운트된 파일 시스템에서 fallocate 명령어를 사용하여 파일 크기 제한을 우회하는 방식
🛡️ 대응 방법
check_add_overflow() 및 inode_newsize_ok()를 사용하여 파일 크기 계산 및 검증 로직이 포함된 최신 커널로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 패치된 최신 보안 업데이트 버전인지 확인