정규 표현식 서비스 거부 공격
Regular Expression Denial of Service (ReDoS)
설명
잠재적 영향
해결 방법
취약한 코드 및 안전한 코드 예시
Unsafe Regular Expression code & Safe Regular Expression code
# Unsafe Regular Expression code
import re
pattern = re.compile(r'(a+)+$')
test_string = 'a' * 10000 + '!'
if pattern.match(test_string):
print("Match found")
else:
print("No match")참조
Last updated