🇰🇷 한글 설명
Linux 커널의 SMB 클라이언트에서 cifsacl, modefromsid 또는 SMB3.1.1 POSIX 확장 옵션을 사용할 때 발생하는 보안 취약점입니다. 파일 쓰기 작업 시 setuid/setgid 비트가 제거되어야 함에도 불구하고, 특정 설정에서 이 비트가 서버에 반영되지 않고 유지되어 권한 상승을 초래할 수 있습니다.
💡 쉬운 설명
파일을 수정하면 원래 보안을 위해 특수 권한(setuid)이 사라져야 하는데, 네트워크 공유 폴더를 사용할 때 이 권한이 사라지지 않고 그대로 남는 문제입니다. 이를 통해 공격자가 비정상적으로 높은 권한을 획득할 위험이 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
smb: client: clear setuid/setgid bit on write with cifsacl/modefromsid/posix extensions
When a file has the setuid or setgid bit set and is written to, the VFS
strips those bits and issues a setattr with ATTR_KILL_SUID/ATTR_KILL_SGID
together with an ATTR_MODE carrying the already-cleared mode.
Both cifs_setattr_unix() and cifs_setattr_nounix() unconditionally dropped
ATTR_MODE in that case:
/* skip mode change if it's just for clearing setuid/setgid */
if (attrs->ia_valid & (ATTR_KILL_SUID|ATTR_KILL_SGID))
attrs->ia_valid &= ~ATTR_MODE;
This is fine for the default mount, where the mode is only emulated via
the DOS read-only attribute and cannot represent the setuid/setgid bits
anyway. However, with the "cifsacl" or "modefromsid" mount options the
mode is stored on the server through an ACL (id_mode_to_cifs_acl()), with
the SMB3.1.1 POSIX extensions the mode is sent to the server directly,
and with the SMB1 Unix extensions (cifs_setattr_unix) the mode is sent
via CIFSSMBUnixSetPathInfo(). In all those cases dropping ATTR_MODE means
the cleared mode is never pushed to the server, so the setuid/setgid bit
survives the write.
This is a security issue: on local filesystems the setuid bit is stripped
when a file is written, but over these cifs.ko mounts the bit persists on
the server, potentially allowing an unexpected privilege escalation on
subsequent execution.
Fix this in two places:
1. cifs_setattr_nounix(): only take the "skip mode change" shortcut
when the mode is emulated via the DOS read-only attribute (i.e.
neither cifsacl/modefromsid nor the SMB3.1.1 POSIX extensions are
in effect), so that the cleared mode is propagated to the server
in the ACL / POSIX cases.
2. cifs_setattr_unix(): this function is only called when Unix
extensions are in effect, so the mode is always stored on the
server. Remove the shortcut entirely so that the cleared mode is
always pushed.
📍 영향받는 시스템
Linux kernel (SMB client with cifsacl, modefromsid, or SMB3.1.1 POSIX extensions enabled)
⚔️ 공격 벡터
공유 폴더 내의 setuid/setgid 파일에 쓰기 작업을 수행하여 서버 측의 특수 권한 비트를 유지시킴
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하십시오.
🔧 검증 코드
출력된 커널 버전을 확인하여 해당 취약점이 해결된 최신 패치 버전인지 확인하십시오.