SQL Server从0到1——报错注入

报错注入分为三类:隐式转换,和显示转换,declare函数 隐式转换:

原理:将不同数据类型的数据进行转换或对比
select * from test.dbo.users where (select user)>0  #对比
select * from test.dbo.users where ((select user)/1)=1 #运算

 SQL Server从0到1——报错注入_第1张图片

SQL Server从0到1——报错注入_第2张图片

显示转换:

原理:
依靠:CAST,DECLARE和CONVERT函数进行数据类型转,当如果转化的是有关查询语句的结果,那么就会触发报错,但注意只能爆一个字符串
select 'naihe567' as name,'567' as num)as  b#这里我们使用了select 创建了一个自定义的临时表方便观察
select cast((select name from (select 'naihe567' as name,'567' as num)as  b) as int) #cast函数
select convert(int,(select name from (select 'naihe567' as name,'567' as  num)as b)) #convert函数
declare @s varchar(2000) set @s='select naihe567' exec(@s) #declare

 SQL Server从0到1——报错注入_第3张图片

SQL Server从0到1——报错注入_第4张图片SQL Server从0到1——报错注入_第5张图片

你可能感兴趣的:(sql,数据库,mysql,web安全,网络,安全,学习)