🔍 CVE-2024-39486

7.8
CVSS Score
HIGH
2024-07-06
2026-08-04 11:18
✅ 완료

🇰🇷 한글 설명

리눅스 커널의 drm/drm_file 구성 요소에서 pid 참조 횟수 계산 시 레이스 컨디션(경쟁 상태)이 발생하는 취약점입니다. 이로 인해 struct pid 객체에 대한 Use-After-Free(UAF)가 발생할 수 있습니다. 이 문제는 CONFIG_PREEMPT_RCU 설정이 활성화된 환경에서 발생할 가능성이 높습니다.

💡 쉬운 설명

두 개의 프로세스가 동시에 시스템 정보를 수정하려고 할 때, 컴퓨터가 이미 삭제된 메모리 정보를 다시 사용하려고 시도하는 오류입니다. 이로 인해 시스템이 충돌하거나 보안 공격에 노출될 수 있습니다.

🇺🇸 원문 (English)

In the Linux kernel, the following vulnerability has been resolved: drm/drm_file: Fix pid refcounting race <[email protected]>, Maxime Ripard <[email protected]>, Thomas Zimmermann <[email protected]> filp->pid is supposed to be a refcounted pointer; however, before this patch, drm_file_update_pid() only increments the refcount of a struct pid after storing a pointer to it in filp->pid and dropping the dev->filelist_mutex, making the following race possible: process A process B ========= ========= begin drm_file_update_pid mutex_lock(&dev->filelist_mutex) rcu_replace_pointer(filp->pid, <pid B>, 1) mutex_unlock(&dev->filelist_mutex) begin drm_file_update_pid mutex_lock(&dev->filelist_mutex) rcu_replace_pointer(filp->pid, <pid A>, 1) mutex_unlock(&dev->filelist_mutex) get_pid(<pid A>) synchronize_rcu() put_pid(<pid B>) *** pid B reaches refcount 0 and is freed here *** get_pid(<pid B>) *** UAF *** synchronize_rcu() put_pid(<pid A>) As far as I know, this race can only occur with CONFIG_PREEMPT_RCU=y because it requires RCU to detect a quiescent state in code that is not explicitly calling into the scheduler. This race leads to use-after-free of a "struct pid". It is probably somewhat hard to hit because process A has to pass through a synchronize_rcu() operation while process B is between mutex_unlock() and get_pid(). Fix it by ensuring that by the time a pointer to the current task's pid is stored in the file, an extra reference to the pid has been taken. This fix also removes the condition for synchronize_rcu(); I think that optimization is unnecessary complexity, since in that case we would usually have bailed out on the lockless check above.

📍 영향받는 시스템

CONFIG_PREEMPT_RCU=y 설정이 활성화된 리눅스 커널 (drm/drm_file 모듈 사용 시)

⚔️ 공격 벡터

특정 조건(CONFIG_PREEMPT_RCU 활성화) 하에서 정밀하게 설계된 두 프로세스의 동시 실행을 통한 레이스 컨디션 유도

🛡️ 대응 방법

리눅스 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 pid 참조 횟수 계산 로직을 수정해야 합니다.

🔧 검증 코드

커널 버전과 CONFIG_PREEMPT_RCU 설정이 'y'로 되어 있는지 확인하여 취약 환경 여부를 판단합니다.

Shell / Script
uname -r && grep CONFIG_PREEMPT_RCU /boot/config-$(uname -r)

📊 CVSS Vector String

CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

💻 영향받는 소프트웨어

Linux Kernel