🇰🇷 한글 설명
Linux 커널 nf_tables에서 체인 검증 시 전체 체인 그래프를 매번 재탐색하여 CPU soft lock-up이 발생하는 문제가 수정되었습니다. 이미 검증된 체인은 재검증을 생략하고, 기본 체인 컨텍스트(타입, hooknum)가 바뀔 때만 다시 검증합니다.
💡 쉬운 설명
리눅스 방화벽 규칙 처리 과정에서 같은 검사를 불필요하게 반복하다가 시스템이 멈추는 문제를 고쳤습니다. 이미 확인한 규칙 묶음은 다시 확인하지 않도록 개선되었습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
netfilter: nf_tables: avoid chain re-validation if possible
Hamza Mahfooz reports cpu soft lock-ups in
nft_chain_validate():
watchdog: BUG: soft lockup - CPU#1 stuck for 27s! [iptables-nft-re:37547]
[..]
RIP: 0010:nft_chain_validate+0xcb/0x110 [nf_tables]
[..]
nft_immediate_validate+0x36/0x50 [nf_tables]
nft_chain_validate+0xc9/0x110 [nf_tables]
nft_immediate_validate+0x36/0x50 [nf_tables]
nft_chain_validate+0xc9/0x110 [nf_tables]
nft_immediate_validate+0x36/0x50 [nf_tables]
nft_chain_validate+0xc9/0x110 [nf_tables]
nft_immediate_validate+0x36/0x50 [nf_tables]
nft_chain_validate+0xc9/0x110 [nf_tables]
nft_immediate_validate+0x36/0x50 [nf_tables]
nft_chain_validate+0xc9/0x110 [nf_tables]
nft_immediate_validate+0x36/0x50 [nf_tables]
nft_chain_validate+0xc9/0x110 [nf_tables]
nft_table_validate+0x6b/0xb0 [nf_tables]
nf_tables_validate+0x8b/0xa0 [nf_tables]
nf_tables_commit+0x1df/0x1eb0 [nf_tables]
[..]
Currently nf_tables will traverse the entire table (chain graph), starting
from the entry points (base chains), exploring all possible paths
(chain jumps). But there are cases where we could avoid revalidation.
Consider:
1 input -> j2 -> j3
2 input -> j2 -> j3
3 input -> j1 -> j2 -> j3
Then the second rule does not need to revalidate j2, and, by extension j3,
because this was already checked during validation of the first rule.
We need to validate it only for rule 3.
This is needed because chain loop detection also ensures we do not exceed
the jump stack: Just because we know that j2 is cycle free, its last jump
might now exceed the allowed stack size. We also need to update all
reachable chains with the new largest observed call depth.
Care has to be taken to revalidate even if the chain depth won't be an
issue: chain validation also ensures that expressions are not called from
invalid base chains. For example, the masquerade expression can only be
called from NAT postrouting base chains.
Therefore we also need to keep record of the base chain context (type,
hooknum) and revalidate if the chain becomes reachable from a different
hook location.
📍 영향받는 시스템
nf_tables를 사용하는 Linux 커널 (수정 커밋 적용 이전 버전, 배포판별 패치 버전 확인 필요)
⚔️ 공격 벡터
로컬 또는 권한 있는 사용자가 복잡한 체인 점프 구조의 nftables 규칙을 반복 적용하여 커널 CPU 점유를 유발할 수 있음
🛡️ 대응 방법
배포판 보안 업데이트를 통해 해당 커널 패치가 포함된 버전으로 업그레이드하고 재부팅
🔧 검증 코드
출력된 커널 버전을 배포판 보안 공지에서 해당 CVE 수정 포함 여부와 대조하며, 패키지 기준으로는 dpkg -l linux-image-$(uname -r) 또는 rpm -q kernel 결과의 업데이트 여부를 확인합니다.