🇰🇷 한글 설명
Linux 커널의 fprobe 기능에서 unregister_fprobe() 호출 시 RCU grace period를 기다리지 않는 취약점이 발견되었습니다. 이로 인해 fprobe가 해제된 직후 해당 메모리에 접근하려는 시도가 발생할 경우 Use-After-Free(UAF) 오류가 발생할 수 있습니다.
💡 쉬운 설명
프로그램이 사용 중인 메모리를 삭제할 때, 다른 작업이 해당 메모리를 더 이상 쓰지 않는지 확인하는 과정이 누락되었습니다. 이로 인해 이미 삭제된 메모리 영역을 다시 사용하려다 시스템 오류나 보안 문제가 생길 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
fprobe: Fix unregister_fprobe() to wait for RCU grace period
Commit 4346ba1604093 ("fprobe: Rewrite fprobe on function-graph tracer")
changed fprobe to register struct fprobe to an rcu-hlist, but it forgot
to wait for RCU GP. Thus there can be use-after-free if the fprobe is
released right after unregistering. This can be happened on fprobe
event and sample module code.
To fix this issue, add synchronize_rcu() in unregister_fprobe().
Note that BPF is OK because fprobe is used as a part of
bpf_kprobe_multi_link. This unregisters its fprobe in
bpf_kprobe_multi_link_release() and it is deallocated via
bpf_kprobe_multi_link_dealloc(), which is invoked from
bpf_link_defer_dealloc_rcu_gp() RCU callback.
For BPF, this also introduced unregister_fprobe_async() which does
NOT wait for RCU grace priod.
📍 영향받는 시스템
fprobe를 사용하는 Linux 커널 (Commit 4346ba1604093 적용 이후 버전)
⚔️ 공격 벡터
fprobe를 등록하고 해제하는 과정에서 특정 타이밍에 메모리 접근을 유도하여 Use-After-Free 공격 수행
🛡️ 대응 방법
synchronize_rcu()가 포함된 최신 커널 패치 적용
🔧 검증 코드
명령어 결과에 해당 커밋 해시가 포함되어 있다면 취약한 코드가 포함된 버전이거나 수정된 버전임을 의미함
git log -1 --format=%H | grep 4346ba1604093