🇰🇷 한글 설명
Linux 커널의 net/sched: sch_teql 구성 요소에서 경합 조건(Race Condition)으로 인한 Use-After-Free(UAF) 취약점이 발견되었습니다. teql 마스터의 슬레이브 연결 리스트가 적절한 잠금(Lock)이나 RCU 보호 없이 동시에 수정될 수 있어 메모리 오류를 유발합니다.
💡 쉬운 설명
여러 작업이 동시에 네트워크 설정을 변경하려고 할 때, 이미 삭제된 메모리 영역에 접근하여 시스템 오류를 일으킬 수 있는 문제입니다. 이로 인해 시스템이 충돌하거나 보안 공격에 노출될 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
net/sched: sch_teql: Introduce slaves_lock to avoid race condition and UAF
The teql master->slaves singly linked list is not protected against
multiple writes. It can be mod'ed concurently from teql_master_xmit(),
teql_dequeue(), teql_init() and teql_destroy() without holding any list
lock or RCU protection.
[email protected] has demonstrated that the qdisc is freed
after an RCU grace period, but teql_master_xmit() running on another
CPU can still hold a stale pointer into the list, resulting in a
slab-use-after-free:
BUG: KASAN: slab-use-after-free in teql_master_xmit+0xf0f/0x16b0
Read of size 8 at addr ffff888013fb0440 by task poc/332
Freed 512-byte region [ffff888013fb0400, ffff888013fb0600) (kmalloc-512)
The fix?
Add a per-master slaves_lock spinlock that serializes all mutations of
master->slaves and the NEXT_SLAVE() links in teql_destroy() and
teql_qdisc_init(). teql_master_xmit() also takes the same slaves_lock
around those updates.
Annotate master->slaves and the per-slave ->next pointer with __rcu and
use the appropriate RCU accessors everywhere they are touched:
rcu_assign_pointer() on the writer side (under slaves_lock),
rcu_dereference_protected() for the writer-side loads (also under
slaves_lock), rcu_dereference_bh() for the loads in teql_master_xmit() and
rtnl_dereference() for the loads in teql_master_open()/teql_master_mtu(),
which run under RTNL.
Pair this with rcu_read_lock_bh()/rcu_read_unlock_bh() around the list
traversal in teql_master_xmit(), so that readers either observe a fully
linked list or are deferred until the in-flight mutation completes. The two
early-return paths in teql_master_xmit() are updated to release the RCU-bh
read-side critical section before returning, since leaving it held would
disable BH on that CPU for good.
📍 영향받는 시스템
Linux Kernel (sch_teql 모듈 사용 시)
⚔️ 공격 벡터
동시적인 네트워크 스케줄링 작업(teql_init, teql_destroy 등)을 유도하여 메모리 관리 오류를 발생시킴
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 slaves_lock 및 RCU 보호 메커니즘을 적용해야 함
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 패치 버전 이후인지 확인하십시오.