New Zenner
- Join Date:
- Oct 2007
- Location:
- Los Angeles / Simi Valley
- Posts:
- 41
- Plugin Contributions:
- 0
Isn't this a security issue ?
As everyone can see the data is not sanitized directly by mysql_real_escape_string
$sql = "select count(*) as total
from " . TABLE_PRODUCTS . " p, " .
TABLE_PRODUCTS_DESCRIPTION . " pd
where p.products_status = '1'
and p.products_id = '" . (int)$_GET['products_id']. "'
and pd.products_id = p.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'";
I'd like to know if the wrapper takes care of it and that's why (after all to do it properly you need to have an active db connection when you use the mysql_real_escape_string function...)
Or if it's just a missed security issue.
of course since the data is "sanitized" by the (int) it's not an imminent danger, But...
I modified files to make the products pull up by Model Number, with
&products_model=MODEL
And since it's open type I'd like to know if this is going to cause security holes...
// PRODUCT MODEL SELECTOR
if(isset($_GET['products_model'])) {
$sql = "select products_id
from " . TABLE_PRODUCTS . "
where products_model= '" . mysql_real_escape_string($_GET['products_model']) . "'";
$res = $db->Execute($sql);
$ProductRealId = $res->fields[products_id];
} else {
$ProductRealId = $_GET['products_id'];
}
I then replace every $_GET['products_id'] with $ProductRealId...
Notice I manually sanitized the string even if I'm not 100% sure that the connection is avail and the sanitation occurs...
I'm just wondering and wanting to know if that's just an exploit waiting to happen in my peculiar situation...
I think I will pack this up as a mod and give it to you guys if you don't think I'm opening possible exploits with it.
As far as functionality it's working like a charm :) pretty good for a 20 min work around :P
the files that were modified are:
includes/modules/pages/product_info/
header_php.php
main_template_vars.php
Template Files
tpl_product_info_display.php
includes/modules/
also_purchased_products.php
product_prev_next.php
Thanks for any info about what I think might be an issue, or any comment about this.