🇰🇷 한글 설명
Python tarfile 모듈의 추출 필터 우회 취약점으로, TarFile.extractall() 또는 TarFile.extract()에서 filter="data" 또는 filter="tar" 사용 시 신뢰할 수 없는 tar 아카이브의 심볼릭 링크가 대상 디렉토리 외부를 가리켜 임의 파일 접근 및 메타데이터 수정이 가능합니다. Python 3.14부터 기본 필터값이 변경되어 영향 범위가 확대되었습니다.
💡 쉬운 설명
Python의 압축 파일 처리 함수가 악의적인 tar 파일을 안전하게 처리하지 못해 컴퓨터의 중요한 파일을 손상시킬 수 있습니다. 신뢰하지 못하는 출처의 압축 파일을 처리할 때 특히 위험합니다.
🇺🇸 원문 (English)
Allows the extraction filter to be ignored, allowing symlink targets to point outside the destination directory, and the modification of some file metadata.
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.
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.14 이전 버전의 tarfile 모듈 사용 시 (filter="data", filter="tar" 또는 기본값 사용)
⚔️ 공격 벡터
악의적인 tar 아카이브를 추출할 때 심볼릭 링크를 통해 대상 디렉토리 외부의 파일 시스템 접근 및 수정
🛡️ 대응 방법
Python 3.14 이상으로 업그레이드하거나 TarFile 추출 시 filter 파라미터를 명시적으로 안전한 값으로 설정(filter='data' 사용 금지, tarfile.fully_trusted_filter() 사용 금지)
🔧 검증 코드
Python 3.14 미만이 출력되고 코드에서 취약한 필터 파라미터 사용이 검출되면 즉시 수정 필요
python3 -c "import sys; import tarfile; print('Vulnerable' if sys.version_info < (3, 14) else 'Check code')" && grep -r 'extractall\|extract' . --include='*.py' 2>/dev/null | grep -E 'filter=\"(data|tar)\"'