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

Zen Cart File Disclosure

Zen Cart File Disclosure
Posted Dec 10, 2009
Authored by Bogdan Calin | Site acunetix.com

Zen Cart suffers from a remote file disclosure vulnerability.

tags | exploit, remote, info disclosure
SHA-256 | 2d9cc7eb47dc4b8bd62a001d34062586144ec14593754e16da1fc61be7cf1203

Zen Cart File Disclosure

Change Mirror Download
Usually, curl is used to connect and retrieve data from a remote URL
using the http protocol. However, curl supports a bunch of protocols.
One of these protocols is the file protocol. Using this protocol you can
read local files by using an URL like file:///etc/passwd. Therefore, if
the user can control the URL passed to curl_exec, in some cases (if the
content is echoed back) he can read local files.

While testing our AcuSensor technology on different applications, I’ve
found a real-life example of a vulnerable application. I’m talking
about Zen Cart.

Zen Cart is an open source online store management system. It is
PHP-based, using a MySQL database and HTML components. Support is
provided for several languages and currencies, and it is freely
available under the GNU General Public License.

Zen Cart contains a directory named extras where there are different
test scripts. One of these scripts is curltest.php. This script is used
for testing is the curl PHP library is installed and is working properly.

Source code:

...

$url = (isset($_GET['url'])) ? urldecode($_GET['url']) : $defaultURL;

...

// Send CURL communication
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_VERBOSE, 0);

...

$result = curl_exec($ch);
$errtext = curl_error($ch);
$errnum = curl_errno($ch);
$commInfo = @curl_getinfo($ch);
curl_close ($ch);

...

if ($url != $defaultURL) echo $result . 'EOF';

...


As you can see above, the URL passed to the curl_setopt (CURLOPT_URL)
function and later used by curl_exec comes from user input ($_GET['url']).

Also, the file contents (saved in the $result) are echoed back to the
user. Therefore we can read the contents of any file from the remote
server by issuing an request like:
http://website/zen-cart/extras/curltest.php?url=file:///etc/passwd

The extras directory contains other test scripts. One of them, named
ipn_test_return.php, is not properly written and will display an error
message when called directly:

If you issue a request like
http://website/zen-cart/extras/ipn_test_return.php
you will receive the following error message:

<br />
<b>Fatal error</b>: require() [<a
href='function.require'>function.require</a>]: Failed opening required
‘includes/application_top.php’
(include_path=’.:/usr/share/php:/usr/share/pear’) in
<b>/var/www/bld/bld02/zen-cart/extras/ipn_test_return.php</b> on line
<b>14</b><br />

This error message reveals the local path, so now we know where the
application is installed. This could be useful to read the contents of
the configuration file (includes/configure.php). This file contains the
database credentials. If the Zen Cart database is not stored on the
local server, it’s possible to access the database remotely.

Also, even without the file:// protocol, it’s possible to access hosts
behind the firewall by issuing requests like

http://website/zen-cart/extras/curltest.php?url=http://192.168.0.1 or
http://website/zen-cart/extras/curltest.php?url=http://192.168.1.1.

The vendor released a security alert after being notified by us. They
advise users to completely remove the extras directory as it’s not
required by Zen Cart and it was distributed only for troubleshooting.

The security alert can be found at:
http://www.zen-cart.com/forum/showthread.php?t=142784


--
Bogdan Calin - bogdan@acunetix.com
CTO
Acunetix Ltd. - http://www.acunetix.com
Acunetix Web Security Blog - http://www.acunetix.com/blog
Login or Register to add favorites

File Archive:

May 2024

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close