DC8 WalkThrough

DC8-WalkThrough


免责声明

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


靶机地址

  • https://www.vulnhub.com/entry/dc-8,367/

Description

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

This challenge is a bit of a hybrid between being an actual challenge, and being a "proof of concept" as to whether two-factor authentication installed and configured on Linux can prevent the Linux server from being exploited.

The "proof of concept" portion of this challenge eventuated as a result of a question being asked about two-factor authentication and Linux on Twitter, and also due to a suggestion by @theart42.

The ultimate goal of this challenge is to bypass two-factor authentication, get root and to read the one and only flag.

You probably wouldn't even know that two-factor authentication was installed and configured unless you attempt to login via SSH, but it's definitely there and doing it's job.

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.

知识点

  • exim4 提权

实验环境

环境仅供参考

  • VMware® Workstation 15 Pro - 15.0.0 build-10134415

  • kali : NAT 模式,192.168.141.134

  • 靶机 : NAT 模式


前期-信息收集

开始进行 IP 探活

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

扫描开放端口

开放了 SSH 和 WEB 服务,从 WEB 开始,发现是个 Drupal 7,想到 DC1 的几个漏洞,尝试一下


中期-漏洞利用

都不行,还有一个 CVE-2018-7602 需要认证,就先 pass

点击左侧链接,出现 nid 参数,这个参数貌似可以注入

SQLMAP 走起

用 hashcat 跑一下

只跑出 john 的密码 turtle,那先用这个账号登录

回过头去测 CVE-2018-7602 也是一个方法,不过公开的 poc 利用于 Drupal 8,7当然也是受影响的,你可以尝试修改 poc

在爆破的时候顺带扫一下目录,发现有个登录点 http://192.168.141.141/user

登录后发现有一处直接执行 php 代码的地方

是个表单设置,可能要用 Contact us 触发

和 DC7 一样的 PHP 反向 shell 代码

!!!注意: 一定要在 php 代码最前面加一些字符,大坑,搞了好久才发现!!!

kali 监听


后期-提权

找找可以提权的东西2

挨个找过去,在 exim4 里发现几个漏洞

DOS 和命令执行先 pass,测一下提权 https://www.exploit-db.com/exploits/46996

将 poc 保存到 tmp 目录下

耐心等待

这个时候再用 kali 新建一个 bind shell 连接

提权成功,感谢靶机作者 @DCUA7


补充

php 反弹 shell 那一步除了网上找到的 php 源码外,还可以直接回弹个 meterpreter shell,一条命令生成