🇰🇷 한글 설명
ModSecurity 3.0.5부터 3.0.17까지의 PCRE2 구현에서 @rxGlobal 연산자가 pcre2_match의 match-limit 오류를 정상적인 '불일치'로 처리하여, 공격자 입력으로 SecPcreMatchLimit이 소진되면 MSC_PCRE_LIMITS_EXCEEDED 관련 규칙이 실행되지 않아 차단되어야 할 요청이 통과될 수 있습니다. 이 문제는 3.0.17 버전에서 수정되었습니다.
💡 쉬운 설명
웹 방화벽이 너무 복잡한 검사 패턴을 처리하다 한계에 도달하면, 본래 막아야 할 요청을 안전한 요청으로 잘못 판단할 수 있는 문제입니다. 모든 요청을 우회할 수 있는 것은 아니며, 특정 규칙 구성에서만 영향을 줍니다.
🇺🇸 원문 (English)
ModSecurity is an open source, cross platform web application firewall (WAF) engine for Apache, IIS and Nginx. From 3.0.5 until 3.0.17, the PCRE2 implementation of @rxGlobal in src/utils/regex.cc converts pcre2_match match-limit errors into an ordinary no-match result instead of propagating a non-OK RegexResult. When attacker-controlled input exhausts SecPcreMatchLimit, rules that rely on MSC_PCRE_LIMITS_EXCEEDED or its TX compatibility indicator do not run, so a request that should be rejected can pass through the WAF. The issue affects PCRE2 deployments that use @rxGlobal with a limit-exhaustible expression and a compensating rule; it is not a universal WAF bypass. This issue is fixed in version 3.0.17.
📍 영향받는 시스템
ModSecurity 3.0.5 ~ 3.0.17 (PCRE2 사용, @rxGlobal과 제한 초과 가능한 정규식 및 보완 규칙을 사용하는 환경)
⚔️ 공격 벡터
공격자가 SecPcreMatchLimit을 초과시키는 입력을 전송해 제한 관련 보호 규칙이 실행되지 않도록 하여 악성 요청을 통과시킴
🛡️ 대응 방법
ModSecurity를 3.0.17 이상으로 업그레이드하고, 정규식 규칙을 검토하여 backtracking 부담을 줄이며, 제한 초과 시 차단하도록 규칙을 점검
🔧 검증 코드
출력된 버전이 3.0.5 이상 3.0.17 미만이면 취약 가능성이 있으며, 3.0.17 이상이면 수정된 버전입니다. 아무 결과도 없으면 ModSecurity가 설치되어 있지 않은 것입니다.
dpkg -l libmodsecurity3 2>/dev/null | grep -E 'libmodsecurity' ; modsecurity -v 2>/dev/null ; nginx -V 2>&1 | grep -i modsecurity