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

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

缺陷编号:wooyun-2014-048960

漏洞标题:国内外多家vpn设备厂商批量漏洞(续集二)

相关厂商:众多vpn厂商

漏洞作者: felixk3y

提交时间:2014-01-15 10:43

修复时间:2014-04-15 10:44

公开时间:2014-04-15 10:44

漏洞类型:设计不当

危害等级:高

自评Rank:20

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

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

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

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

简要描述:

暂时不出续集三了,将发现的问题一起放出来...
经测试,此系列漏洞任然普遍存在,成功利用此系列漏洞有下列威胁
1.任意文件上传;
2.任意代码/命令执行;
3.任意文件下载/删除
4.严重敏感信息泄露
4.整个源代码泄露等等等...
倘若进一步利用,危害性将非常大。
同时该漏洞涉及到包括网御神州、天融信、西安网赢、卫士通、吉大正元、美国凹凸、德国 ANIX等多家VPN厂商设备在政务、地产、运营商、政府部门、高校、企业、公安、司法、银行等行业存在的任意文件下载、远程命令执行、维护后门、三方平台帐号泄漏、恶意客户端下发等高位漏洞。

详细说明:

#1 同样请先看

 WooYun: 国内外多家vpn设备厂商批量漏洞(续集一) 


在测试的过程中,我大概看了下源代码,于是就有了这个漏洞...
#2 系列漏洞---任意文件上传漏洞
先列举其一
/admin/system/cert_request_import_action.php 代码如下

<?
include_once "management/certificate.php";//此文件没有权限的验证,SO...
$MAX_SIZE= 2*1000*1000;
if ($_FILES['gw_cert']) {
$file_size = $_FILES['gw_cert']['size'];
$file_type = $_FILES['gw_cert']['type'];

$temp_name = $_FILES['gw_cert']['tmp_name'];
$gw_file_name = $_FILES['gw_cert']['name'];
$gw_file_name = str_replace("\\","",$gw_file_name);
$gw_file_name = str_replace("'","",$gw_file_name);
$gw_file_name = str_replace(" ","",$gw_file_name);
$file_path = $CFG_UPLOAD_PATH.$gw_file_name;
//File Name Check
if ( $gw_file_name == "" ) {
include "include/error.php";
return;
}
$gw_file_name = $file_path;
$result = move_uploaded_file($temp_name, $file_path);
chmod($file_path, $CFG_UPLOAD_MOD);
} else {
include "include/error.php";
return;
}
if ($_FILES['iss_cert']) {
$file_size = $_FILES['iss_cert']['size'];
$file_type = $_FILES['iss_cert']['type'];

$temp_name = $_FILES['iss_cert']['tmp_name'];
$iss_file_name = $_FILES['iss_cert']['name'];
$iss_file_name = str_replace("\\","",$iss_file_name);
$iss_file_name = str_replace("'","",$iss_file_name);
$iss_file_name = str_replace(" ","",$iss_file_name);
$file_path = $CFG_UPLOAD_PATH.$iss_file_name;
//File Name Check
if ( $iss_file_name == "" ) {
include "include/error.php";
return;
}
$iss_file_name = $file_path;
$result = move_uploaded_file($temp_name, $file_path);
chmod($file_path, 0777);
}
$CM = new CertificateManager;
if ($_FILES['iss_cert'])
$msg = $CM->Import_GW_CA_Cert($ticket, $gw_file_name, $iss_file_name);
else
$msg = $CM->Import_GW_CA_Cert($ticket, $gw_file_name, "");
$RURL = "?body=3";
$RURL1 = "?body=4";
if ($msg != "OK")
include "include/error.php";
else
echo "<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"0; URL=".$RURL."\">";
?>


我们来看下其上传的代码是怎样写的

if ($_FILES['gw_cert']) {
$file_size = $_FILES['gw_cert']['size'];
$file_type = $_FILES['gw_cert']['type'];

$temp_name = $_FILES['gw_cert']['tmp_name'];
$gw_file_name = $_FILES['gw_cert']['name'];
$gw_file_name = str_replace("\\","",$gw_file_name);
$gw_file_name = str_replace("'","",$gw_file_name);
$gw_file_name = str_replace(" ","",$gw_file_name);
$file_path = $CFG_UPLOAD_PATH.$gw_file_name;
//File Name Check
if ( $gw_file_name == "" ) {
include "include/error.php";
return;
}
$gw_file_name = $file_path;
$result = move_uploaded_file($temp_name, $file_path);
chmod($file_path, $CFG_UPLOAD_MOD);
} else {
include "include/error.php";
return;
}


