🇰🇷 한글 설명
Linux 커널의 sunrpc 구성 요소에서 비동기 TLS 핸드쉐이크 콜백 처리 중 svc_xprt 참조를 적절히 유지하지 못해 발생하는 취약점입니다. 이로 인해 핸드쉐이크 도중 연결이 종료될 경우 해제된 메모리 영역에 쓰기 작업이 발생하여 슬랩(Slab) 메모리 오염을 유발할 수 있습니다.
💡 쉬운 설명
네트워크 연결을 설정하는 과정에서 데이터가 저장된 메모리 공간이 미리 삭제되어 발생하는 오류입니다. 공격자가 이를 이용하면 시스템의 메모리를 망가뜨려 보안을 무력화하거나 제어권을 탈취할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
sunrpc: pin svc_xprt across the asynchronous TLS handshake callback
svc_tcp_handshake() stores the raw svc_xprt pointer in
tls_handshake_args.ta_data and submits the request through
tls_server_hello_x509(). The handshake core takes only
sock_hold(req->hr_sk); nothing references the embedding struct
svc_sock that svc_tcp_handshake_done() reaches via container_of().
Two close races leave the in-flight callback writing through a freed
svc_sock. svc_sock_free() calls tls_handshake_cancel() and discards
its return value: a false return means handshake_complete() has
already set HANDSHAKE_F_REQ_COMPLETED but hp_done() may not have
finished, yet svc_sock_free() proceeds to kfree(svsk). The
cancel-loser fall-through inside svc_tcp_handshake() itself produces
the same window: when wait_for_completion_interruptible_timeout()
returns <= 0 (timeout or signal) and tls_handshake_cancel() returns
false, the function does not drain, returns, and svc_handle_xprt()
calls svc_xprt_received(), which clears XPT_BUSY and can drop the
last reference. A concurrent close then runs svc_sock_free() while
svc_tcp_handshake_done() is still updating xpt_flags and walking
svsk->sk_handshake_done.
The corruption surfaces as set_bit/clear_bit RMW into the freed
xpt_flags slab slot and as complete_all() walking and writing the
freed wait_queue_head_t list embedded in sk_handshake_done -- a
slab-corruption primitive, not a benign read. The path is reachable
on any TLS-enabled NFS server whenever a connection close overlaps
the tlshd downcall delivery window; the interruptible wait means
signal delivery suffices, not just SVC_HANDSHAKE_TO expiry.
Take svc_xprt_get(xprt) immediately before tls_server_hello_x509()
so the in-flight callback owns its own reference. Release it on the
two edges where the callback is guaranteed not to fire -- submission
failure from tls_server_hello_x509() and a successful
tls_handshake_cancel() -- and at the tail of
svc_tcp_handshake_done() after complete_all().
[cel: rewrote commit message to describe the actual change]
📍 영향받는 시스템
TLS를 사용하는 NFS 서버가 구동되는 Linux 커널 버전
⚔️ 공격 벡터
TLS가 활성화된 NFS 서버에 연결을 시도한 후, 핸드쉐이크 과정 중에 의도적으로 연결을 종료하여 메모리 경합 상태(Race Condition)를 유발
🛡️ 대응 방법
해당 취약점이 수정된 최신 Linux 커널 버전으로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 패치된 배포판의 보안 업데이트 버전인지 확인