🇰🇷 한글 설명
Linux 커널의 BPF devmap 구현에서 get_upper_ifindexes() 함수가 상위 장치의 인덱스를 배열에 기록할 때 경계 검사를 수행하지 않는 취약점입니다. 상위 장치의 수가 예상된 최대치(MAX_NEST_DEV)를 초과할 경우 스택 영역을 벗어난 쓰기(stack-out-of-bounds write)가 발생할 수 있습니다.
💡 쉬운 설명
컴퓨터의 메모리 공간 중 '스택'이라는 영역에 정해진 크기보다 더 많은 정보를 억지로 집어넣으려다 발생하는 오류입니다. 이를 통해 시스템이 멈추거나 해커가 악성 코드를 실행할 위험이 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
bpf: Fix stack-out-of-bounds write in devmap
get_upper_ifindexes() iterates over all upper devices and writes their
indices into an array without checking bounds.
Also the callers assume that the max number of upper devices is
MAX_NEST_DEV and allocate excluded_devices[1+MAX_NEST_DEV] on the stack,
but that assumption is not correct and the number of upper devices could
be larger than MAX_NEST_DEV (e.g., many macvlans), causing a
stack-out-of-bounds write.
Add a max parameter to get_upper_ifindexes() to avoid the issue.
When there are too many upper devices, return -EOVERFLOW and abort the
redirect.
To reproduce, create more than MAX_NEST_DEV(8) macvlans on a device with
an XDP program attached using BPF_F_BROADCAST | BPF_F_EXCLUDE_INGRESS.
Then send a packet to the device to trigger the XDP redirect path.
📍 영향받는 시스템
Linux Kernel (XDP 및 BPF devmap 기능을 사용하는 시스템)
⚔️ 공격 벡터
XDP 프로그램이 부착된 장치에 다수의 macvlan을 생성한 후 패킷을 전송하여 XDP 리다이렉트 경로를 트리거함
🛡️ 대응 방법
get_upper_ifindexes() 함수에 최대값 매개변수를 추가하여 경계 검사를 수행하도록 커널을 업데이트함
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 패치된 최신 보안 업데이트 버전인지 확인합니다.