🇰🇷 한글 설명
datamodel-code-generator 0.51.0부터 0.60.2 버전 사이에서 x-python-type 값이 충분한 검증 없이 생성된 필드 어노테이션에 삽입되는 취약점이 발견되었습니다. 공격자가 조작된 JSON Schema를 제공할 경우, 생성된 모듈을 임포트하는 과정에서 임의의 파이썬 코드가 실행될 수 있습니다.
💡 쉬운 설명
데이터 형식을 만들어주는 프로그램이 나쁜 의도가 담긴 설계도를 읽을 때, 그 안에 숨겨진 악성 명령어를 그대로 실행해버리는 문제입니다. 이로 인해 해커가 사용자의 컴퓨터에서 몰래 코드를 실행할 수 있습니다.
🇺🇸 원문 (English)
datamodel-code-generator generates Python data models from schema definitions. From 0.51.0 until 0.60.2, x-python-type values parsed by src/datamodel_code_generator/parser/jsonschema.py in _get_python_type_override are inserted into generated field annotations without sufficient validation, allowing attacker-controlled JSON Schema content to execute Python code when the generated module is imported. This issue is fixed in version 0.60.2.
📍 영향받는 시스템
datamodel-code-generator version 0.51.0 ~ 0.60.2
⚔️ 공격 벡터
악의적으로 조작된 x-python-type 값이 포함된 JSON Schema를 사용하여 파이썬 코드를 주입하고 생성된 파일을 실행함
🛡️ 대응 방법
datamodel-code-generator를 0.60.2 이상의 최신 버전으로 업데이트하십시오.
🔧 검증 코드
출력된 버전이 0.60.2 미만(0.51.0 ~ 0.60.1)이면 취약한 상태입니다.
pip show datamodel-code-generator | grep Version