🇰🇷 한글 설명
Python용 SQL 파서인 sqlparse 0.6.0 미만 버전에서 중첩된 토큰 구조를 처리할 때 CPU 소비가 기하급수적으로 증가하는 취약점이 발견되었습니다. sqlparse.parse(), sqlparse.format(), sqlparse.split() 함수를 호출할 때 복잡한 SQL 문을 처리하면 시스템 자원을 과도하게 점유할 수 있습니다.
💡 쉬운 설명
특수하게 조작된 복잡한 SQL 문장을 입력하면 컴퓨터의 두뇌 역할을 하는 CPU가 과도하게 일을 하게 되어 시스템이 느려지거나 멈출 수 있습니다. 이는 마치 아주 복잡한 퍼즐을 풀 때 시간이 엄청나게 오래 걸려 컴퓨터가 마비되는 것과 같습니다.
🇺🇸 원문 (English)
sqlparse is a non-validating SQL parser module for Python. Prior to 0.6.0, TokenList construction and string conversion in sqlparse/sql.py repeatedly flatten nested token subtrees constructed by group_parenthesis and group_case, causing quadratic CPU consumption through sqlparse.parse(), sqlparse.format(), and sqlparse.split() before depth and token limits terminate processing. This issue is fixed in version 0.6.0.
📍 영향받는 시스템
sqlparse versions prior to 0.6.0
⚔️ 공격 벡터
악의적으로 조작된 중첩 구조를 가진 SQL 문장을 파싱 함수(parse, format, split)에 입력하여 CPU 자원 고갈 유도
🛡️ 대응 방법
sqlparse 라이브러리를 0.6.0 버전 이상으로 업데이트하십시오.
🔧 검증 코드
출력된 버전 번호가 0.6.0 미만이면 취약한 상태이며, 0.6.0 이상이면 안전합니다.
pip show sqlparse | grep Version