Logging Redactor 라이브러리 버전 0.0.6 이전
타입 오류를 이용한 공격
Logging Redactor 라이브러리를 버전 0.0.6 이상으로 업데이트합니다.
로컬 Python 환경에서 실행할 수 있는 코드입니다. Python과 pip가 설치되어 있어야 하며, 실행 전 Logging Redactor 라이브러리가 설치되어 있는지 확인해야 합니다. 코드를 실행하면 Logging Redactor 라이브러리의 버전을 확인하여 취약성 여부를 판단합니다.
import pkg_resources
try:
version = pkg_resources.get_distribution('logging-redactor').version
if version < '0.0.6':
print({"result": "취약", "reason": "Logging Redactor 라이브러리 버전이 0.0.6 미만입니다."})
else:
print({"result": "양호", "reason": "Logging Redactor 라이브러리 버전이 0.0.6 이상입니다."})
except pkg_resources.DistributionNotFound:
print({"result": "미설치", "reason": "Logging Redactor 라이브러리가 설치되어 있지 않습니다."})