🇰🇷 한글 설명
Linux 커널 BPF 검증자의 maybe_fork_scalars() 함수에서 BPF_OR 연산 시 검증 상태를 잘못 포크하는 버그입니다. 런타임 값과 검증자 추적값이 불일치하여 맵 범위 초과 접근이 가능해집니다.
💡 쉬운 설명
Linux 커널의 성능 모니터링 시스템에서 계산 실수가 발생해 프로그램이 메모리에 잘못 접근할 수 있게 됩니다. 공격자가 이를 이용해 커널 메모리에 무단으로 접근할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
bpf: Fix unsound scalar forking in maybe_fork_scalars() for BPF_OR
maybe_fork_scalars() is called for both BPF_AND and BPF_OR when the
source operand is a constant. When dst has signed range [-1, 0], it
forks the verifier state: the pushed path gets dst = 0, the current
path gets dst = -1.
For BPF_AND this is correct: 0 & K == 0.
For BPF_OR this is wrong: 0 | K == K, not 0.
The pushed path therefore tracks dst as 0 when the runtime value is K,
producing an exploitable verifier/runtime divergence that allows
out-of-bounds map access.
Fix this by passing env->insn_idx (instead of env->insn_idx + 1) to
push_stack(), so the pushed path re-executes the ALU instruction with
dst = 0 and naturally computes the correct result for any opcode.
📍 영향받는 시스템
Linux 커널 6.7 이전 버전에서 BPF 기능이 활성화된 모든 시스템
⚔️ 공격 벡터
BPF 프로그램 로드 시 검증자 우회를 통한 커널 메모리 범위 초과 접근
🛡️ 대응 방법
Linux 커널을 6.8 이상으로 업데이트 또는 패치 적용
🔧 검증 코드
출력 값이 680000 이상이면 패치됨 (6.8.0 이상), 미만이면 취약함
uname -r | awk -F. '{print ($1*10000+$2*100+$3)}'