🇰🇷 한글 설명
Linux 커널의 pm8001 SCSI 드라이버에서 발생하는 use-after-free 취약점입니다. pm8001_queue_command() 함수가 PHY 다운/디바이스 손실 상태에서 -ENODEV를 반환할 때, 함수 내에서 SAS task를 해제한 후에도 상위 계층인 libsas의 sas_ata_qc_issue()에서 동일한 task를 다시 해제하려고 하여 double free가 발생합니다.
💡 쉬운 설명
Linux 커널의 저수준 드라이버 코드에서 메모리 영역을 두 번 해제하려고 시도하는 오류입니다. 이로 인해 시스템 충돌이나 임의의 코드 실행이 가능할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
scsi: pm8001: Fix use-after-free in pm8001_queue_command()
Commit e29c47fe8946 ("scsi: pm8001: Simplify pm8001_task_exec()") refactors
pm8001_queue_command(), however it introduces a potential cause of a double
free scenario when it changes the function to return -ENODEV in case of phy
down/device gone state.
In this path, pm8001_queue_command() updates task status and calls
task_done to indicate to upper layer that the task has been handled.
However, this also frees the underlying SAS task. A -ENODEV is then
returned to the caller. When libsas sas_ata_qc_issue() receives this error
value, it assumes the task wasn't handled/queued by LLDD and proceeds to
clean up and free the task again, resulting in a double free.
Since pm8001_queue_command() handles the SAS task in this case, it should
return 0 to the caller indicating that the task has been handled.
📍 영향받는 시스템
Linux 커널 (PM8001 SCSI 컨트롤러 드라이버 포함된 모든 버전, 패치 적용 전)
⚔️ 공격 벡터
로컬 공격자가 SCSI 디바이스를 제거하거나 연결을 끊어서 취약한 코드 경로를 트리거하여 메모리 손상을 유발
🛡️ 대응 방법
Linux 커널을 최신 버전으로 업그레이드하여 pm8001_queue_command() 함수가 task 처리 후 0을 반환하도록 수정된 버전을 설치
🔧 검증 코드
pm8001 드라이버가 로드되어 있으면 해당 시스템이 영향받을 수 있으며, 커널 버전 확인(uname -r)과 관련 보안 공지를 통해 패치 적용 여부를 확인해야 합니다.
grep -E 'pm8001|SCSI' /proc/modules 2>/dev/null | grep -q pm8001 && echo 'pm8001 driver present' || echo 'pm8001 driver not loaded'