🇰🇷 한글 설명
Pillow 라이브러리의 WindowsViewer.get_command() 함수에서 파일 경로를 이스케이프 처리 없이 f-string으로 직접 명령줄에 삽입하는 취약점이 발견되었습니다. 이로 인해 shell=True 옵션이 사용된 subprocess.Popen 호출 시 파일 경로 내의 셸 메타문자를 통해 임의의 명령어가 실행될 수 있습니다.
💡 쉬운 설명
이미지 처리 프로그램이 파일 이름을 처리할 때 특수 문자를 제대로 걸러내지 못해 발생하는 문제입니다. 공격자가 파일 이름에 악성 명령어를 섞어 넣으면 컴퓨터가 이를 실행할 수 있습니다.
🇺🇸 원문 (English)
Pillow is a Python imaging library. Prior to 12.3.0, WindowsViewer.get_command() constructed a cmd.exe shell command by directly embedding a file path into an f-string without escaping and passed the result to subprocess.Popen(..., shell=True), allowing shell metacharacters in the file path to inject arbitrary cmd.exe commands. This issue is fixed in version 12.3.0.
📍 영향받는 시스템
Pillow 버전 12.3.0 미만
⚔️ 공격 벡터
조작된 파일 경로를 포함한 이미지 파일을 처리하도록 유도하여 셸 명령어를 주입
🛡️ 대응 방법
Pillow 라이브러리를 12.3.0 버전 이상으로 업데이트
🔧 검증 코드
출력된 버전 번호가 12.3.0보다 낮은지 확인
pip show Pillow | grep Version