🇰🇷 한글 설명
Keras의 Model.load_model 메서드에서 safe_mode=True 설정이 되어 있더라도 임의 코드가 실행될 수 있는 취약점이 발견되었습니다. 공격자가 특수하게 조작된 .keras 아카이브를 생성하여 config.json을 통해 안전 모드를 비활성화한 뒤, Lambda 레이어의 피클링 기능을 이용해 악성 코드를 실행할 수 있습니다.
💡 쉬운 설명
신뢰할 수 없는 인공지능 모델 파일을 불러올 때, 파일 안에 숨겨진 악성 명령어가 컴퓨터에서 자동으로 실행될 수 있는 문제입니다. 보안 설정이 켜져 있어도 공격자가 이를 우회하여 해킹할 수 있는 위험이 있습니다.
🇺🇸 원문 (English)
The Keras Model.load_model method can be exploited to achieve arbitrary code execution, even with safe_mode=True.
One can create a specially crafted .keras model archive that, when loaded via Model.load_model, will trigger arbitrary code to be executed. This is achieved by crafting a special config.json (a file within the .keras archive) that will invoke keras.config.enable_unsafe_deserialization() to disable safe mode. Once safe mode is disable, one can use the Lambda layer feature of keras, which allows arbitrary Python code in the form of pickled code. Both can appear in the same archive. Simply the keras.config.enable_unsafe_deserialization() needs to appear first in the archive and the Lambda with arbitrary code needs to be second.
📍 영향받는 시스템
Keras 라이브러리 (Model.load_model 메서드를 사용하는 환경)
⚔️ 공격 벡터
조작된 config.json과 Lambda 레이어가 포함된 .keras 모델 파일을 로드하여 실행
🛡️ 대응 방법
Keras 라이브러리를 최신 보안 패치 버전으로 업데이트하고, 출처가 불분명한 .keras 모델 파일의 로드를 금지함
🔧 검증 코드
출력된 Keras 버전을 확인하여 해당 취약점이 해결된 최신 버전인지 확인합니다.
pip show keras | grep -E 'Version'