### 简要描述: TinyShop最新版SQL注入一枚。 简直被审核系统搞无语了,麻烦乌云加上时钟跟分钟好吗?不然早提交几小时几分钟的同学跟自动审核的人一起提交只有遭殃的份。 重复重复,重复你妹啊! ps:亲 时间是通过审核的时间,请看漏洞ID区分先后顺序 当前时间:2014.7.10 11.44 ### 详细说明: 上个漏洞厂商说不要一起发SQL注入了,下个版本会一起处理。现在来看看怎么处理的。 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; } ``` 看着就不对劲,开启了gpc怎么还取消了转义,那开着不是更好。 接下来找个通过这个函数的。 找到一个简单登录功能的文件: protected\controllers\simple.php: ``` public function login_act(){ $redirectURL = Req::args("redirectURL"); $this->assign("redirectURL",$redirectURL); $email = Filter::sql(Req::post('email')); //这里 $passWord = Req::post('password'); $autologin = Req::args("autologin"); if($autologin==null)$autologin = 0; $model = $this->model->table("user as us"); $obj = $model->join("left join customer as cu on us.id =...
### 简要描述: TinyShop最新版SQL注入一枚。 简直被审核系统搞无语了,麻烦乌云加上时钟跟分钟好吗?不然早提交几小时几分钟的同学跟自动审核的人一起提交只有遭殃的份。 重复重复,重复你妹啊! ps:亲 时间是通过审核的时间,请看漏洞ID区分先后顺序 当前时间:2014.7.10 11.44 ### 详细说明: 上个漏洞厂商说不要一起发SQL注入了,下个版本会一起处理。现在来看看怎么处理的。 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; } ``` 看着就不对劲,开启了gpc怎么还取消了转义,那开着不是更好。 接下来找个通过这个函数的。 找到一个简单登录功能的文件: protected\controllers\simple.php: ``` public function login_act(){ $redirectURL = Req::args("redirectURL"); $this->assign("redirectURL",$redirectURL); $email = Filter::sql(Req::post('email')); //这里 $passWord = Req::post('password'); $autologin = Req::args("autologin"); if($autologin==null)$autologin = 0; $model = $this->model->table("user as us"); $obj = $model->join("left join customer as cu on us.id = cu.user_id")->fields("us.*,cu.group_id,cu.login_time")->where("us.email='$email'")->find(); if($obj){ if($obj['password'] == CHash::md5($passWord,$obj['validcode'])){ if($autologin==1) $this->safebox->set('user',$obj,$this->cookie_time); else $this->safebox->set('user',$obj, 1800); $this->model->table("customer")->data(array('login_time'=>date('Y-m-d H:i:s')))->where('user_id='.$obj['id'])->update(); $redirectURL = Req::args("redirectURL"); if($redirectURL!='' && stripos($redirectURL, "http://")===false && stripos($redirectURL, "reg")===false && stripos($redirectURL, "reset_password_act")===false)header('Location: '.$redirectURL, true, 302); else $this->redirect('/ucenter/index'); exit; }else{ $info = array('field'=>'password','msg'=>'密码错误!'); } }else{ $info = array('field'=>'email','msg'=>'账号不存在!'); } $this->assign("invalid",$info); $this->redirect("login",false,Req::args()); } ``` 其中email过了那个函数,直接就是一个盲注了。 ### 漏洞证明: [<img src="https://images.seebug.org/upload/201407/10114257c5f584ba2bf73fb318109ae518527c9c.png" alt="1111.png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201407/10114257c5f584ba2bf73fb318109ae518527c9c.png) [<img src="https://images.seebug.org/upload/201407/10114310e12b9de16911b4bbad1ee068ba5a9b62.png" alt="2222.png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201407/10114310e12b9de16911b4bbad1ee068ba5a9b62.png) 都可以直接用sqlmap跑了 [<img src="https://images.seebug.org/upload/201407/10114321bd7e97974d6a4e4513621c57f2278d25.png" alt="333.png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201407/10114321bd7e97974d6a4e4513621c57f2278d25.png)