sql注入之union注入

联合查询注入利用的前提: 必需要有回显

联合查询过程:

  1. 判断是否存在注入点
  2. 判断是什么类型注入(字符型or数字型)
  3. 判断闭合方式
  4. 查询列数个数(order by)
    5, 得到数据库名
  5. 得到表名
  6. 得到字段名

1. 判断是否存在注入点 能够用(')单引号显示数据库错误信息或者页面回显不一样
2. 判断什么类型(字符型or数字型) 用and 1=1和and 1=2  若是页面没有变化说明不是数字型 ,若是有明显变化说明是数字型
3. 判断闭合方式 单引号or双引号..看报错信息、
4. 判断列数个数(order by) order by在mysql中查询结果是按照指定字段进行排序的,例如数据库中有3个字段,order by查询就是1,2,3
5. 查看数据库信息and得到数据库名 使用group_concat() 
	基本语句:
    
    1' union select 1,(select database()),3--+

    1' union select 1,(select group_concat(schema_name) from information_schema.schemata) --+




6. 得到表名
	基本语句:

    0' union select 1,(select group_concat(table_name) from information_schema.tables where table_schema=database()),3 --+





7. 得到字段名
	基本语句:

    0' union select 1,(select group_concat(column_name) from information_schema.columns where table_name='表名'),3 --+
相关文章
相关标签/搜索