看见了吧,只要稍有代码编写能力的人都可以看出来有问题,完全没有经过任何的安全检查便把文件写入的对方硬盘..对此我不想多说什么,更不想去做测试,因为那简直就是浪费时间..(我表示很无语啊,这样的代码写的东西至少我不敢用,你们敢吗?)
存在同样问题的地方还有如下文件:

/sub_ca_action.php
/admin/system/gw_cert_import_action.php
/admin/account/admin_add_action.php
/admin/account/group_batch_add_action.php
/admin/authentication/mini_ca_action.php
/admin/authentication/mini_ca_action.php
....


还有很多,还请都检查下...
#2 系列漏洞---任意文件下载/删除
问题出现在:/admin/system/backup_down.php 代码如下

<?
if (isset($_POST["file_name"]))
$file_name = "/data/upload/sysbackup_".$_POST["file_name"].".bin";
else {
header("Location: ../login.php");
return;
}
header("Pragma: ");
header("Cache-Control: ");
header("Content-type: application/octet-stream");
header("Content-Length: ".filesize($file_name));
header("Content-Disposition: attachment; filename=\"sysbackup.bin\"");
readfile($file_name);
@unlink($file_name);
?>


看见了吧,没有任何的权限验证,没有任何的安全检查...这个也不想多说,不测试,真的是浪费时间...
#2 系列漏洞---配置信息泄露
根目录下的 htdocs 中的文件

2014/01/09  16:40    <DIR>          .
2014/01/09 16:40 <DIR> ..
2014/01/07 14:00 3,550 httpd-mpm.conf.big
2014/01/07 14:00 3,550 httpd-mpm.conf.small
2014/01/07 14:00 3,089 httpd.conf
2014/01/07 14:00 3,148 httpd.conf-80
2014/01/07 14:00 2,183 index.php
5 个文件 15,520 字节
2 个目录 105,551,912,960 可用字节


能过Web可以访问,此处以httpd.conf为例:

1.jpg


ServerRoot "/usr"
Listen 127.0.0.1:1
#Listen 80
LoadModule auth_basic_module lib/httpd/modules/mod_auth_basic.so
LoadModule include_module lib/httpd/modules/mod_include.so
LoadModule env_module lib/httpd/modules/mod_env.so
LoadModule mime_magic_module lib/httpd/modules/mod_mime_magic.so
LoadModule expires_module lib/httpd/modules/mod_expires.so
LoadModule headers_module lib/httpd/modules/mod_headers.so
LoadModule setenvif_module lib/httpd/modules/mod_setenvif.so
LoadModule mime_module lib/httpd/modules/mod_mime.so
LoadModule autoindex_module lib/httpd/modules/mod_autoindex.so
LoadModule cgi_module lib/httpd/modules/mod_cgi.so
LoadModule vhost_alias_module lib/httpd/modules/mod_vhost_alias.so
LoadModule dir_module lib/httpd/modules/mod_dir.so
LoadModule actions_module lib/httpd/modules/mod_actions.so
LoadModule alias_module lib/httpd/modules/mod_alias.so
LoadModule rewrite_module lib/httpd/modules/mod_rewrite.so
User root
Group root
ServerAdmin cheng.zhang@o2micro.com
#ServerName www.example.com:80
ServerName 127.0.0.1
DocumentRoot "/ssl/www"
<Directory />
Options FollowSymLinks ExecCGI
AllowOverride None
# Order deny,allow
# Deny from all
</Directory>
<Directory "/ssl/www">
Options -Indexes FollowSymLinks MultiViews ExecCGI
AllowOverride None
</Directory>
<IfModule dir_module>
DirectoryIndex index.html index.php login.php
</IfModule>
ErrorLog /dev/null
#ErrorLog /var/log/httpd/error_log
#LogLevel warn
DefaultType text/plain
<IfModule mime_module>
TypesConfig /etc/httpd/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddHandler cgi-script .cgi
</IfModule>
#MIMEMagicFile /etc/httpd/magic
# Server-pool management (MPM specific)
Include /etc/httpd/extra/httpd-mpm.conf
# Multi-language error messages
#Include /etc/httpd/extra/httpd-multilang-errordoc.conf
# Fancy directory listings
#Include /etc/httpd/extra/httpd-autoindex.conf
# Language settings
#Include /etc/httpd/extra/httpd-languages.conf
# User home directories
#Include /etc/httpd/extra/httpd-userdir.conf
# Real-time info on requests and configuration
#Include /etc/httpd/extra/httpd-info.conf
# Virtual hosts
#Include /etc/httpd/extra/httpd-vhosts.conf
# Local access to the Apache HTTP Server Manual
#Include /etc/httpd/extra/httpd-manual.conf
# Distributed authoring and versioning (WebDAV)
#Include /etc/httpd/extra/httpd-dav.conf
# Various default settings
Include /etc/httpd/extra/httpd-default.conf
# Override the setting in httpd-default.conf
KeepAlive Off
ServerSignature Off
ServerTokens Prod
Timeout 180
# Uncomment the following line to enable PHP:
#
Include /etc/httpd/mod_php.conf
<VirtualHost 127.0.0.1:1>
ServerName 127.0.0.1
DocumentRoot "/ssl/www"
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* -[F]
RewriteRule ^/admin$ /admin/ [R]
</VirtualHost>
#<VirtualHost _default_:80>
# ServerName 127.0.0.1
# DocumentRoot "/ssl/www/htdocs"
# Alias /admin/ "/ssl/www/htdocs/"
# RewriteEngine on
# RewriteRule ^/admin$ /admin/ [R]
#</VirtualHost>

