🇰🇷 한글 설명
Linux 커널의 netfilter ctnetlink 모듈에서 테이블 덤프 시 refcount 누수가 발생합니다. 특정 조건에서 참조 카운트가 2번 증가하지만 1번만 감소하여 conntrack 객체가 해제되지 않으며, 이로 인해 네트워크 네임스페이스 제거나 커널 모듈 언로드가 무한정 차단됩니다.
💡 쉬운 설명
Linux 커널의 네트워크 추적 기능에서 메모리를 제대로 해제하지 못하는 버그입니다. 반복적인 조회로 메모리가 누수되어 시스템 종료 시 멈출 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
netfilter: ctnetlink: fix refcount leak on table dump
There is a reference count leak in ctnetlink_dump_table():
if (res < 0) {
nf_conntrack_get(&ct->ct_general); // HERE
cb->args[1] = (unsigned long)ct;
...
While its very unlikely, its possible that ct == last.
If this happens, then the refcount of ct was already incremented.
This 2nd increment is never undone.
This prevents the conntrack object from being released, which in turn
keeps prevents cnet->count from dropping back to 0.
This will then block the netns dismantle (or conntrack rmmod) as
nf_conntrack_cleanup_net_list() will wait forever.
This can be reproduced by running conntrack_resize.sh selftest in a loop.
It takes ~20 minutes for me on a preemptible kernel on average before
I see a runaway kworker spinning in nf_conntrack_cleanup_net_list.
One fix would to change this to:
if (res < 0) {
if (ct != last)
nf_conntrack_get(&ct->ct_general);
But this reference counting isn't needed in the first place.
We can just store a cookie value instead.
A followup patch will do the same for ctnetlink_exp_dump_table,
it looks to me as if this has the same problem and like
ctnetlink_dump_table, we only need a 'skip hint', not the actual
object so we can apply the same cookie strategy there as well.
📍 영향받는 시스템
Linux kernel 5.10 이상 (NF_CONNTRACK_NETLINK 활성화된 시스템)
⚔️ 공격 벡터
로컬 공격자가 netlink를 통해 conntrack 테이블 덤프를 반복적으로 요청하여 refcount 누수 트리거
🛡️ 대응 방법
Linux 커널을 CVE-2025-38721 패치가 적용된 버전으로 업그레이드
🔧 검증 코드
nf_conntrack이 출력되면 모듈 활성화 상태이며, uname -r로 확인한 커널 버전에 대해 배포판 보안 공지에서 패치 적용 여부를 확인합니다.
lsmod | grep nf_conntrack && uname -r || echo 'Not vulnerable'