FCKEditor编辑器安全配置

给那些被骇客通过编辑器的上传漏洞挂马和存在上传漏洞的程序员们.

如果你的网站使用了FckEditor编辑器还没有进行正确的配置是很容易被别人通过上传得到webshell,下面我就分享一下我在用Fckeditro时一点技巧.

环境:vs2005

首先在vs中配置Fckeditor编辑器。

关于Fckeditor下载后的文件请参考:

http://www.cnblogs.com/downmoon/archive/2008/05/23/1205784.html

在Fckeditor 2.6.3前的版本中 在 fckeditor"editor"filemanager"connectors"aspx"config.ascx 文件中的上传验证没有安全的验证就直接可上传,在后续的版本中修改这个地方,必须得用手动设置

private bool CheckAuthentication()

   {

      // WARNING : DO NOT simply return "true". By doing so, you are allowing

      // "anyone" to upload and list the files in your server. You must implement

      // some kind of session validation here. Even something very simple as...

      //

      //   return ( Session[ "IsAuthorized" ] != null && (bool)Session[ "IsAuthorized" ] == true );

      //

      // ... where Session[ "IsAuthorized" ] is set to "true" as soon as the

      // user logs in your system.

      return false;   <-- true

   }

返回值为true.

但是这样是不安全的。

参考http://www.cnblogs.com/downmoon/archive/2008/05/23/1205784.html

fckeditor 可以从地址栏直接输入漏洞地址还可上传文件。

解决方法很简单就是在用户登录时加入是否可上传文件的Session标志。其实Fckeditor已经写好了。直接把验证函数CheckAuthentication()中的注释段中

return ( Session[ "IsAuthorized" ] != null && (bool)Session[ "IsAuthorized" ] == true );

注释去掉。在登录成功加入Session[IsAuthorized] = true;就可以了。

如果网站没有用到上传到服务器的文件浏览的话把fckeditor"editor"filemanager 中的browser 目录也删除。

posted on 2009-01-03 11:59  live-evil  阅读(2808)  评论(0编辑  收藏  举报

导航