🇰🇷 한글 설명
Linux 커널의 BPF JIT 컴파일러에서 BPF_ST|BPF_PROBE_MEM32 즉시값 저장 명령이 constant blinding 처리에서 누락되어, bpf_jit_harden >= 1 설정 시 사용자 제어 32비트 즉시값이 가공되지 않은 상태로 네이티브 코드에 남을 수 있습니다. 이 문제는 bpf_jit_blind_insn()에 PROBE_MEM32 케이스를 추가하여 수정되었습니다.
💡 쉬운 설명
리눅스 커널이 BPF 프로그램을 기계어로 바꿀 때 보안용 값 가리기(blinding) 처리가 일부 명령에서 빠지는 문제입니다. 이로 인해 공격자가 제어하는 값이 가려지지 않은 채 실행 코드에 남을 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
bpf: Fix constant blinding for PROBE_MEM32 stores
BPF_ST | BPF_PROBE_MEM32 immediate stores are not handled by
bpf_jit_blind_insn(), allowing user-controlled 32-bit immediates to
survive unblinded into JIT-compiled native code when bpf_jit_harden >= 1.
The root cause is that convert_ctx_accesses() rewrites BPF_ST|BPF_MEM
to BPF_ST|BPF_PROBE_MEM32 for arena pointer stores during verification,
before bpf_jit_blind_constants() runs during JIT compilation. The
blinding switch only matches BPF_ST|BPF_MEM (mode 0x60), not
BPF_ST|BPF_PROBE_MEM32 (mode 0xa0). The instruction falls through
unblinded.
Add BPF_ST|BPF_PROBE_MEM32 cases to bpf_jit_blind_insn() alongside the
existing BPF_ST|BPF_MEM cases. The blinding transformation is identical:
load the blinded immediate into BPF_REG_AX via mov+xor, then convert
the immediate store to a register store (BPF_STX).
The rewritten STX instruction must preserve the BPF_PROBE_MEM32 mode so
the architecture JIT emits the correct arena addressing (R12-based on
x86-64). Cannot use the BPF_STX_MEM() macro here because it hardcodes
BPF_MEM mode; construct the instruction directly instead.
📍 영향받는 시스템
패치되지 않은 Linux 커널 (BPF JIT 및 arena 기능을 사용하는 버전, 특히 x86-64 환경)
⚔️ 공격 벡터
로컬 사용자가 특수하게 작성한 BPF 프로그램을 로드하여 JIT 컴파일 시 가려지지 않은 즉시값을 이용하는 방식으로 추정됩니다.
🛡️ 대응 방법
배포판 벤더가 제공하는 최신 커널 보안 업데이트를 적용하고 재부팅하거나, 권한이 없는 사용자의 BPF 사용을 제한합니다.
🔧 검증 코드
출력된 커널 버전이 벤더의 패치 적용 버전인지 확인하고, bpf_jit_harden 값이 1 이상이며 unprivileged_bpf_disabled 설정을 함께 점검합니다. 정확한 패치 여부는 배포판 보안 공지로 최종 확인해야 합니다.
uname -r && sysctl net.core.bpf_jit_harden kernel.unprivileged_bpf_disabled 2>/dev/null