漏洞证明:

#4 系列漏洞---源代码泄露
在整个系统中,有很多的重要php文件,配置文件以.inc的文件格式存放,恰巧,几乎所有的站点都没有对其进行安全处理,造成了严重的安全漏洞
例如:
/filepass/ 目录下的filepass_helper.inc
/filepass/ftp/目录下的ftp_cmd.inc ftp_user.inc

2014/01/07  14:00             6,585 ftp_cmd.inc
2014/01/07 14:00 3,531 ftp_***.php
2014/01/07 14:00 4,358 ftp_***.php
2014/01/07 14:00 702 ftp_***.php
2014/01/07 14:00 21,572 ftp_helper.inc
2014/01/07 14:00 4,653 ftp_***.php
2014/01/07 14:00 10,056 ftp_***.php
2014/01/07 14:00 11,489 ftp_screen_pda.php
2014/01/07 14:00 3,031 ftp_***.php
2014/01/07 14:00 11,703 ftp_user.inc


/filepass/share/目录下的share_user.inc等
2014/01/07 14:03 <DIR> conf
2014/01/07 14:00 4,173 share_***.php
2014/01/07 14:00 8,898 share_***.php
2014/01/07 14:00 711 share_***.php
2014/01/07 14:00 16,977 share_helper.inc
2014/01/07 14:00 3,960 share_***.php
2014/01/07 14:00 9,383 share_***.php
2014/01/07 14:00 11,620 share_***.php
2014/01/07 14:00 19,769 share_***.php
2014/01/07 14:00 3,162 share_***.php
2014/01/07 14:00 13,136 share_user.inc
其他的差不多都忘了...
还有很多都请好好检查下,下面给一个例子,请看.
https://vpn.mcut.edu.tw//filepass/ftp/ftp_user.inc

2.jpg


https://vpn.mcut.edu.tw//filepass/share/share_user.inc

3.jpg


好了,暂时就到这里,不继续深入了
对了,我想问一下,用该VPN系统的用户有Windwos环境搭建的吗?

修复方案:

你们懂.

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


漏洞回应

厂商回应:

危害等级:高

漏洞Rank:20

确认时间:2014-01-20 09:43

厂商回复:

cnvd确认并复现所述情况,已经分别根据测试用例按厂商整理通报,拟联系软件生产厂商处置,由于存在代码同源情况,对于oem源暂不认定。同时对电信,教育,政府部门案例进行分类整理,拟分别通报基础电信企业,教育网应急组织和下发各分中心处置。
rank 40+

最新状态:

暂无