🇰🇷 한글 설명
Linux 커널의 SMB 클라이언트에서 fallocate 범위 작업 시 FS-Cache를 무효화하지 않는 취약점이 발견되었습니다. 이로 인해 서버 측에서 파일 내용이 변경되어도 로컬 캐시가 유효한 것으로 남아, 이후 읽기 작업 시 변경 전의 오래된 데이터(stale data)가 반환될 수 있습니다.
💡 쉬운 설명
파일의 특정 부분을 지우거나 수정했을 때, 컴퓨터가 예전 데이터를 기억하고 있어서 수정된 내용 대신 옛날 내용을 보여주는 문제입니다. 캐시를 제대로 비워주지 않아 발생하는 데이터 불일치 현상입니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
smb/client: invalidate fscache for fallocate range operations
smb3_zero_range(), smb3_punch_hole(), smb3_insert_range(), and
smb3_collapse_range() modify file contents through server-side range
operations. These operations discard the affected page cache, but leave
the FS-Cache cookie valid, so a later read may return data cached before
the range operation.
Fix this by invalidating FS-Cache after outstanding I/O has completed
and before modifying the file on the server.
Run the following as root on a CIFS mount with fsc enabled and an active
CacheFiles backend:
bash -c '
MNT=/mnt/cifs
FILE="$MNT/repro"
# Generate four 1 MiB random blocks: [A][B][C][D].
dd if=/dev/urandom of=/tmp/src bs=1M count=4 status=none
# Expected contents after zeroing B: [A][zero][C][D].
cp /tmp/src /tmp/expected
dd if=/dev/zero of=/tmp/expected bs=1M seek=1 count=1 \
conv=notrunc status=none
cp /tmp/src "$FILE"
# Populate FS-Cache, then discard the page cache.
sync
echo 1 > /proc/sys/vm/drop_caches
cat "$FILE" > /dev/null
sync
echo 1 > /proc/sys/vm/drop_caches
fallocate --zero-range -o 1M -l 1M "$FILE"
if cmp -s /tmp/expected "$FILE"; then
echo "readback: OK"
else
echo "readback: STALE DATA"
fi
'
Before this change, the readback differs from /tmp/expected:
readback: STALE DATA
After this change, it matches:
readback: OK
📍 영향받는 시스템
FS-Cache 및 CacheFiles 백엔드가 활성화된 CIFS 마운트를 사용하는 Linux 커널 시스템
⚔️ 공격 벡터
로컬 또는 네트워크를 통해 SMB 서버의 파일 범위를 수정하여 캐시된 잘못된 데이터를 읽도록 유도
🛡️ 대응 방법
SMB 범위 작업(zero_range, punch_hole 등) 수행 전 FS-Cache를 무효화하도록 업데이트된 Linux 커널로 업데이트
🔧 검증 코드
커널 버전을 확인하여 해당 취약점이 패치된 최신 보안 업데이트 버전인지 확인하십시오.