🇰🇷 한글 설명
Soup Sieve 2.9 미만 버전의 CSS 선택자 파서에서 정규 표현식 엔진이 중첩된 그룹을 처리할 때 발생하는 ReDoS(정규 표현식 서비스 거부) 취약점입니다. 공격자가 제어 가능한 긴 식별자나 속성 값을 포함한 선택자를 입력할 경우, CPU 사용량이 기하급수적으로 증가하여 서비스가 중단될 수 있습니다. 이 문제는 BeautifulSoup 4와 함께 사용될 때 영향을 미치며, 2.9 버전에서 수정되었습니다.
💡 쉬운 설명
특수하게 조작된 웹 페이지 선택자 문구를 입력하면 컴퓨터가 이를 계산하느라 과도한 에너지를 쓰게 만들어 서비스를 멈추게 하는 공격입니다. 마치 복잡한 수학 문제를 풀다가 컴퓨터가 멈춰버리는 것과 비슷합니다.
🇺🇸 원문 (English)
Soup Sieve is a CSS selector library designed to be used with Beautiful Soup 4. Prior to 2.9, the selector parser in src/soupsieve/css_parser.py defines IDENTIFIER with adjacent quantified groups over overlapping character classes, and VALUE embeds IDENTIFIER for attribute selectors. When an attacker-controlled selector contains a long identifier or unquoted attribute-value run followed by input that makes the overall match fail, the regular expression engine explores quadratically many splits between the overlapping groups. User-controlled selectors can reach this path through soupsieve.compile(), soupsieve.select(), or BeautifulSoup.select(), while applications using only hard-coded selectors are unaffected. The resulting CPU consumption can hold the Python GIL, exhaust application workers, and stall a service; successful plain identifier matches are linear, and the issue does not cause memory corruption or code execution. The issue is fixed in version 2.9.
📍 영향받는 시스템
Soup Sieve 2.9 미만 버전 (BeautifulSoup 4와 함께 사용 시)
⚔️ 공격 벡터
사용자로부터 입력받은 CSS 선택자 값을 soupsieve.compile() 또는 BeautifulSoup.select() 등에 그대로 전달할 때 발생
🛡️ 대응 방법
Soup Sieve를 2.9 버전 이상으로 업데이트하십시오.
🔧 검증 코드
출력된 Version이 2.9 미만이면 취약한 상태이며, 2.9 이상이면 안전합니다.
pip show soupsieve 2>/dev/null | grep -E 'Version'