标签:
catalog
1. 漏洞描述 2. 漏洞触发条件 3. 漏洞影响范围 4. 漏洞代码分析 5. 防御方法 6. 攻防思考
1. 漏洞描述
ECSHOP支付插件存在SQL注入漏洞,此漏洞存在于/includes/modules/payment/alipay.php文件中,该文件是ECshop的支付宝插件。由于ECShop使用了str_replace函数做字符串替换,黑客可绕过单引号限制构造SQL注入语句。只要开启支付宝支付插件就能利用该漏洞获取网站数据,且不需要注册登入。GBK与UTF-8版本ECshop均存在此漏洞
Relevant Link:
http://sebug.net/vuldb/ssvid-60643
2. 漏洞触发条件
3. 漏洞影响范围
4. 漏洞代码分析
/includes/modules/payment/alipay.php
function respond() { if (!empty($_POST)) { foreach($_POST as $key => $data) { $_GET[$key] = $data; } } $payment = get_payment($_GET[‘code‘]); $seller_email = rawurldecode($_GET[‘seller_email‘]); $order_sn = str_replace($_GET[‘subject‘], ‘‘, $_GET[‘out_trade_no‘]); //未对$order_sn进行有效注入过滤 $order_sn = trim($order_sn); ..
ECShop在/includes/init.php中有段代码会将外界传入的数据进行转义,比如单引号;同样在/includes/modules/payment/alipay.php中外界传入的$_GET[‘subject‘]和$_GET[‘out_trade_no‘]也是被转义过的,但是在该文件的str_replace()函数会将$_GET[‘out_trade_no‘]中的$_GET[‘subject‘]过滤掉(黑客输入转义符号,将转义符本身过滤叼),最后经过str_replace()函数处理后引入单引号,使闭合单引号重新获得攻击能力,触发SQL注入
Relevant Link:
http://sebug.net/vuldb/ssvid-61150
5. 防御方法
/includes/modules/payment/alipay.php
function respond() { if (!empty($_POST)) { foreach($_POST as $key => $data) { $_GET[$key] = $data; } } $payment = get_payment($_GET[‘code‘]); $seller_email = rawurldecode($_GET[‘seller_email‘]); $order_sn = str_replace($_GET[‘subject‘], ‘‘, $_GET[‘out_trade_no‘]); /* 对$order_sn进行有效过滤 */ $order_sn = trim(addslashes($order_sn)); /* */ ..
Relevant Link:
http://bbs.ecshop.com/viewthread.php?tid=1125380&extra=page=1&orderby=replies&filter=172800
6. 攻防思考
Copyright (c) 2015 LittleHann All rights reserved
ecshop /includes/modules/payment/alipay.php SQL Injection Vul
标签:
原文地址:http://www.cnblogs.com/LittleHann/p/4523829.html