🇰🇷 한글 설명
Linux 커널 ftrace(함수 추적) 필터 파일 읽기 시 글로벌 tracer hash 포인터를 직접 사용하여 발생하는 use-after-free(UAF) 취약점입니다. 리더가 쓰기 작업 중에 업데이트되는 hash를 가리키는 정적 포인터를 사용하여 메모리 손상이 발생할 수 있습니다.
💡 쉬운 설명
Linux 커널의 ftrace 필터 읽기 기능이 업데이트되는 메모리를 안전하지 않게 참조하여 시스템이 할당된 메모리를 다시 사용할 때 오류가 발생합니다. 이를 통해 공격자가 권한 상승이나 시스템 장애를 유발할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
ftrace: Also allocate and copy hash for reading of filter files
Currently the reader of set_ftrace_filter and set_ftrace_notrace just adds
the pointer to the global tracer hash to its iterator. Unlike the writer
that allocates a copy of the hash, the reader keeps the pointer to the
filter hashes. This is problematic because this pointer is static across
function calls that release the locks that can update the global tracer
hashes. This can cause UAF and similar bugs.
Allocate and copy the hash for reading the filter files like it is done
for the writers. This not only fixes UAF bugs, but also makes the code a
bit simpler as it doesn't have to differentiate when to free the
iterator's hash between writers and readers.
📍 영향받는 시스템
Linux 커널 (ftrace 기능 활성화된 버전, 주로 kernel 5.15 이상)
⚔️ 공격 벡터
로컬 공격자가 set_ftrace_filter 또는 set_ftrace_notrace 파일을 반복적으로 읽으면서 동시에 쓰기 작업 수행
🛡️ 대응 방법
Linux 커널을 패치된 버전으로 업데이트 (ftrace hash 복사 메커니즘이 적용된 버전)
🔧 검증 코드
커널 버전 확인 후 공급업체 보안 공지에서 해당 버전에 대한 패치 여부 확인. 보통 5.15.x 이상에서 영향받으므로 버전과 배포판의 보안 업데이트 상태 확인 필요
uname -r | grep -E '^[0-9]+\.[0-9]+'