Lucene search
K

SunShop <= 4.1.4 (id) Remote SQL Injection Vulnerability

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

SunShop version <= 4.1.4 Remote SQL Injection Vulnerability. SunShop shopping cart PHP ecommerce solution has multiple SQL Injection issues allowing arbitrary database access to customer and administrator details. Turnkey Web Tools has released an updated version to fix these issues

Code

                                                ##########################################################
# GulfTech Security Research              August 18, 2008
##########################################################
# Vendor : Turnkey Web Tools, Inc
# URL : http://www.turnkeywebtools.com
# Version : SunShop &#60;= 4.1.4
# Risk : SQL Injection
##########################################################


Description:
SunShop shopping cart is a full featured ecommerce solution written
in php that allows for web masters to run their own online ecommerce
operation. Unfortunately there are a number of SQL Injection issues
in SunShop that allow for an attacker to have arbitrary access to the
SunShop database where they can access information such as customer
and administrator details. An updated version of SunShop has been
released to address these issues, and users should upgrade soon.



SQL Injection:
There are quite a few SQL Injection issues within SunShop that for an
attacker to have arbitrary access to the SunShop database. The first
example we will have a look at is in class.ajax.php @ lines 348-362

function edit_registry ($id=&#34;&#34;) {
    global $DB_site, $dbprefix, $settings, $lang, $sess;
    $data = $DB_site-&#62;query_first(&#34;SELECT * FROM `&#34;.$dbprefix.&#34;users_registry`
    WHERE id=&#39;&#34;.$_POST[id].&#34;&#39; AND userid=&#39;&#34;.$sess-&#62;gvar(&#39;userid&#39;).&#34;&#39;&#34;);
    $data = filter_data($data);
    $out  = &#39;document.getElementById(\&#39;wishform\&#39;).style.display = \&#39;none\&#39;;&#39;;
    $out .= &#39;document.getElementById(\&#39;wisheditform\&#39;).style.display = \&#39;block\&#39;;&#39;;
    $out .= &#39;form = document.forms[\&#39;edit_registry\&#39;];&#39;;
    $out .= &#39;form.elements[\&#39;event[id]\&#39;].value = \&#39;&#39;.js_clean($data[id]).&#39;\&#39;;&#39;;
    $out .= &#39;form.elements[\&#39;event[name]\&#39;].value = \&#39;&#39;.js_clean($data[name]).&#39;\&#39;;&#39;;
    $out .= &#39;form.elements[\&#39;event[desc]\&#39;].value = \&#39;&#39;.js_clean($data[description]).&#39;\&#39;;&#39;;
    $out .= &#39;form.elements[\&#39;event[month]\&#39;].selectedIndex = &#39;.(date(&#39;m&#39;,
    strtotime($data[&#39;date&#39;]))-1).&#39;;&#39;;
    $out .= &#39;form.elements[\&#39;event[day]\&#39;].selectedIndex = &#39;.(date(&#39;d&#39;,
    strtotime($data[&#39;date&#39;]))-1).&#39;;&#39;;
    $out .= &#39;form.elements[\&#39;event[year]\&#39;].selectedIndex = &#39;.((date(&#39;Y&#39;,
    strtotime($data[&#39;date&#39;])))-date(&#39;Y&#39;)).&#39;;&#39;;
    return $out;
}

As seen above the SQL Injection issue here is pretty straight forward
and is a result of a $_POST variable being used in the middle of the
query. An attacker could exploit this SQL Injection issue by making a
post request to &#34;/index.php?l=edit_registry&p=1&#34; with the following
post data.

id=-99&#39; UNION SELECT 1,2,3,concat(username,char(58),password),5,6 FROM ss_users/*

Upon successful exploitation an attacker would be presented with the
targeted credentials. In addition to this SQL Injection are several more
SQL Injection issues within class.ajax.php and can be found at lines 77,
113, 138 (via the check_email() function), 349, 374, and 400. With the
exception of the issue @ line 138 these issues are very easily identified as they use GPC variables directly within SQL queries.



Solution:
The TurnKeyWebTools developers have addressed these issues in the latest
version of SunShop which can be found at the following url.

http://www.turnkeywebtools.com/esupport/index.php?_m=news&_a=viewnews&newsid=63


Credits:
James Bercegay of the GulfTech Security Research Team



Related Info:
The original advisory can be found at the following location
http://www.gulftech.org/?node=research&article_id=00125-08182008

# milw0rm.com [2008-08-19]

                              

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