🇰🇷 한글 설명
Linux 커널의 net/smc 모듈에서 IPPROTO_SMC 소켓 생성 실패 시 내부 TCP 소켓(clcsock)을 제대로 해제하지 않는 메모리 누수 취약점이 발견되었습니다. 권한이 없는 사용자가 BPF 프로그램을 사용하여 소켓 생성을 의도적으로 실패시킴으로써 커널 메모리를 무제한으로 점유할 수 있습니다.
💡 쉬운 설명
소켓을 만들려다 실패했을 때 사용하던 메모리를 돌려주지 않고 계속 쌓아두는 버그입니다. 공격자가 이 버그를 이용해 컴퓨터의 메모리를 가득 채워 시스템을 멈추게 할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
net/smc: release the internal TCP sock on IPPROTO_SMC socket creation failure
IPPROTO_SMC sockets create an internal TCP sock ("clcsock") from the
proto->init hook. When socket creation fails after proto->init has
run - e.g. a cgroup BPF program attached to BPF_CGROUP_INET_SOCK_CREATE
denies the socket - sk_common_release() only invokes sk_prot->destroy
if it is set, but neither smc_inet_prot nor smc_inet6_prot defines it,
and smc_destruct() returns early unless sk_state is SMC_CLOSED. As a
result, every failing socket(AF_INET, SOCK_STREAM, IPPROTO_SMC) call
leaks one tcp_sock, so an unprivileged task able to attach a deny-all
BPF_CGROUP_INET_SOCK_CREATE program to its own cgroup can grow kernel
memory unboundedly.
Add a .destroy hook to both protos that releases the clcsock via
smc_clcsock_release(). smc_sk_init() hashes the sock into the smc
hashinfo before the clcsock is created, and smc_diag dumps walk that
hash dereferencing smc->clcsock without taking clcsock_release_lock,
while sk_common_release() calls .destroy before .unhash. Unhash the
sock before releasing the clcsock, as __smc_release() does, so a
concurrent dump cannot observe the release; the second unhash in
sk_common_release() is a no-op.
📍 영향받는 시스템
Linux kernel (net/smc 모듈을 사용하는 버전)
⚔️ 공격 벡터
권한이 없는 사용자가 자신의 cgroup에 소켓 생성을 차단하는 BPF 프로그램을 부착하여 반복적으로 소켓 생성을 실패시킴
🛡️ 대응 방법
smc_inet_prot 및 smc_inet6_prot에 .destroy 훅을 추가하여 소켓 생성 실패 시 메모리를 해제하도록 커널 패치 적용
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 패치된 최신 보안 업데이트 버전인지 확인하십시오.