🇰🇷 한글 설명
Linux 커널의 BPF 검증기(verifier)에서 LSM 훅 반환 값을 처리할 때 레지스터 범위를 좁히는 과정에서 발생하는 취약점입니다. 기존 레지스터의 잘못된 경계값이 유지된 채 새로운 범위와 교차 계산되어, 검증기와 실제 실행 환경 간의 불일치가 발생함으로써 BPF 메모리 안전성 검사를 우회할 수 있습니다.
💡 쉬운 설명
컴퓨터가 프로그램의 안전성을 검사할 때, 이전 단계의 잘못된 정보를 바탕으로 현재 값을 잘못 판단하는 오류입니다. 이 오류를 이용하면 해커가 보안 검사를 속이고 시스템의 허용되지 않은 메모리 영역에 접근할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
bpf: Reset register bounds before narrowing retval range in check_mem_access()
When the BPF verifier processes a context load of an LSM hook return
value, it calls __mark_reg_s32_range() to narrow the register to the
hook's valid range. However, __mark_reg_s32_range() intersects the new
range with the register's existing bounds using max_t()/min_t() rather
than replacing them.
If the destination register carries stale bounds from a prior instruction
(e.g. BPF_MOV64_IMM), the intersection can produce a range narrower than
reality. The verifier then believes it knows the register's exact value,
while at runtime the actual hook return value is loaded, creating a
verifier/runtime mismatch that can be used to bypass BPF memory safety
checks.
The else branch already calls mark_reg_unknown() to reset register state
before any narrowing. Apply the same reset in the is_retval path so
stale bounds are cleared before __mark_reg_s32_range() intersects.
📍 영향받는 시스템
Linux Kernel (BPF/LSM 관련 기능이 활성화된 버전)
⚔️ 공격 벡터
BPF 프로그램 내에서 LSM 훅 반환 값을 로드할 때 발생하는 레지스터 경계값 불일치를 이용한 메모리 안전성 검사 우회
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 check_mem_access() 함수의 레지스터 초기화 로직을 수정해야 합니다.
🔧 검증 코드
현재 실행 중인 커널 버전을 확인하여 해당 취약점이 해결된 패치 버전인지 보안 공지(Advisory)와 대조합니다.