🇰🇷 한글 설명
Linux 커널의 io_uring/bpf-ops에서 이미 등록된 BPF ops를 재등록할 때 발생하는 Use-After-Free 취약점입니다. 공격자가 동일한 ring_fd를 다른 io_ring_ctx로 재지정함으로써 기존 컨텍스트를 고립시키고, 해제된 메모리 영역을 참조하게 만들어 시스템 권한 탈취가 가능합니다.
💡 쉬운 설명
이미 사용 중인 통로를 강제로 다시 설정하여, 컴퓨터가 이미 삭제된 메모리 주소를 참조하게 만드는 오류입니다. 이를 통해 공격자는 시스템의 중요한 제어권을 가로챌 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
io_uring/bpf-ops: reject re-registration of an already-bound ops
io_install_bpf() only rejects a second registration on the ctx side
(ctx->bpf_ops) and sets the per-map back-pointer ops->priv
unconditionally. The struct_ops link path never advances a map past
BPF_STRUCT_OPS_STATE_READY, so the same io_uring_bpf_ops map can be
registered more than once, and bpf_io_reg() re-resolves the target ring
via fget(ops->ring_fd) on every call. A caller can therefore point the
same ring_fd at a different io_ring_ctx between two BPF_LINK_CREATE
calls.
The second registration passes the ctx->bpf_ops check (the new ctx has
none) and overwrites ops->priv, orphaning the first ctx. Teardown
(io_eject_bpf()/bpf_io_unreg()) only reaches a ctx through ops->priv, so
the orphaned ctx is never torn down: its ctx->loop_step keeps pointing
into the struct_ops trampoline, which is freed once the map is gone. A
later io_uring_enter() on the orphaned ring then calls the dangling
ctx->loop_step from io_run_loop() -- a use-after-free of freed
executable memory, reachable by a task with CAP_BPF + CAP_PERFMON.
Reject registration when ops->priv is already set, as hid_bpf_reg()
does for its struct_ops.
📍 영향받는 시스템
Linux Kernel (io_uring/bpf-ops 구성 요소 포함 버전)
⚔️ 공격 벡터
CAP_BPF 및 CAP_PERFMON 권한을 가진 사용자가 BPF_LINK_CREATE를 반복 호출하여 메모리 고립 및 Use-After-Free 유도
🛡️ 대응 방법
io_install_bpf() 함수에서 ops->priv가 이미 설정되어 있는 경우 재등록을 거부하도록 커널 패치 적용
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 패치된 최신 보안 업데이트 버전인지 확인하십시오.