🇰🇷 한글 설명
Linux 커널의 net/packet 구성 요소에서 tpacket_snd() 함수 실행 중 TOCTOU(Time-of-Check to Time-of-Use) 레이스 컨디션 취약점이 발견되었습니다. PACKET_VNET_HDR이 활성화된 경우, 커널이 헤더를 검증한 후 실제 사용하기 전까지 사용자 공간과 공유된 mmap 버퍼의 내용을 수정할 수 있어 보안 검사를 우회할 수 있습니다.
💡 쉬운 설명
검사관이 서류를 확인한 직후, 서류를 사용하기 전에 누군가 몰래 내용을 바꿔치기할 수 있는 허점이 발견되었습니다. 이로 인해 공격자가 커널의 보안 규칙을 속이고 잘못된 데이터를 전달할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
net/packet: fix TOCTOU race on mmap'd vnet_hdr in tpacket_snd()
In tpacket_snd(), when PACKET_VNET_HDR is enabled, vnet_hdr points
directly into the mmap'd TX ring buffer shared with userspace. The
kernel validates the header via __packet_snd_vnet_parse() but then
re-reads all fields later in virtio_net_hdr_to_skb(). A concurrent
userspace thread can modify the vnet_hdr fields between validation
and use, bypassing all safety checks.
The non-TPACKET path (packet_snd()) already correctly copies vnet_hdr
to a stack-local variable. All other vnet_hdr consumers in the kernel
(tun.c, tap.c, virtio_net.c) also use stack copies. The TPACKET TX
path is the only caller of virtio_net_hdr_to_skb() that reads directly
from user-controlled shared memory.
Fix this by copying vnet_hdr from the mmap'd ring buffer to a
stack-local variable before validation and use, consistent with the
approach used in packet_snd() and all other callers.
📍 영향받는 시스템
Linux kernel (TPACKET TX path를 사용하는 시스템)
⚔️ 공격 벡터
사용자 공간의 스레드가 mmap된 TX 링 버퍼 내의 vnet_hdr 필드를 검증과 사용 사이의 짧은 시간 동안 수정하는 방식
🛡️ 대응 방법
vnet_hdr를 mmap 버퍼에서 직접 읽지 않고, 검증 및 사용 전에 스택 로컬 변수로 복사하여 사용하도록 커널 패치 적용
🔧 검증 코드
현재 실행 중인 커널 버전을 확인하여 해당 취약점이 수정된 최신 보안 패치 버전인지 확인하십시오.