纵有疾风起
人生不言弃

Ecmall二次注入第四弹 – 网站安全 – 自学php

20140618

虽然20140618添加了防注入的 但是还是能勉强绕过。

首先注册一个会员 然后申请开店。

然后把店的名字改成

yu’,user(),1 and extractvalue(1,concat(0x5c,(user()))))#

然后这里转义再入库。

在app/order.app.php中

 

function index()
    {
        if (!IS_POST)
        {
            $goods_info = $this->_get_goods_info();

            if ($goods_info === false)
            {
                /* 购物车是空的 */
                $this->show_warning('goods_empty');

                return;
            }

            /* 根据商品类型获取对应订单类型 */
            $goods_type     =&  gt($goods_info['type']);
            $order_type     =&  ot($goods_type->get_order_type());

            /* 显示订单表单 */
            $form = $order_type->get_order_form($goods_info['store_id']);
            if ($form === false)
            {
                $this->show_warning($order_type->get_error());

                return;
            }
            $this->_curlocal(
                LANG::get('create_order')
            );
            $this->assign('goods_info', $goods_info);
            $this->assign($form['data']);
            $this->display($form['template']);
        }
        else
        {
           /* 在此获取生成订单的两个基本要素:用户提交的数据(POST),商品信息(包含商品列表,商品总价,商品总数量,类型),所属店铺 */
            $goods_info = $this->_get_goods_info();
            if ($goods_info === false)
            {
                /* 购物车是空的 */
                $this->show_warning('goods_empty');

                return;
            }

            /* 根据商品类型获取对应的订单类型 */
            $goods_type =& gt($goods_info['type']);
            $order_type =& ot($goods_type->get_order_type());

            /* 将这些信息传递给订单类型处理类生成订单(你根据我提供的信息生成一张订单) */
            $order_id = $order_type->submit_order(array(
                'goods_info'    =>  $goods_info,      //商品信息(包括列表,总价,总量,所属店铺,类型),可靠的!
                'post'          =>  $_POST,           //用户填写的订单信息
            ));

            if (!$order_id)
            {
                $this->show_warning($order_type->get_error());

                return;
            }

            /* 下单完成后清理商品,如清空购物车,或将团购拍卖的状态转为已下单之类的 */
            $this->_clear_goods();

            /* 发送邮件 */
            $model_order =& m('order');

            /* 减去商品库存 */
            $model_order->change_stock('-', $order_id);

            /* 获取订单信息 */
            $order_info = $model_order->get($order_id);


            $buyer_address = $this->visitor->get('email');
            $model_member =& m('member');
            $member_info  = $model_member->get($goods_info['store_id']);
            $seller_address= $member_info['email'];

            /* 发送给买家下单通知 */
            $buyer_mail = get_mail('tobuyer_new_order_notify', array('order' => $order_info));

            $this->_mailto($buyer_address, $buyer_mail['subject'], $buyer_mail['message']);

            /* 发送给卖家新订单通知 */
            $seller_mail = get_mail('toseller_new_order_notify', array('order' => $order_info));

            $this->_mailto($seller_address, $seller_mail['subject'], $seller_mail['message']);

            /* 更新下单次数 */
            $model_goodsstatistics =& m('goodsstatistics');

 

$seller_mail = get_mail('toseller_new_order_notify', array('order' => $order_info));

            $this->_mailto($seller_address, $seller_mail['subject'], $seller_mail['message']);

主要看这里

在看’toseller_new_order_notify’这里

在includes/arrayfiles/mailtemplate/toseller_new_order_notify.php中

 

<?php
return array (
  'version' => '1.0',
  'subject' => '{$site_name}提醒:您有一个新订单需要处理',
  'content' => '<p>尊敬的{$order.seller_name}:</p>
<p style="padding-left: 30px;">您有一个新的订单需要处理,订单号{$order.order_sn},请尽快处理。</p>

尊敬的{$order.seller_name}: 可以看到这里 直接把$order.seller_name 返回出去了。

然后带入到了insert当中。

 

function _mailto($to, $subject, $message, $priority = MAIL_PRIORITY_LOW)
    {  
        /* 加入邮件队列,并通知需要发送 */
        $model_mailqueue =& m('mailqueue');
        $mail = array(
            'mail_to'       => $to,
            'mail_encoding' => CHARSET,
            'mail_subject'  => $subject,
            'mail_body'     => $message,
            'priority'      => $priority,
            'add_time'      => gmtime(),
        );

        $model_mailqueue->add($mail);

之前我看function add 都addslashes了 后面发现根本都没进这函数。

表示还是没找到这函数在哪 但是测试的是没转义的。
 

Ecmall二次注入第四弹 – 网站安全 – 自学php插图

 

Ecmall二次注入第四弹 – 网站安全 – 自学php插图1

成功出数据。

修复方案:

返回的时候addslashes一次把。

    上一篇: 东方时尚驾校所有服务器的可被渗透影响数据安

    下一篇: 主机屋可任意修改其他用户密码漏洞 – 网站安全
未经允许不得转载:起风网 » Ecmall二次注入第四弹 – 网站安全 – 自学php
分享到: 生成海报

评论 抢沙发

评论前必须登录!

立即登录