🇰🇷 한글 설명
Linux 커널의 netfilter synproxy 구성 요소에서 skb_ensure_writable 호출 시 발생하는 메모리 관리 오류입니다. skb_ensure_writable이 실행되면서 기존 메모리 헤더가 해제될 수 있는데, 이후 함수가 해제된 메모리 주소에 체크섬을 업데이트하려고 시도하여 Use-After-Free 취약점이 발생합니다.
💡 쉬운 설명
네트워크 패킷을 처리하는 과정에서 이미 사용이 끝나 버려진 메모리 공간에 데이터를 쓰려고 시도하는 보안 결함입니다. 이로 인해 시스템이 충돌하거나 해커가 메모리를 조작할 위험이 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
netfilter: synproxy: refresh tcphdr after skb_ensure_writable
synproxy_tstamp_adjust() rewrites the TCP timestamp option in place
and then patches the TCP checksum via inet_proto_csum_replace4() on
the caller-supplied tcphdr pointer. Both ipv4_synproxy_hook() and
ipv6_synproxy_hook() obtain that pointer with skb_header_pointer()
before calling in, so it may either alias skb->head directly or
point at the caller's on-stack _tcph buffer.
Between obtaining the pointer and using it, the function calls
skb_ensure_writable(skb, optend), which on a cloned or non-linear
skb invokes pskb_expand_head() and frees the old skb->head. After
that point the cached th is stale:
caller (ipv[46]_synproxy_hook)
th = skb_header_pointer(skb, ..., &_tcph)
synproxy_tstamp_adjust(skb, protoff, th, ...)
skb_ensure_writable(skb, optend)
pskb_expand_head() /* kfree(old skb->head) */
...
inet_proto_csum_replace4(&th->check, ...)
/* writes into freed head, or
into the caller's stack copy
leaving the on-wire checksum
stale */
The option bytes are written through skb->data and are fine; only
the checksum update goes through th and so lands in the wrong
place. The result is either a write into freed slab memory or a
packet leaving with a checksum that does not match its payload.
Fix by re-deriving th from skb->data + protoff immediately after
skb_ensure_writable() succeeds, so the subsequent checksum update
targets the linear, writable header.
📍 영향받는 시스템
Linux kernel (netfilter synproxy 기능이 활성화된 버전)
⚔️ 공격 벡터
조작된 TCP 패킷을 전송하여 커널의 synproxy 처리 과정에서 메모리 오류 유도
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 해결된 패치 버전 이후인지 확인