时间: 2020-10-11|tag: 9次围观|0 条评论

看到 /framework/lib/util/filter_class.php

 

......
public static function sql($str)
{
if (get_magic_quotes_gpc()){
$str = stripslashes($str);
}else{
//不使用主要是因为,先有mysql的连接
//$str =  mysql_real_escape_string($str);
$str = addslashes($str);
}
return $str;
}.....

当php为低版本或者 gpc开启(php默认是开启的吧)时。

$str = stripslashes($str);

去掉 转义符, 跳出转义。

找一个调用 Filter::sql的。

例如 index.php
 

public function js()
    {

        $id = Filter::sql(Req::args("id"));
        $model = new Model("ad");
        $time = date('Y-m-d');

        $ad = $model->where("number = '$id' and start_time<='$time' and end_time >='$time'")->find();
        if($ad==null) return;
        if($ad['is_open']==0) return;

百度搜索到某个使用 tinyshop的站,just a test~
 

TinyShop 多处sql注入#2 – 网站安全 – 自学php插图

调用该函数的 还有 /protected/controllers/simple.php
 

public function reset_password()
    {
        $safecode = Filter::sql(Req::args('safecode'));
        if($safecode!=null && strlen($safecode)==32)
        {
            $model = $this->model->table('reset_password');
            $obj = $model->where("safecode='".$safecode."'")->find();
            $this->assign('status','fail');
            $this->assign('safecode',$safecode);
            if(!empty($obj)) $this->assign('status','success');
            $this->redirect();
        }
        else
        {
            $this->redirect('index/index');
        }
    }

/protected/controllers/ucenter.php

/protected/controllers/payment.php

。。。。就不贴代码一一举例了。

 

TinyShop 多处sql注入#2 – 网站安全 – 自学php插图

 

修复方案:

过滤

    上一篇: 利用CSRF绑定有道云笔记并推送恶意信息 - 网站安

    下一篇: 程氏舞曲CMS储存型 xss(6) 附后台getshell - 网站安
本博客所有文章如无特别注明均为原创。
复制或转载请以超链接形式注明转自起风了,原文地址《TinyShop 多处sql注入#2 – 网站安全 – 自学php
   

还没有人抢沙发呢~