🇰🇷 한글 설명
Linux 커널의 F2FS 파일 시스템에서 디렉터리 이름을 변경할 때 '..' 링크의 inode 번호를 업데이트하지 않아 디렉터리 엔트리가 손상되는 취약점입니다. 이로 인해 파일 시스템 구조가 깨지거나 데이터 무결성이 훼손될 수 있습니다.
💡 쉬운 설명
파일의 이름을 바꿀 때 상위 폴더와의 연결 고리가 제대로 업데이트되지 않아 폴더 구조가 엉망이 되는 문제입니다. 이로 인해 파일이 사라지거나 시스템 오류가 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
f2fs: fix to avoid dirent corruption
As Al reported in link[1]:
f2fs_rename()
...
if (old_dir != new_dir && !whiteout)
f2fs_set_link(old_inode, old_dir_entry,
old_dir_page, new_dir);
else
f2fs_put_page(old_dir_page, 0);
You want correct inumber in the ".." link. And cross-directory
rename does move the source to new parent, even if you'd been asked
to leave a whiteout in the old place.
[1] https://lore.kernel.org/all/20231017055040.GN800259@ZenIV/
With below testcase, it may cause dirent corruption, due to it missed
to call f2fs_set_link() to update ".." link to new directory.
- mkdir -p dir/foo
- renameat2 -w dir/foo bar
[ASSERT] (__chk_dots_dentries:1421) --> Bad inode number[0x4] for '..', parent parent ino is [0x3]
[FSCK] other corrupted bugs [Fail]
📍 영향받는 시스템
F2FS 파일 시스템을 사용하는 Linux 커널 버전
⚔️ 공격 벡터
로컬 권한을 가진 사용자가 특정 조건(renameat2 등)을 이용해 디렉터리 이름을 변경하여 파일 시스템 손상 유도
🛡️ 대응 방법
F2FS 관련 패치가 적용된 최신 Linux 커널로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 해결된 패치 버전 이후인지 확인