ecshop api.php,ecshop2.72 api.php 文件鸡肋注入
/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 (empty($date_count))
{
api_err('0x003', 'no data to back'); //無符合條件數據
}
$page = empty($_POST['pages']) ? 1 : $_POST['pages']; ?? ?? //沒過濾
$counts = empty($_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 (empty($license['certificate_id']) || empty($license['token']) || empty($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:
總結
以上是生活随笔為你收集整理的ecshop api.php,ecshop2.72 api.php 文件鸡肋注入的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: SSD之硬的不能再硬的硬核解析
- 下一篇: php点加等于0,php 做数学运算时结