🔍 CVE-2026-54621

7.8
CVSS Score
HIGH
2026-07-28
2026-10-23 23:10
✅ 완료

🇰🇷 한글 설명

datamodel-code-generator 0.60.1 미만 버전에서 GraphQL Union 설명 값이 Python 주석으로 렌더링될 때 줄바꿈 문자가 중화되지 않는 취약점이 발견되었습니다. 공격자가 제어하는 GraphQL 스키마 내용을 통해 생성된 Python 모델에 악성 코드를 주입할 수 있으며, 해당 모델을 임포트할 때 코드가 실행됩니다.

💡 쉬운 설명

데이터 모델을 자동으로 만들어주는 프로그램이 입력된 내용을 검사하지 않아, 악성 코드가 포함된 데이터를 넣으면 프로그램이 실행될 때 해킹 코드가 작동할 수 있습니다. 마치 메모장에 적힌 글을 실행 가능한 명령어로 착각하여 실행해버리는 것과 같습니다.

🇺🇸 원문 (English)

datamodel-code-generator generates Python data models from schema definitions. Prior to 0.60.1, GraphQL Union description values in src/datamodel_code_generator/model/template/UnionTypeStatement.jinja2 and src/datamodel_code_generator/model/template/UnionTypeStatement.py312.jinja2 are rendered into Python comments without neutralizing carriage returns in Python # comments, allowing attacker-controlled GraphQL schema content to inject Python code into generated models that runs when imported. This issue is fixed in version 0.60.1.

📍 영향받는 시스템

datamodel-code-generator version < 0.60.1

⚔️ 공격 벡터

악의적으로 조작된 GraphQL 스키마를 사용하여 생성된 Python 파일 내에 주석을 탈출하는 코드를 주입

🛡️ 대응 방법

datamodel-code-generator를 0.60.1 버전 이상으로 업데이트

🔧 검증 코드

출력된 버전 번호가 0.60.1보다 낮으면 취약한 상태입니다.

Shell / Script
pip show datamodel-code-generator 2>/dev/null | grep Version

📊 CVSS Vector String

CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

💻 영향받는 소프트웨어

Python