CVE-2022-22978-demo CVE-2022-22978漏洞示例代码 利用条件 虽然定为高危,但是利用条件还是比较苛刻的,个人感觉这个漏洞比较鸡肋。 1. 首先肯定是spring-security在漏洞影响范围内 2. 其次需要使用spring-security的正则匹配器regexMatchers或者直接使用RegexRequestMatcher,并且使用了. 匹配路径,类似这样: – regexMatcher("/api/.") // 允许/api下的所有子路径 – regexMatcher("/files/..jpg") // 匹配所有.jpg结尾的文件请求 – regexMatcher("/user/./profile") // 允许/user下任意用户名的profile路径 4. 实际上这种情况很少见,比如regexMatcher("/api/."),有这样的路径,那么还需要一个有类似@RequestMapping("/api/*")注解的controller,用户处理/api下的所有路径的请求。否则即使用%0a%0d绕过了spring-security的路径匹配规则,但是却会报404错误。 利用演示 正常访问所有路径,都会跳转到spring-security提供的默认登录页面。 访问:https://127.0.0.1:8080/admin/admin%0a,成功绕过登录 访问:https://127.0.0.1:8080/hello%0a…Read More
References
Back to Main