天天看點

kindeditor上傳漏洞複現(CVE-2017-1002024)

漏洞簡介

漏洞編号:

CVE-2017-1002024

漏洞詳情:

KindEditor是一套開源的HTML可視化編輯器,主要用于讓使用者在網站上獲得所見即所得編輯效果,在于小于等于kindeditor4.1.11 編輯器裡,可以上傳.txt和.html檔案,支援php/asp/jsp/asp.net。

漏洞影響範圍:

kindeditor<=4.1.11

漏洞原理:

upload_json.*中代碼并沒有對使用者上傳的檔案格式,以及大小進行安全檢測,導緻使用者可以僞造惡意檔案進行上傳,尤其html檔案可以直接上傳到網站的目錄下,直接讓搜尋引擎抓取并收錄,利用這個漏洞,黑産等其它攻擊者可以上傳HTML黑頁釣魚以及嵌套xss等危害。

漏洞複現

環境搭建:

我這裡用phpstudy直接搭建本地環境進行測試。

1.下載下傳https://github.com/kindsoft/kindeditor源碼後直接解壓到網站根目錄即可,然後修改kindeditor-all.js為kindeditor.js。

2.在kindeditor檔案夾下建立attached檔案夾,用于儲存上傳檔案。

3.浏覽器本地通路127.0.0.1/kindeditor/php/demo.php,出現以下界面即漏洞環境搭建成功。

kindeditor上傳漏洞複現(CVE-2017-1002024)

漏洞驗證:

1.點選上傳點,選擇php檔案測試上傳。

kindeditor上傳漏洞複現(CVE-2017-1002024)

2.上傳檔案并抓包,發送到repeater檢視傳回包,裡面包含可上傳檔案類型,看到其中包括html也在允許範圍内,是以我們可以上傳html頁面到伺服器。

kindeditor上傳漏洞複現(CVE-2017-1002024)

3.建立a.html頁面,内容随意

kindeditor上傳漏洞複現(CVE-2017-1002024)

4.我這裡直接利用curl指令行上傳a.html頁面,傳回上傳後的位址

curl -F"[email protected]" http://127.0.0.1/kindeditor/php/upload_json.php?dir=file
           
kindeditor上傳漏洞複現(CVE-2017-1002024)

5.通路上傳的頁面

kindeditor上傳漏洞複現(CVE-2017-1002024)

複現完成。

漏洞修複意見:

1.删除Kindeditor對應檔案夾下删除upload_json.* 和file_manager_json.*

2.禁止上傳htm,html檔案等。

繼續閱讀