🇰🇷 한글 설명
Spring Security의 특정 버전에서 requestMatchers(String)를 사용할 때 권한 설정 오류가 발생할 수 있는 취약점입니다. Spring MVC의 DispatcherServlet 외에 다른 서블릿을 함께 사용하면서 문자열 기반 매칭을 사용할 경우 보안 규칙이 의도치 않게 우회될 수 있습니다.
💡 쉬운 설명
웹사이트의 보안 규칙을 설정할 때 주소를 글자 그대로만 비교하다 보니, 공격자가 주소를 살짝 바꿔서 보안 검사를 피해 들어올 수 있는 문제입니다. 여러 개의 통로(서블릿)가 있는 환경에서 특히 위험합니다.
🇺🇸 원문 (English)
Spring Security versions 5.8 prior to 5.8.5, 6.0 prior to 6.0.5, and 6.1 prior to 6.1.2 could be susceptible to authorization rule misconfiguration if the application uses requestMatchers(String) and multiple servlets, one of them being Spring MVC’s DispatcherServlet. (DispatcherServlet is a Spring MVC component that maps HTTP endpoints to methods on @Controller-annotated classes.)
Specifically, an application is vulnerable when all of the following are true:
* Spring MVC is on the classpath
* Spring Security is securing more than one servlet in a single application (one of them being Spring MVC’s DispatcherServlet)
* The application uses requestMatchers(String) to refer to endpoints that are not Spring MVC endpoints
An application is not vulnerable if any of the following is true:
* The application does not have Spring MVC on the classpath
* The application secures no servlets other than Spring MVC’s DispatcherServlet
* The application uses requestMatchers(String) only for Spring MVC endpoints
📍 영향받는 시스템
Spring Security 5.8.x (< 5.8.5), 6.0.x (< 6.0.5), 6.1.x (< 6.1.2)
⚔️ 공격 벡터
Spring MVC와 다른 서블릿이 공존하는 환경에서 requestMatchers(String)를 이용해 보안 규칙을 우회하는 경로로 접근
🛡️ 대응 방법
Spring Security를 최신 패치 버전(5.8.5, 6.0.5, 6.1.2 이상)으로 업데이트하거나 requestMatchers에 문자열 대신 AntPathRequestMatcher 등을 명시적으로 사용
🔧 검증 코드
출력된 결과에서 spring-security 관련 라이브러리의 버전이 취약한 버전 범위에 포함되는지 확인
mvn dependency:tree | grep -E 'spring-security-core|spring-security-web'