🇰🇷 한글 설명
리눅스 커널의 reboot 관련 기능에서 cad_pid 포인터의 생명주기를 적절히 보호하지 않아 발생하는 Use-After-Free 취약점입니다. cad_pid를 읽는 도중 다른 프로세스가 이를 변경하면 이미 해제된 메모리 주소에 접근하게 되어 시스템 충돌이나 권한 상승이 발생할 수 있습니다.
💡 쉬운 설명
컴퓨터의 핵심 운영체제인 리눅스에서 특정 정보를 읽는 도중에 그 정보가 갑자기 바뀌어 버리는 오류가 있습니다. 이로 인해 시스템이 갑자기 멈추거나 해커가 시스템 권한을 뺏을 위험이 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
reboot: fix cad_pid use-after-free race
cad_pid is a single kernel-wide struct pid pointer. proc_do_cad_pid()
reads it and passes it to pid_vnr() without protecting the lifetime of
the referenced struct pid. A concurrent writer can replace cad_pid and
drop the final reference to the old struct pid after the reader has
loaded the pointer but before pid_vnr() has finished dereferencing it,
causing a use-after-free.
kill_cad_pid() has the same lifetime race when it passes cad_pid to
kill_pid().
At the time this issue was reported, an unprivileged user could reach the
sysctl through user and PID namespaces because cad_pid was registered in
pid_table[]. Moving cad_pid back to the global reboot sysctl table
corrected that namespace and permission mismatch, but did not fix the
underlying lifetime race.
Fix this by treating cad_pid as an RCU-protected pointer at both read
sites and by waiting for a grace period before dropping the old reference
on the write side.
call_rcu(&old_pid->rcu, ...) cannot be used here because free_pid()
also queues pid->rcu; queueing the same rcu_head twice can corrupt the
RCU callback list.
Original KASAN crash stack:
kernel/pid.c:545 pid_nr_ns() # reads freed pid->level
kernel/pid.c:556 pid_vnr() # calls pid_nr_ns()
kernel/pid.c:775 proc_do_cad_pid() # calls pid_vnr(cad_pid)
📍 영향받는 시스템
Linux Kernel (cad_pid 관련 race condition이 존재하는 버전)
⚔️ 공격 벡터
비특권 사용자가 네임스페이스를 통해 sysctl에 접근하여 race condition을 유도함으로써 발생
🛡️ 대응 방법
cad_pid를 RCU(Read-Copy-Update) 보호 포인터로 처리하고, 쓰기 작업 시 grace period를 기다리도록 커널 패치 적용
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 패치 버전인지 배포판 보안 공지를 통해 확인