🇰🇷 한글 설명
Linux 커널의 tracing/probes 구성 요소에서 여러 개의 프로브가 연결된 이벤트의 필드 이름 및 유형 처리 시 Use-After-Free 취약점이 발견되었습니다. 특정 프로브를 삭제할 때 해당 프로브가 소유한 문자열 메모리가 해제되지만, 다른 프로브가 남아있는 이벤트가 여전히 해당 메모리 주소를 참조하여 시스템 오류를 유발할 수 있습니다.
💡 쉬운 설명
컴퓨터의 동작을 기록하는 기능에서, 기록에 필요한 정보가 담긴 메모리가 먼저 삭제되었음에도 불구하고 시스템이 이를 계속 사용하려고 시도하여 발생하는 오류입니다. 이로 인해 시스템이 갑자기 멈추거나 예상치 못한 동작을 할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
tracing/probes: Fix use-after-free on field name/type of events with multiple probes
The fields of a probe-based dynamic event (kprobe, uprobe, eprobe and
fprobe events) are created in traceprobe_define_arg_fields() by handing
the probe_arg name/type strings to trace_define_field(), which only
stores the pointers without copying. Those strings are owned by the
trace_probe and are freed when that probe is removed.
An event can have several probes attached. The field list is defined
only once, by the first probe that registers the event, but it is kept
alive by any surviving sibling probe. Deleting just that first probe by
symbol -
# primary A: fields are defined from A's args
echo 'p:kprobes/ev vfs_read a1=$arg1' > kprobe_events
# append B: shares A's event call
echo 'p:kprobes/ev vfs_write a1=$arg1' >> kprobe_events
# delete only A (matched by symbol), B survives
echo '-:kprobes/ev vfs_read' >> kprobe_events
frees A's args (trace_probe_cleanup() -> traceprobe_free_probe_arg()),
but trace_probe_unlink() keeps the trace_probe_event because the probe
list is not empty. The event call stays registered via B while its
fields now reference freed memory. Any field lookup then reads it, e.g.
echo 'a1 == 1' > events/kprobes/ev/filter
BUG: KASAN: slab-use-after-free in strcmp+0xa7/0xb0
Call Trace:
strcmp
trace_find_event_field
parse_pred
process_preds
create_filter
apply_event_filter
event_filter_write
field->name references parg->name (kstrdup'd, freed with the probe) and,
for array arguments, field->type references parg->fmt (kmalloc'd, freed
with the probe) - the scalar type otherwise points at the static
fmttype rodata, which is safe.
Have traceprobe_define_arg_fields() duplicate the name and type strings
and anchor the copies on the trace_probe_event, which embeds the event
call and outlives every individual probe; trace_probe_event_free()
releases them.
The reproducer above triggers reliably; the field lookup and the delete
both run under event_mutex, so this is a dangling reference after
removal rather than a race.
The issue was found by the autokbug dynamic kernel fuzzer at Tencent
Yunding Lab.
📍 영향받는 시스템
Linux Kernel (tracing/probes 모듈을 사용하는 버전)
⚔️ 공격 벡터
로컬 사용자가 특정 프로브를 등록하고 일부를 삭제하는 과정을 통해 메모리 오류를 유발할 수 있음
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 필드 이름과 유형 문자열이 이벤트 수명 주기 동안 안전하게 유지되도록 수정해야 함
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 해결된 패치 버전 이후인지 확인하십시오.