Ecmall SQL注射之一

没穿底裤 2020年1月1日05:21:40评论352 views字数 1425阅读4分45秒阅读模式
摘要

缺陷文件:/app/coupon.app.php
[php]
function extend(){$coupon_id = isset($_GET['id']) ? trim($_GET['id']) : '';

缺陷文件:/app/coupon.app.php
[php]
function extend()

{

$coupon_id = isset($_GET['id']) ? trim($_GET['id']) : '';

if (empty($coupon_id))

{

echo Lang::get('no_coupon');

exit;

}

if (!IS_POST)

{

header("Content-Type:text/html;charset=" . CHARSET);

$this->assign('id', $coupon_id);

$this->assign('send_model', Lang::get('send_model'));

$this->display("coupon_extend.html");

}

else

{

if (empty($_POST['user_name']))

{

$this->pop_warning("involid_data");

exit;

}

$user_name = str_replace(array("/r","/r/n"), "/n", trim($_POST['user_name']));

$user_name = explode("/n", $user_name);

$user_mod =&m ('member');

$users = $user_mod->find(db_create_in($user_name, 'user_name'));

if (empty($users))

{

$this->pop_warning('involid_data');

exit;

}

if (count($users) > 30)

{

$this->pop_warning("amount_gt");

exit;

}

else

{

$users = $this->assign_user($coupon_id, $users);

$store = $this->_store_mod->get_info($this->_store_id);

$coupon = $this->_coupon_mod->get_info($coupon_id);

$coupon['store_name'] = $store['store_name'];

$coupon['store_id'] = $this->_store_id;

$this->_message_to_user($users, $coupon);

$this->_mail_to_user($users, $coupon);

$this->pop_warning("ok","coupon_extend");

}

}

}
[/php]
首先是coupon_id只过滤了空格,随后在else语句里进入了get_info函数:
[php]
function get_info($id)

{

$goods = $this->get(array(

'conditions' => "goods_id = '$id'",

'join' => 'belongs_to_store',

'fields' => 'this.*, store.state'

));

... 省略[/php]
读过代码的就知道了,其实上面的conditions之类的都是拼接成SQL语句最终要进入数据库的。

所以注射产生
exp:
[php]
POST index.php?app=coupon&act=extend&id=1[exp]

data:user_name=test(当前已经登录的用户名)
[/php]
Ecmall SQL注射之一

免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
没穿底裤
  • 本文由 发表于 2020年1月1日05:21:40
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   Ecmall SQL注射之一https://cn-sec.com/archives/75509.html
                  免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉.

发表评论

匿名网友 填写信息