Apache Shiro 权限绕过漏洞 (Shiro-682)复现
环境搭建
下载代码
https://github.com/lenve/javaboy-code-samples/tree/master/shiro/shiro-basic
将上面地址里的tree/master换成trunk,然后用svn co检出
svn co https://github.com/lenve/javaboy-code-samples/trunk/shiro/shiro-basic

导入idea
修改pom.xml文件
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-web</artifactId>
<version>1.4.2</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-spring</artifactId>
<version>1.4.2</version>
</dependency>
修改shiroConfig.java

@Bean
ShiroFilterFactoryBean shiroFilterFactoryBean() {
ShiroFilterFactoryBean bean = new ShiroFilterFactoryBean();
...
...
//map.put("/*", "authc");
map.put("/hello/*", "authc");
bean.setFilterChainDefinitionMap(map);
return bean;
}
修改同目录下LoginController.java
@GetMapping("/hello/{currentPage}")
public String hello(@PathVariable Integer currentPage) {
return "hello";
}
启动web服务
检查
访问/hello/1接口,会跳转

访问/hello/1/,获取到了资源

参考文章
https://segmentfault.com/a/1190000019440231
https://blog.riskivy.com/shiro-%e6%9d%83%e9%99%90%e7%bb%95%e8%bf%87%e6%bc%8f%e6%b4%9e%e5%88%86%e6%9e%90%ef%bc%88cve-2020-1957%ef%bc%89/
本文档详细介绍了如何复现Apache Shiro的权限绕过漏洞(Shiro-682)。首先,通过下载并导入指定的代码库到IDEA中,然后更新Shiro的相关依赖到1.4.2版本。接着,修改Shiro的配置以限制对/hello/*的访问需要认证。在LoginController中调整了hello方法的访问路径。当尝试访问/hello/1时,系统会跳转进行认证,但访问/hello/1/却能绕过权限验证直接获取资源。这揭示了Shiro在特定路径处理上的安全问题。参考文章提供了更多关于该漏洞的分析和解决方案。
3463

被折叠的 条评论
为什么被折叠?



