🇰🇷 한글 설명
Linux 커널의 SCTP 프로토콜 구현에서 sendmsg 호출 중 해제된 트랜스포트를 참조하는 Use-After-Free 취약점이 발견되었습니다. 특정 상황에서 소켓 잠금이 해제된 사이 다른 스레드가 트랜스포트를 제거하면 레이스 컨디션이 발생하여 메모리 오류를 유발할 수 있습니다.
💡 쉬운 설명
데이터를 보내는 도중에 전송 통로가 갑자기 사라져서, 컴퓨터가 이미 없어진 통로를 다시 사용하려고 시도하다가 오류가 발생하는 문제입니다. 이로 인해 시스템이 불안정해지거나 보안 문제가 생길 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
sctp: detect and prevent references to a freed transport in sendmsg
sctp_sendmsg() re-uses associations and transports when possible by
doing a lookup based on the socket endpoint and the message destination
address, and then sctp_sendmsg_to_asoc() sets the selected transport in
all the message chunks to be sent.
There's a possible race condition if another thread triggers the removal
of that selected transport, for instance, by explicitly unbinding an
address with setsockopt(SCTP_SOCKOPT_BINDX_REM), after the chunks have
been set up and before the message is sent. This can happen if the send
buffer is full, during the period when the sender thread temporarily
releases the socket lock in sctp_wait_for_sndbuf().
This causes the access to the transport data in
sctp_outq_select_transport(), when the association outqueue is flushed,
to result in a use-after-free read.
This change avoids this scenario by having sctp_transport_free() signal
the freeing of the transport, tagging it as "dead". In order to do this,
the patch restores the "dead" bit in struct sctp_transport, which was
removed in
commit 47faa1e4c50e ("sctp: remove the dead field of sctp_transport").
Then, in the scenario where the sender thread has released the socket
lock in sctp_wait_for_sndbuf(), the bit is checked again after
re-acquiring the socket lock to detect the deletion. This is done while
holding a reference to the transport to prevent it from being freed in
the process.
If the transport was deleted while the socket lock was relinquished,
sctp_sendmsg_to_asoc() will return -EAGAIN to let userspace retry the
send.
The bug was found by a private syzbot instance (see the error report [1]
and the C reproducer that triggers it [2]).
📍 영향받는 시스템
SCTP 프로토콜을 사용하는 Linux 커널 버전
⚔️ 공격 벡터
멀티스레드 환경에서 특정 소켓 옵션(SCTP_SOCKOPT_BINDX_REM)을 조작하여 레이스 컨디션을 유발하는 방식
🛡️ 대응 방법
SCTP 트랜스포트의 상태를 확인하는 로직이 포함된 최신 Linux 커널로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 패치된 최신 보안 업데이트 버전인지 확인합니다.