🇰🇷 한글 설명
Linux 커널의 NFSv4 구현에서 O_TRUNC 플래그를 사용한 open() 호출 시 권한 검사 오류가 발생합니다. POSIX 표준에 따라 파일 크기를 0으로 만드는 작업은 쓰기 권한이 필요함에도 불구하고, 특정 조건에서 읽기 전용 권한만으로도 로컬 권한 검사를 통과하여 서버의 파일 내용을 삭제할 수 있는 취약점입니다.
💡 쉬운 설명
파일을 읽기만 할 수 있는 권한을 가진 사용자가 실수나 악의적인 의도로 파일 내용을 모두 지워버릴 수 있는 보안 결함입니다. NFS 서버를 사용하는 환경에서 권한 설정이 제대로 작동하지 않아 데이터가 손실될 위험이 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
NFSv4: include MAY_WRITE in open permission mask for O_TRUNC
POSIX requires write permission to truncate a file, so an open() that
specifies O_TRUNC must be authorized for write access regardless of the
O_ACCMODE access mode.
nfs_open_permission_mask() builds the access mask passed to
nfs_may_open(), which is the local authorization gate for OPENs the
client serves itself from a cached write delegation via the
can_open_delegated() path in nfs4_try_open_cached(). The mask is
derived from O_ACCMODE alone, so an open(O_RDONLY | O_TRUNC) against a
file the caller cannot write requests only MAY_READ and passes the
local check. The OPEN is then satisfied locally and the truncation is
issued to the server as a SETATTR(size=0) over the delegation stateid,
which the server accepts under standard write-delegation semantics.
POSIX requires that this open fail with EACCES.
Include MAY_WRITE in the mask whenever O_TRUNC is set so the local
check matches the access the server would have enforced.
📍 영향받는 시스템
NFSv4를 사용하는 Linux 커널 시스템 (패치 적용 전 버전)
⚔️ 공격 벡터
쓰기 권한이 없는 사용자가 O_RDONLY | O_TRUNC 플래그를 사용하여 NFSv4 파일을 열어 파일 내용을 초기화함
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 nfs_open_permission_mask() 함수를 수정해야 함
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 해결된 최신 패치 버전인지 배포판 보안 공지를 통해 확인하십시오.