🇰🇷 한글 설명
Linux 커널의 net/sched 모듈 내 act_gact 및 act_police 구성 요소에서 범위 검사 미흡으로 인해 발생하는 취약점입니다. 사용자 공간에서 유효하지 않은 제어 동작인 TC_ACT_CONSUMED를 설정할 수 있으며, 이로 인해 패킷 처리 시 sk_buff 메모리가 해제되지 않고 누수되는 문제가 발생합니다.
💡 쉬운 설명
네트워크 패킷을 처리하는 과정에서 잘못된 명령어를 입력하면 컴퓨터의 메모리가 계속해서 낭비되는 현상이 발생합니다. 이 현상이 지속되면 시스템의 메모리가 고갈되어 컴퓨터가 느려지거나 멈출 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
net/sched: act_gact, act_police: range check the fallback control action
tcf_action_check_ctrlact() range checks the primary control action:
if (!opcode)
ret = action > TC_ACT_VALUE_MAX ? -EINVAL : 0;
TC_ACT_VALUE_MAX is TC_ACT_TRAP, so kernel-internal verdicts above it
cannot be set that way. But act_gact and act_police each carry a second,
independent control action supplied by user space that never reaches that
helper - TCA_GACT_PROB.paction and TCA_POLICE_RESULT. Both only reject
TC_ACT_GOTO_CHAIN, so any other value is stored verbatim and returned
verbatim from the action.
In particular user space can store TC_ACT_CONSUMED, which is
TC_ACT_VALUE_MAX + 1 and is deliberately not part of the UAPI value
range. That verdict tells every caller the action took ownership of the
skb, so nobody frees it: sch_handle_ingress(), sch_handle_egress() and
tcf_qevent_handle() all deliberately skip the free for it. The result is
one leaked sk_buff plus its data buffer per packet traversing the filter,
unbounded, for all traffic on the chain including kernel-generated
packets.
Both are trivially deterministic. act_gact clamps tcfg_pval to >= 1, so
with pval = 1 gact_determ() returns the fallback for every packet.
act_police has no mandatory rate, so rate = 0 leaves tcfp_mtu = ~0 and
tcf_police_mtu_check() always passes.
TC_ACT_CONSUMED was added by commit 720f22fed81b ("net: sched: refactor
reinsert action"), after both goto-chain guards were written:
commit 9469f375ab09 ("net/sched: act_gact: disallow 'goto chain' on
fallback control action") and
commit c08f5ed5d625 ("net/sched: act_police: disallow 'goto chain' on
fallback control action"). Neither guard was widened when the new
verdict appeared.
Factor the existing range test out of tcf_action_check_ctrlact() as
tcf_action_valid() and apply it to both fallbacks. The helper cannot call
tcf_action_check_ctrlact() directly because that also allocates a
goto_chain, which is exactly what these two sites must not do.
Reproduced on v7.2-rc6: kmemleak reports one leaked 232-byte
skbuff_head_cache object plus its 704-byte data buffer per packet. With
this patch both configurations are rejected with -EINVAL and kmemleak
reports none.
📍 영향받는 시스템
Linux kernel (v7.2-rc6 및 관련 버전 포함)
⚔️ 공격 벡터
사용자 공간에서 act_gact 또는 act_police의 fallback control action에 TC_ACT_CONSUMED 값을 설정하여 패킷을 전송함
🛡️ 대응 방법
커널 패치를 적용하여 tcf_action_valid()를 통해 fallback control action에 대한 범위 검사를 수행하도록 업데이트해야 합니다.
🔧 검증 코드
출력된 커널 버전이 취약점이 해결된 패치 버전 이후인지 확인합니다.