0x00简介
Apache Shiro是一个强大且易用的Java安全框架,执行身份验证、授权、密码和会话管理。使用Shiro的易于理解的API,您可以快速、轻松地获得任何应用程序,从最小的移动应用程序到最大的网络和企业应用程序。
image1.png0x01漏洞概述
Shiro框架通过拦截器功能来对用户访问权限进行控制,如anon, authc等拦截器。anon为匿名拦截器,不需要登录即可访问;authc为登录拦截器,需要登录才可以访问。主要是Spring web在匹配url的时候没有匹配上/导致绕过
0x02影响范围
Apache Shiro < 1.5.3
0x03环境搭建
1.下载实验代码,下载地址:
https://github.com/lenve/javaboy-code-samples/tree/master/shiro/shiro-basic
2.下载完成后将项目导入Java IDEA中,在pom.xml文件可以看到shiro的版本,把版本修改成1.4.2。(不修改也可)
image2.png3.打开maim目录下ShiroConfig.java文件,添加authc拦截器的拦截正则
map.put("/hello/*", "authc");
image3.png4. 打开LoginController.java文件,修改路由控制器方法,添加一个方法。
import org.springframework.web.bind.annotation.PathVariable;
@GetMapping("/hello/{currentPage}")
public String hello(@PathVariable Integer currentPage) {
return "hello";
}
image4.png image5.png5.启动应用点击右上角三角形,运行出现以下图片表示启动成功
image6.png0x04漏洞复现
1.在浏览器访问http://your-ip:8080/login,可以看到需要登录
image7.png2.打开Burp访问首页进行抓包,并将抓到的包送到Reapter模块
image8.png3.将url修改为/hello/1,<typo id="typo-906" data-origin="发包" ignoretag="true">发包</typo>,可以看到跳转到了登陆界面。
image9.png4.在url处/hello/1后面再加上一个反斜杠/hello/1/,访问成功
image10.png0x05修复建议
建议升级至最新版本
网友评论