🇰🇷 한글 설명
Pillow 라이브러리의 JPEG 인코딩 과정에서 ICC 프로필이 버퍼를 가득 채울 경우, libjpeg가 버퍼 범위를 초과하여 데이터를 작성하는 취약점이 발견되었습니다. 공격자가 조작한 주석(COM)과 이미지 데이터가 인접한 힙 메모리를 덮어쓸 수 있으며, 이는 프로세스 충돌이나 임의 코드 실행으로 이어질 수 있습니다.
💡 쉬운 설명
이미지 파일을 저장할 때 메모리 계산 오류로 인해 프로그램의 안전한 영역을 침범하는 버그입니다. 악의적으로 만들어진 이미지를 다시 저장하려고 하면 컴퓨터 프로그램이 멈추거나 해커가 명령을 실행할 위험이 있습니다.
🇺🇸 원문 (English)
Pillow is a Python imaging library. From 9.4.0 until 13.0.0, ImagingJpegEncode() in src/libImaging/JpegEncode.c can call jpeg_write_marker() for a JPEG COM comment when an ICC profile has exactly filled the 65536-byte encoder buffer. libjpeg writes one byte before checking the exhausted free_in_buffer counter, which then wraps and permits the attacker-controlled comment and subsequent compressed image data to overwrite adjacent heap memory. Re-saving an untrusted image as JPEG while preserving its ICC profile and forwarded comment can crash the process and may enable code execution in suitable runtime and heap layouts. This issue is fixed in version 13.0.0.
📍 영향받는 시스템
Pillow 9.4.0 버전부터 13.0.0 미만 버전
⚔️ 공격 벡터
조작된 ICC 프로필이 포함된 이미지를 Pillow를 사용하여 JPEG로 재저장할 때 발생
🛡️ 대응 방법
Pillow 라이브러리를 최신 버전인 13.0.0 이상으로 업데이트
🔧 검증 코드
출력된 버전이 9.4.0 이상 13.0.0 미만인지 확인
pip show Pillow | grep Version