🇰🇷 한글 설명
Linux 커널의 netfilter nfnetlink_cthelper 모듈에서 goto restart 레이블의 잘못된 배치로 인해 for 루프의 경계 검사를 우회하는 8바이트 OOB 읽기 취약점입니다. 마지막 helper가 삭제되면 cb->args[1]이 정리되지 않아 루프 종료 후 재진입 시 할당되지 않은 메모리에 접근하게 됩니다. KASAN에 의해 감지되며 커널 패닉을 야기할 수 있습니다.
💡 쉬운 설명
Linux 커널의 네트워크 필터링 코드에서 메모리 경계를 넘어 데이터를 읽으려고 시도하는 버그입니다. 특정 네트워크 설정에서 프로그램이 할당되지 않은 메모리 영역에 접근하여 시스템 불안정을 초래할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
netfilter: nfnetlink_cthelper: fix OOB read in nfnl_cthelper_dump_table()
nfnl_cthelper_dump_table() has a 'goto restart' that jumps to a label
inside the for loop body. When the "last" helper saved in cb->args[1]
is deleted between dump rounds, every entry fails the (cur != last)
check, so cb->args[1] is never cleared. The for loop finishes with
cb->args[0] == nf_ct_helper_hsize, and the 'goto restart' jumps back
into the loop body bypassing the bounds check, causing an 8-byte
out-of-bounds read on nf_ct_helper_hash[nf_ct_helper_hsize].
The 'goto restart' block was meant to re-traverse the current bucket
when "last" is no longer found, but it was placed after the for loop
instead of inside it. Move the block into the for loop body so that
the restart only occurs while cb->args[0] is still within bounds.
BUG: KASAN: slab-out-of-bounds in nfnl_cthelper_dump_table+0x9f/0x1b0
Read of size 8 at addr ffff888104ca3000 by task poc_cthelper/131
Call Trace:
nfnl_cthelper_dump_table+0x9f/0x1b0
netlink_dump+0x333/0x880
netlink_recvmsg+0x3e2/0x4b0
sock_recvmsg+0xde/0xf0
__sys_recvfrom+0x150/0x200
__x64_sys_recvfrom+0x76/0x90
do_syscall_64+0xc3/0x6e0
Allocated by task 1:
__kvmalloc_node_noprof+0x21b/0x700
nf_ct_alloc_hashtable+0x65/0xd0
nf_conntrack_helper_init+0x21/0x60
nf_conntrack_init_start+0x18d/0x300
nf_conntrack_standalone_init+0x12/0xc0
📍 영향받는 시스템
Linux 커널 (netfilter nfnetlink_cthelper 모듈을 포함한 모든 버전, 패치 이전)
⚔️ 공격 벡터
로컬 공격자가 netlink 소켓을 통해 nfnl_cthelper_dump_table() 함수를 반복적으로 호출하면서 helper를 삭제하여 OOB 읽기를 트리거
🛡️ 대응 방법
Linux 커널 패치 적용 - goto restart 블록을 for 루프 내부로 이동하여 경계 검사 우회 방지
🔧 검증 코드
출력된 커널 버전이 취약점 패치 적용 버전 이상이면 안전합니다. 공급업체 보안 권고에서 권장하는 최소 커널 버전과 현재 버전을 비교하세요.
uname -r && cat /proc/version | grep -oP 'version \K[^ ]+'