🇰🇷 한글 설명
RestrictedPython 8.4 미만 버전에서 커스텀 임포트 정책이나 globals를 통해 string 모듈 또는 Formatter 클래스가 노출될 경우 샌드박스 탈출이 가능합니다. string.Formatter의 내부 메서드들이 RestrictedPython의 안전한 속성 접근 보호를 우회하여 파일 접근이나 코드 실행을 허용할 수 있습니다. 이 취약점은 버전 8.4에서 수정되었습니다.
💡 쉬운 설명
제한된 환경에서 파이썬 코드를 실행할 때, 보안 장치를 우회하여 컴퓨터의 중요한 파일에 접근하거나 해킹 명령을 실행할 수 있는 결함입니다. 문자열을 다루는 특정 도구가 보안 검사를 건너뛰는 점을 악용합니다.
🇺🇸 원문 (English)
RestrictedPython is a tool that helps define a subset of the Python language for accepting program input in a trusted environment. Prior to 8.4, RestrictedPython could allow a sandbox escape when a custom import policy or globals exposed the standard library string module, the string.Formatter class, a Formatter instance, or a Formatter subclass to restricted code. The string.Formatter methods format, get_field, get_value, and vformat performed attribute and item traversal internally without passing through RestrictedPython's safer_getattr protections. Restricted code could use those live object references to reach function globals, builtins, file access, or code execution primitives, affecting confidentiality, integrity, and availability in the host environment. This issue is fixed in version 8.4.
📍 영향받는 시스템
RestrictedPython 버전 8.4 미만
⚔️ 공격 벡터
노출된 string.Formatter 객체를 이용한 속성 및 아이템 탐색을 통한 샌드박스 탈출
🛡️ 대응 방법
RestrictedPython을 최신 버전인 8.4 이상으로 업데이트하십시오.
🔧 검증 코드
출력된 버전 번호가 8.4 미만이면 취약한 상태이며, 8.4 이상이면 안전합니다.
pip show RestrictedPython 2>/dev/null | grep Version