🇰🇷 한글 설명
Linux 커널의 pwrseq 디버그 파일 시스템(debugfs)에서 pwrseq_debugfs_seq_next() 함수 호출 시 Use-After-Free 취약점이 발생합니다. 이는 변수가 범위를 벗어날 때 참조 카운트가 잘못 관리되어 이미 해제된 메모리 포인터를 참조하게 되어 발생합니다.
💡 쉬운 설명
컴퓨터의 전원 관리 시스템 정보를 보여주는 과정에서, 이미 사용이 끝난 메모리 주소를 다시 사용하려고 시도하는 오류가 발견되었습니다. 이로 인해 시스템이 불안정해지거나 보안 문제가 생길 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
pwrseq: core: fix use-after-free in pwrseq_debugfs_seq_next()
pwrseq_debugfs_seq_next() declares 'next' with __free(put_device),
which causes put_device() to be called on the returned pointer when
the variable goes out of scope. This results in a use-after-free
since the seq_file framework receives a pointer whose reference has
already been dropped.
Simply removing __free(put_device) would fix the UAF but would leak
the reference acquired by bus_find_next_device(), as stop() only
calls up_read(&pwrseq_sem) and never releases the device reference.
Fix this by making the reference counting consistent across all
seq_file callbacks, matching the standard pattern used by PCI and
SCSI:
- start(): use get_device() so it returns a referenced pointer.
- next(): explicitly put_device(curr) to release the previous
device's reference (no NULL check needed - the seq_file framework
only calls next() while the previous return was non-NULL).
- stop(): put_device(data) to release the last iterated device's
reference, with a NULL guard since stop() may be called with NULL
when start() returned NULL or next() reached end-of-sequence.
📍 영향받는 시스템
Linux Kernel (pwrseq 관련 모듈 사용 시스템)
⚔️ 공격 벡터
로컬 권한을 가진 공격자가 debugfs를 통해 특정 시퀀스 파일을 읽어 메모리 오류를 유발할 수 있음
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 pwrseq 참조 카운트 로직을 수정해야 함
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 패치 버전 이후인지 확인합니다.