🇰🇷 한글 설명
Linux 커널의 TIPC 프로토콜에서 UDP 베어러 비활성화 시 discoverer 객체가 적절한 grace period 없이 해제되어 발생하는 Use-After-Free 취약점입니다. 이로 인해 RX softirq 과정에서 이미 해제된 메모리에 접근을 시도하여 시스템 충돌이나 보안 위협이 발생할 수 있습니다.
💡 쉬운 설명
컴퓨터가 사용 중인 데이터를 너무 빨리 지워버려서, 나중에 그 데이터를 다시 쓰려고 할 때 오류가 발생하는 문제입니다. 이 오류를 이용하면 시스템을 멈추게 하거나 해킹에 악용될 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
tipc: fix use-after-free of the discoverer in tipc_disc_rcv()
bearer_disable() frees b->disc with tipc_disc_delete()'s plain kfree(),
but tipc_disc_rcv() still dereferences b->disc in RX softirq under
rcu_read_lock() (tipc_udp_recv -> tipc_rcv -> tipc_disc_rcv).
L2 bearers are safe thanks to the synchronize_net() in
tipc_disable_l2_media(), but the UDP bearer defers that call to the
cleanup_bearer() workqueue, so the discoverer is freed with no grace
period:
BUG: KASAN: slab-use-after-free in tipc_disc_rcv (net/tipc/discover.c:149)
Read of size 8 at addr ffff88802348b728 by task poc_tipc/184
<IRQ>
tipc_disc_rcv (net/tipc/discover.c:149)
tipc_rcv (net/tipc/node.c:2126)
tipc_udp_recv (net/tipc/udp_media.c:391)
udp_rcv (net/ipv4/udp.c:2643)
ip_local_deliver_finish (net/ipv4/ip_input.c:241)
</IRQ>
Freed by task 181:
kfree (mm/slub.c:6565)
bearer_disable (net/tipc/bearer.c:418)
tipc_nl_bearer_disable (net/tipc/bearer.c:1001)
The bearer is freed with kfree_rcu(); free the discoverer the same way.
Add an rcu_head to struct tipc_discoverer and free it and its skb from an
RCU callback.
Because the RCU callback (tipc_disc_free_rcu) lives in module text, a
call_rcu() that is still pending when the tipc module is unloaded would
invoke a freed function. Add an rcu_barrier() to tipc_exit() after the
bearer subsystem has been torn down, so all pending discoverer callbacks
have run before the module text goes away.
Reachable from an unprivileged user namespace: the TIPCv2 genl family is
netnsok and its bearer commands have no GENL_ADMIN_PERM. Needs CONFIG_TIPC
and CONFIG_TIPC_MEDIA_UDP.
📍 영향받는 시스템
CONFIG_TIPC 및 CONFIG_TIPC_MEDIA_UDP가 활성화된 Linux 커널
⚔️ 공격 벡터
권한이 없는 사용자가 unprivileged user namespace를 통해 TIPCv2 genl 명령을 사용하여 UDP 베어러를 조작함으로써 발생 가능
🛡️ 대응 방법
커널 패치를 통해 discoverer 해제 시 kfree_rcu()를 사용하고, 모듈 종료 시 rcu_barrier()를 호출하도록 업데이트해야 함
🔧 검증 코드
출력 결과에 CONFIG_TIPC=y 및 CONFIG_TIPC_MEDIA_UDP=y가 포함되어 있는지 확인하여 취약한 설정 여부를 판단합니다.
zgrep 'CONFIG_TIPC' /proc/config.gz 2>/dev/null || grep 'CONFIG_TIPC' /boot/config-$(uname -r)