🇰🇷 한글 설명
리눅스 커널의 ftrace 기능에서 trace_array 참조를 ftrace_ops에 접근하기 전에 수행하지 않아 발생하는 Use-After-Free 취약점입니다. 특정 인스턴스가 삭제되는 시점과 파일을 여는 시점이 겹칠 경우 ftrace_ops가 해제되어 커널 충돌을 유발할 수 있습니다.
💡 쉬운 설명
시스템의 기록 기능을 사용하는 도중, 기록 대상이 갑자기 사라지면 컴퓨터의 두뇌 역할을 하는 커널이 혼란에 빠져 멈춰버릴 수 있는 문제입니다. 데이터가 삭제되기 전에 미리 안전하게 확인하는 절차가 누락되어 발생합니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
ftrace: Take trace_array reference before accessing its ftrace_ops
The trace instance files set_ftrace_filter and set_ftrace_notrace was
updated to work with specific trace instances (trace_arrays). The issue is
that when these files are opened, there is a small race window where it
will use the ftrace_ops from the inode->private pointer to get a reference
to the trace_array and then take its reference. The problem is that the
ftrace_ops itself could be freed. If the rmdir on the instance happens at
the same time the set_ftrace_filter file is opened, the rmdir could have
also freed the ftrace_ops and referencing it will cause a use-after-free
bug and crash the kernel.
Instead, pass in the trace_array as the file private data (NULL for the
top level instance), and then pass both the trace_array and the ftrace_ops
to the ftrace_regex_open() function. If the trace_array is NULL, then it
just uses the ftrace_ops without the need to take its reference (like
normal). If the ftrace_ops is NULL, that is only the case for the top
level instance and the global_ops can be used.
This allows the trace_array to have its reference incremented before
touching the ftrace_ops that could also be freed when the instance is.
📍 영향받는 시스템
Linux Kernel (ftrace 기능이 활성화된 버전)
⚔️ 공격 벡터
로컬 사용자가 특정 race condition을 유도하여 커널 메모리 오류를 일으키는 방식
🛡️ 대응 방법
ftrace_regex_open 함수를 통해 trace_array 참조를 먼저 수행하도록 커널 패치 적용
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 해결된 보안 패치 버전인지 확인