🇰🇷 한글 설명
리눅스 커널의 tracing 기능에서 'STACKTRACE' 히스토그램 키를 처리할 때 메모리 오염이 발생하는 취약점입니다. 특정 필드 이름이 NULL이 아닌 플레이스홀더로 반환되면서, 잘못된 오프셋을 참조하여 커널 텍스트 주소를 길이로 사용하는 무제한 memcpy가 실행될 수 있습니다.
💡 쉬운 설명
리눅스 시스템의 기록 기능을 사용할 때, 잘못된 설정값을 입력하면 컴퓨터의 핵심 메모리 영역을 망가뜨려 시스템을 멈추게 할 수 있는 오류입니다. 공격자가 이를 악용하면 시스템을 강제로 종료시키거나 제어권을 탈취할 위험이 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
tracing: Fix memory corruption from a "STACKTRACE" histogram key
"cpu", "CPU", "stacktrace" and "STACKTRACE" are generic fields, defined
with an offset and a size of zero so that the filter code can match them
by name. parse_field() maps them onto their common_* equivalents for
backward compatibility, but unlike the common_* names it hands the
placeholder back to the caller instead of NULL.
create_hist_field() takes a non-NULL field as a promise that the record
carries a stacktrace and picks HIST_FIELD_FN_STACK, so the __data_loc
word is read from offset 0, that is from common_type, and its low 16
bits are followed as an offset into the record. What is found there
becomes the length of an unbounded memcpy. Pick an event whose id is
small enough that the offset stays inside its own record and the length
is a kernel text address:
# cd /sys/kernel/tracing
# echo 'hist:keys=STACKTRACE' > events/ftrace/print/trigger
# echo hello > trace_marker
Oops: general protection fault, probably for non-canonical address
RIP: 0010:rb_next+0x23/0x60
</IRQ>
RIP: 0010:memcpy+0xc/0x30
event_hist_trigger+0x2e7/0x12c0
Kernel panic - not syncing: Fatal exception in interrupt
Leave the field NULL, which is what the comment above the branch says
the code does and what common_stacktrace already does. FILTER_CPU and
FILTER_COMM are left alone, their create_hist_field() branches never
look at the field.
📍 영향받는 시스템
STACKTRACE 히스토그램 키를 사용하는 특정 버전의 Linux Kernel
⚔️ 공격 벡터
로컬 사용자가 /sys/kernel/tracing 인터페이스를 통해 조작된 히스토그램 트리거를 생성하여 메모리 오염 유도
🛡️ 대응 방법
커널 패치를 적용하여 STACKTRACE 필드가 NULL로 처리되도록 업데이트하거나 관련 tracing 설정을 제한함
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 최신 보안 패치 버전인지 확인합니다.