VulnHub学习:InfoSecWarrior CTF 202
前言
本次靶机学习的要点: 发现奇怪点、提权
靶机地址:https://www.vulnhub.com/entry/infosecwarrior-ctf-2020-01,446/
环境:VMware15(NAT模式)、Linux kali 5.2.0-kali2-amd64
工具:netdiscover、nmap、dirsearch.py、Burp Suite、ssh、https://gtfobins.github.io/(Unix提权姿势的一个列表)
信息收集
使用netdiscover扫描虚拟机的网段
netdiscover -r 192.168.136.0/24

根据扫描结果可以知道本次靶机ip为192.168.136.133
使用nmap扫描靶机信息
nmap -sV -A 192.168.136.133

根据扫描结果可以得知靶机开放了80端口和22端口
使用dirsearch.py扫描目录
python3 dirsearch.py -u 192.168.136.133 -e*

分析
访问192.168.136.133

发现只是一个Apache的安装完后的测试页面
试着访问192.168.136.133/sitemap.xml

发现 index.htnl这个特殊页面,而一般都是index.html,所以试着访问192.168.136.133/index.htnl。

按下F12进入开发者模式,可以看到

页面隐藏了一张图片和一张表单,修改hidden属性,让其显示出来并隐藏上面那张图片

在开发者模式下看到action="/cmd.php",于是输入ls,并用Burp Suite截获,得到返回信息。

因为原本是GET请求,所以用Burp Suite转成POST请求并发送



查看cmd.php

发现了一个账户和密码
$user="isw0";
$pass="123456789blabla";
使用ssh连接,并查看权限

提权
考虑suid提权,于是输入
sudo -l

查询https://gtfobins.github.io
尝试使用rpm进行提权
sudo rpm --eval '%{lua:os.execute("/bin/sh")}'

发现提权成功,查询flag位置,并获取flag

fc9c6eb6265921315e7c70aebd22af7e
总结
该靶机的关键点在于index.htnl页面的发现,和提权的操作。
https://gtfobins.github.io该网站收录了很多unix的攻击姿势,如果打不开网页的话,可以去github上下载源码查看相关信息。