|
|||||||
| Zen Cart Release Announcements Watch this forum for new releases and other important announcements. Click here to subscribe to these announcements. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Sensei
Join Date: Jan 2004
Location: Ontario, Canada
Posts: 44,025
|
Security Alert: SQL Injection Risk
A vulnerability in Zen Cart has been identified (thanks to Gulftech Security Research) which could potentially allow rogue behavior if the site has magic_quotes_gpc turned off in their server/site's PHP settings. You should immediately apply the following fixes to your site, as shown below, according to the version of Zen Cart you're using: NOTE: THE FIXES SHOWN BELOW ARE SUPERCEDED BY THE FOLLOWING ANNOUNCEMENT: http://www.zen-cart.com/forum/showthread.php?t=108428 YOU DO NOT NEED TO MAKE ANY OF THE FOLLOWING CHANGES if you follow the more thorough approach used in this post: http://www.zen-cart.com/forum/showthread.php?t=108428 The fixes all involve /includes/classes/shopping_cart.php 1. The following 2-part fix applies to all versions 1.2.x thru 1.3.8a: a) Around line 300, simply add the two new lines shown: Code:
if (is_array($value) ) {
reset($value);
while (list($opt, $val) = each($value)) {
$val = (int)$val;
$products_options_sort_order= zen_get_attributes_options_sort_order(zen_get_prid($products_id), $option, $opt);
$sql = "insert into " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . "
(customers_id, products_id, products_options_id, products_options_value_id, products_options_sort_order)
values ('" . (int)$_SESSION['customer_id'] . "', '" . zen_db_input($products_id) . "', '" .
(int)$option.'_chk'. $val . "', '" . $val . "', '" . $products_options_sort_order . "')";
$db->Execute($sql);
}
} else {
if ($attr_value) {
$attr_value = zen_db_input($attr_value);
}
$value = (int)$value;
$products_options_sort_order= zen_get_attributes_options_sort_order(zen_get_prid($products_id), $option, $value);
$sql = "insert into " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . "
(customers_id, products_id, products_options_id, products_options_value_id, products_options_value_text, products_options_sort_order)
values ('" . (int)$_SESSION['customer_id'] . "', '" . zen_db_input($products_id) . "', '" .
(int)$option . "', '" . $value . "', '" . $attr_value . "', '" . $products_options_sort_order . "')";
$db->Execute($sql);
}
Code:
if (is_array($value) ) {
reset($value);
while (list($opt, $val) = each($value)) {
$val = (int)$val;
$products_options_sort_order= zen_get_attributes_options_sort_order(zen_get_prid($products_id), $option, $opt);
$sql = "update " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . "
set products_options_value_id = '" . $val . "'
where customers_id = '" . (int)$_SESSION['customer_id'] . "'
and products_id = '" . zen_db_input($products_id) . "'
and products_options_id = '" . (int)$option.'_chk'.$val . "'";
$db->Execute($sql);
}
} else {
if (isset($_SESSION['customer_id'])) {
$value = (int)$value;
$sql = "update " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . "
set products_options_value_id = '" . $value . "', products_options_value_text = '" . $attr_value . "'
where customers_id = '" . (int)$_SESSION['customer_id'] . "'
and products_id = '" . zen_db_input($products_id) . "'
and products_options_id = '" . (int)$option . "'";
$db->Execute($sql);
}
}
Depending on what version, this section can be found around line 1650 up to line 1720: Simply change the $prodId= line to match what is shown below: Code:
function actionMultipleAddProduct($goto, $parameters) {
global $messageStack;
if (is_array($_POST['products_id']) && sizeof($_POST['products_id']) > 0) {
while ( list( $key, $val ) = each($_POST['products_id']) ) {
if ($val > 0) {
$adjust_max = false;
$prodId = ereg_replace('[^0-9a-f:.]', '', $key);
$qty = $val;
$add_max = zen_get_products_quantity_order_max($prodId);
...
Once again, we wish to thank James Bercegay at Gulftech Security Research for his helpful input and assistance in identifying and confirming the fix for this matter. These fixes will of course be built-in to the next release of Zen Cart, meaning that versions newer than v1.3.8a are not affected by these reported issues. ref: gulftech.org/?node=research&article_id=00129-09042008 securityfocus.com/bid/31023
__________________
Zen Cart - putting the dream of business ownership within reach of anyone! Last edited by DrByte; 23rd September 2008 at 07:54 PM. Reason: update to regex |
|
|
|
|
#2 |
|
Sensei
Join Date: Jan 2004
Location: Ontario, Canada
Posts: 44,025
|
NOTE: THE FIXES SHOWN ABOVE ARE SUPERCEDED BY THE FOLLOWING ANNOUNCEMENT: http://www.zen-cart.com/forum/showthread.php?t=108428
The fixes in this new announcement supercede the above announcement. Please apply the patch shown here: http://www.zen-cart.com/forum/showthread.php?t=108428
__________________
Zen Cart - putting the dream of business ownership within reach of anyone! |
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Security Alert: SQL Injection Protection 2008-09-19 | DrByte | Zen Cart Release Announcements | 2 | 30th September 2008 06:21 AM |