Cacti rra_id参数SQL注入漏洞
发布日期:2010-05-13
更新日期:2010-05-14
受影响系统:Cacti Cacti <= 0.8.7e
描述:
BUGTRAQ ID:
40149
CVE ID:
CVE-2010-2092
Cacti是一款轮循数据库(RRD)工具,可帮助从数据库信息创建图形,有多个Linux版本。
Cacti的graph.php脚本存在SQL注入漏洞:
case 'zoom':
/* find the maximum time span a graph can show */
$max_timespan=1;
if (sizeof($rras) > 0) {
foreach ($rras as $rra) {
if ($rra["steps"] * $rra["rows"] * $rra["rrd_step"] > $max_timespan) {
$max_timespan = $rra["steps"] * $rra["rows"] * $rra["rrd_step"];
}
}
}
/* fetch information for the current RRA */
$rra = db_fetch_row("select id,timespan,steps,name from rra where id=" . $_GET["rra_id"]);
$_GET['rra_id']变量直接注入到了SQL查询中,通常这会导致SQL注入漏洞。但考虑到之前的代码段会执行某些过滤:
/* ================= input validation ================= */
input_validate_input_regex(get_request_var_request("rra_id"), "^([0-9]+|all)$");
input_validate_input_number(get_request_var("local_graph_id"));
input_validate_input_regex(get_request_var_request("view_type"), "^([a-zA-Z0-9]+)$");
/* ==================================================== */
在get_request_var_request()函数中:
function get_request_var_request($name, $default = "")
{
if (isset($_REQUEST[$name]))
{
return $_REQUEST[$name];
} else
{
return $default;
}
}
所过滤的值是从$_REQUEST['rra_id']获得的,如果没有相同名称的POST或COOKIE变量的话$_REQUEST['rra_id']仅会包含有与$_GET['rra_id']相同的值。也就是攻击者只需通过rra_id URL变量提交SQL负载并通过POST或COOKIE发送无害的rra_id变量就可以执行SQL注入攻击。
<*来源:Stefan Esser (
s.esser@ematters.de)
链接:
http://www.php-security.org/2010/05/13/mops-2010-023-cacti-graph-viewer-sql-injection-vulnerability/index.html
*>
建议:
厂商补丁:
Cacti
-----
目前厂商还没有提供补丁或者升级程序,我们建议使用此软件的用户随时关注厂商的主页以获取最新版本:
http://cacti.net/浏览次数:2221
严重程度:0(网友投票)