← Java / Spring · Contents

JAVA-022 / Advanced

Spring MVC path bypass (semicolon, case and slash variants)

A01:2021 Broken Access Control · CWE-863 Incorrect Authorization

Why is this a problem?

Bypass occurs when the security filter sees the original path but the router processes a normalized path.

How to fix it

java
// Use the default Spring Security 6 MVC matcher and keep the version current
http.authorizeHttpRequests(a -> a.requestMatchers("/admin/**").hasRole("ADMIN"));

Further reading