🇰🇷 한글 설명
Linux 커널의 bpf 및 sockmap 구성 요소에서 발생하는 취약점으로, 메시지에 추가 데이터가 있을 때 sock_put() 함수가 반복적으로 호출되는 문제가 있습니다. 이로 인해 참조 횟수(refcount) 오류가 발생하며, 결과적으로 Use-After-Free(UAF) 취약점을 유발하여 시스템 안정성을 해치거나 보안 위협이 될 수 있습니다.
💡 쉬운 설명
데이터를 처리하는 과정에서 시스템이 이미 사용이 끝난 메모리 자원을 중복해서 해제하려고 시도하는 오류입니다. 이 오류를 이용하면 해커가 시스템의 제어권을 획득하거나 시스템을 강제로 종료시킬 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
bpf, sockmap: Fix repeated calls to sock_put() when msg has more_data
In tcp_bpf_send_verdict() redirection, the eval variable is assigned to
__SK_REDIRECT after the apply_bytes data is sent, if msg has more_data,
sock_put() will be called multiple times.
We should reset the eval variable to __SK_NONE every time more_data
starts.
This causes:
IPv4: Attempt to release TCP socket in state 1 00000000b4c925d7
------------[ cut here ]------------
refcount_t: addition on 0; use-after-free.
WARNING: CPU: 5 PID: 4482 at lib/refcount.c:25 refcount_warn_saturate+0x7d/0x110
Modules linked in:
CPU: 5 PID: 4482 Comm: sockhash_bypass Kdump: loaded Not tainted 6.0.0 #1
Hardware name: Red Hat KVM, BIOS 1.11.0-2.el7 04/01/2014
Call Trace:
<TASK>
__tcp_transmit_skb+0xa1b/0xb90
? __alloc_skb+0x8c/0x1a0
? __kmalloc_node_track_caller+0x184/0x320
tcp_write_xmit+0x22a/0x1110
__tcp_push_pending_frames+0x32/0xf0
do_tcp_sendpages+0x62d/0x640
tcp_bpf_push+0xae/0x2c0
tcp_bpf_sendmsg_redir+0x260/0x410
? preempt_count_add+0x70/0xa0
tcp_bpf_send_verdict+0x386/0x4b0
tcp_bpf_sendmsg+0x21b/0x3b0
sock_sendmsg+0x58/0x70
__sys_sendto+0xfa/0x170
? xfd_validate_state+0x1d/0x80
? switch_fpu_return+0x59/0xe0
__x64_sys_sendto+0x24/0x30
do_syscall_64+0x37/0x90
entry_SYSCALL_64_after_hwframe+0x63/0xcd
📍 영향받는 시스템
Linux kernel (bpf, sockmap 관련 모듈을 사용하는 시스템)
⚔️ 공격 벡터
조작된 메시지를 포함한 TCP BPF 리디렉션 요청을 통해 커널의 참조 횟수 오류 유도
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 eval 변수 초기화 로직 수정 적용
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 패치 버전 이후인지 확인합니다.