🇰🇷 한글 설명
Python의 tarfile 모듈에서 TarFile.extractall() 또는 TarFile.extract()를 사용할 때 filter 파라미터가 'data' 또는 'tar'로 설정되면, 신뢰할 수 없는 tar 아카이브로부터 추출 디렉토리 외부의 파일 메타데이터(수정 시간) 또는 파일 권한을 변경할 수 있습니다. Python 3.12 이상에서만 영향을 받으며, 3.14부터는 기본 필터값이 변경되어 더 많은 코드가 영향을 받을 수 있습니다.
💡 쉬운 설명
tar 파일을 풀 때 특정 설정으로 풀면 원래 풀려던 폴더 밖의 파일들의 권한이나 수정 시간을 바꿀 수 있습니다. 악의적인 tar 파일이 이를 이용해 시스템의 중요 파일을 변조할 위험이 있습니다.
🇺🇸 원문 (English)
Allows modifying some file metadata (e.g. last modified) with filter="data" or file permissions (chmod) with filter="tar" of files outside the extraction directory.
You are affected by this vulnerability if using the tarfile module to extract untrusted tar archives using TarFile.extractall() or TarFile.extract() using the filter= parameter with a value of "data" or "tar". See the tarfile extraction filters documentation https://docs.python.org/3/library/tarfile.html#tarfile-extraction-filter for more information. Only Python versions 3.12 or later are affected by these vulnerabilities, earlier versions don't include the extraction filter feature.
Note that for Python 3.14 or later the default value of filter= changed from "no filtering" to `"data", so if you are relying on this new default behavior then your usage is also affected.
Note that none of these vulnerabilities significantly affect the installation of source distributions which are tar archives as source distributions already allow arbitrary code execution during the build process. However when evaluating source distributions it's important to avoid installing source distributions with suspicious links.
📍 영향받는 시스템
Python 3.12 이상 (특히 3.14에서는 기본값이 변경되어 더 많은 코드가 영향을 받을 수 있음)
⚔️ 공격 벡터
악의적으로 구성된 tar 아카이브를 TarFile.extract(filter='data' 또는 'tar') 또는 extractall() 메서드로 추출할 때 권한 및 메타데이터 조작
🛡️ 대응 방법
Python을 최신 패치 버전으로 업그레이드하고, tar 추출 시 항상 안전한 필터('data' 대신 'tar' 또는 명시적 화이트리스트)를 사용하며 신뢰할 수 있는 출처의 tar 파일만 추출합니다.
🔧 검증 코드
Python 3.12 이상 버전이 출력되면 해당 시스템은 CVE-2024-12718에 영향을 받을 수 있으므로 패치 적용이 필요합니다.
python3 --version 2>&1 | grep -E '3\.(1[2-9]|[2-9][0-9])'