🇰🇷 한글 설명
리눅스 커널의 tracing 기능에서 tracer 옵션 파일을 열 때 발생하는 레이스 컨디션 취약점입니다. 옵션 파일을 통해 trace_array의 참조를 획득하는 과정에서, 해당 요소가 먼저 해제되어 Use-After-Free(UAF)가 발생할 수 있습니다.
💡 쉬운 설명
시스템의 기록을 남기는 파일을 열 때, 기록 장치가 갑자기 사라지면서 컴퓨터의 메모리 관리 체계에 혼란을 주는 오류입니다. 이로 인해 시스템이 멈추거나 보안 문제가 생길 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
tracing: Take trace_array reference when opening a tracer options file
When a tracer option file is opened, it is passed a descriptor that points
to an element on the trace_array's topts array. This element has
information to find the trace array and other information. It uses this
element to take a reference of the trace_array so that the trace_array
does not get removed while this file is opened.
Unfortunately, there's a race condition where the element itself could be
freed by the removal of the instance the trace_array represents causing a
use-after-free as this element that is used to find the trace_array to
increment its reference counter is also freed when the instance is
removed.
To solve this, add a trace_array_tracer_options_get() helper function that
will take the address of the element that is passed to the open function
by the inode->i_private pointer and search all the trace_arrays under a
lock to find the one that the element's address is in the range of the
trace_arrays topts array elements. When a match happens, that trace_array's
reference would be increased.
Note, there's a race where if an admin was deleting and creating trace
instances at the same time and the memory of the old trace_array's array
matched the memory of the new trace_array that it could in theory open the
option from the wrong trace array. But we do not care because it would be
stupid to perform that kind of action. As long as the only thing that can
happen is that the option from the wrong trace array is used and doesn't
crash the kernel it will only make the user confused. But if they are
doing something stupid like this, they are already confused, so no harm
done.
📍 영향받는 시스템
Linux Kernel (tracing 기능이 활성화된 버전)
⚔️ 공격 벡터
로컬 사용자가 tracer 옵션 파일을 여는 과정에서 특정 타이밍에 인스턴스를 삭제하여 레이스 컨디션 유도
🛡️ 대응 방법
커널 패치를 적용하여 trace_array_tracer_options_get() 헬퍼 함수를 통해 잠금(lock) 상태에서 안전하게 참조를 획득하도록 업데이트
🔧 검증 코드
현재 실행 중인 커널 버전을 확인하여 해당 취약점이 해결된 패치 버전인지 확인합니다.