metasploit mysql_Metasploit渗透测试:选择模块

原标题:Metasploit渗透测试:选择模块

当用户准备 攻击 时,首先需要选择针对目标 漏洞的模块。在MSF终端,提供了多个命令,可以帮助用户完成模块选择工作,如搜索模块、加载模块和编辑模块等。

1、搜索模块

Metasploit框架的强大之处就是提供了大量的模块。通常情况下,记住所有模块的位置或名称显然是不可能的。所以为了弥补这个缺点,这里提供了一个搜索模块命令——search。还可以使用grep命令对搜索结果进行过滤。下面介绍搜索模块及过滤的方法。

(1)search命令

search命令主要用来搜索一些用户想知道的模块。该命令可以指定一些关键字,来缩小搜索模块范围。search命令支持的关键字及含义如表1所示。

54a4fc6c867d4316ba05631fa263e77f.png

表1 search命令支持的关键字

过name关键字搜索模块。执行命令如下:

msf5 > search name:mysql

Matching Modules

Name Disclosure

Date Rank Check Deion

---- --------- ---- ----- ------------

auxiliary/admin/mysql/mysql_enum normal No MySQL Enumeration

Module

auxiliary/admin/mysql/mysql_sql normal No MySQL SQL Generic Query

auxiliary/analyze/jtr_mysql_fast normal No John the Ripper MySQL

Password Cracker (Fast Mode)

auxiliary/scanner/mysql/mysql_authbypass_hashdump 2012-06-01 normal Yes MySQL Authentication Bypass Password Dump

auxiliary/scanner/mysql/mysql_file_enum normal Yes MYSQL File/Directory Enumerator

auxiliary/scanner/mysql/mysql_hashdump normal

auxiliary/scanner/mysql/mysql_login normal Yes MySQL Login Utility

auxiliary/scanner/mysql/mysql_schemadump normal Yes MYSQL Schema Dump

auxiliary/scanner/mysql/mysql_version normal Yes MySQL Server Version Enumeration

auxiliary/scanner/mysql/mysql_writable_dirs normal Yes MYSQL Directory Write Test

auxiliary/server/capture/mysql normal No Authentication

Capture: MySQL

exploit/linux/mysql/mysql_yassl_getname 2010-01-25 good No MySQL yaSSL CertDecoder::GetName Buffer Overflow

exploit/linux/mysql/mysql_yassl_hello 2008-01-04 good No MySQL yaSSL SSL Hello Message Buffer Overflow

exploit/multi/mysql/mysql_udf_payload 2009-01-16 excellent No Oracle MySQL UDF Payload Execution

exploit/windows/mysql/mysql_mof 2012-12-01 excellent Yes Oracle MySQL for Microsoft Windows MOF Execution

exploit/windows/mysql/mysql_start_up 2012-12-01 excellent Yes Oracle MySQL for Microsoft Windows FILE Privilege Abuse

exploit/windows/mysql/mysql_yassl_hello 2008-01-04 average No MySQL yaSSL SSL Hello Message Buffer Overflow

exploit/windows/mysql/scrutinizer_upload_exec 2012-07-27 excellent Yes Plixer Scrutinizer NetFlow and sFlow Analyzer 9 Default MySQL Credential

msf5 >

从输出的信息可以看到匹配名称为 MySQL 的所有模块。

通过运行平台进行模块搜索。例如,搜索运行在aix平台上的模块。执行命令如下:

msf5 > search platform:aix

Matching Modules

Name Disclosure Date Rank Check Deion

---- --------------- ---- ----- ------------

exploit/aix/local/ibstat_path 2013-09-24 excellent Yes ibstat

$PATH Privilege Escalation

exploit/aix/rpc_cmsd_opcode21 2009-10-07 great No AIX Calendar

Manager Service Daemon (rpc.cmsd) Opcode 21 Buffer Overflow

exploit/aix/rpc_ttdbserverd_realpath 2009-06-17 great No

ToolTalk rpc.ttdbserverd _tt_internal_realpath Buffer Overflow (AIX)

payload/aix/ppc/shell_bind_tcp normal No AIX Command Shell,Bind TCP Inline

payload/aix/ppc/shell_find_port normal No AIX Command Shell,Find Port Inline

payload/aix/ppc/shell_interact normal No AIX execve Shellfor inetd

payload/aix/ppc/shell_reverse_tcp normal No AIX Command Shell,Reverse TCP Inline

post/aix/hashdump normal No AIX Gather DumpPassword Hashes

post/multi/manage/sudo normal No Multiple Linux /Unix Post Sudo Upgrade Shell

post/multi/recon/local_exploit_suggester normal No Multi Recon Local Exploit Suggester

从输出的信息中可以看到搜索到的匹配模块。

(2)过滤结果

当用户使用search命令搜索出的结果较多时,还可以结合grep命令进行过滤。这里的grep命令和 Linux 命令行中的grep类似。其语法格式如下:

grep [选项] pattern cmd

grep命令支持的选项及含义如下:

-A:显示一个匹配输出后的行。

-B:显示一个匹配输出前的行。

-c:仅显示一组匹配行。

-h:显示帮助信息。

-i:忽略实例。

-k:保留输出开始的行。

-m:匹配一个结果后停止。

-s:跳过尝试匹配前的输出结果。

-v:反向匹配。

搜索名称中包含oracle的模块,并过滤 HTTP 类型的模块。执行命令如下:

msf5 > grep http search oracle

auxiliary/scanner/http/glassfish_traversal 2015-08-08 normal Yes Path Traversal in Oracle GlassFish Server Open Source Edition

auxiliary/scanner/http/oracle_demantra_database_credentials_leak2014-02-28 normal Yes Oracle Demantra Database Credentials Leak

auxiliary/scanner/http/oracle_demantra_file_retrieval 2014-02-28 normal Yes Oracle Demantra Arbitrary File Retrieval with Authentication Bypass

auxiliary/scanner/http/oracle_ilom_login normal Yes Oracle ILO

Manager Login Brute Force Utility

exploit/multi/http/glassfish_deployer 2011-08-04 excellent No Sun/

Oracle GlassFish Server Authenticated Code Execution

exploit/multi/http/oracle_ats_file_upload 2016-01-20 excellent Yes

Oracle ATS Arbitrary File Upload

exploit/multi/http/oracle_reports_rce 2014-01-15 great Yes Oracle

Forms and Reports Remote Code Execution

exploit/multi/http/oracle_weblogic_wsat_deserialization_rce 2017-10-19 excellent No Oracle WebLogic wls-wsat Component Deserialization RCE

exploit/windows/http/apache_chunked 2002-06-19 good Yes Apache Win32 Chunked Encoding

exploit/windows/http/bea_weblogic_post_bof 2008-07-17 great Yes Oracle Weblogic Apache Connector POST Request Buffer Overflow

exploit/windows/http/oracle9i_xdb_pass 2003-08-18 great Yes Oracle9i XDB HTTP PASS Overflow (win32)

exploit/windows/http/oracle_beehive_evaluation 2010-06-09 excellent Yes Oracle BeeHive 2 voice-servlet processEvaluation Vulnerability

exploit/windows/http/oracle_beehive_prepareaudiotoplay 2015-11-10 excellent Yes Oracle BeeHive 2 voice-servlet prepareAudioToPlayArbitrary File Upload

exploit/windows/http/oracle_btm_writetofile 2012-08-07 xcellent No

Oracle Business Transaction Management FlashTunnelService Remote Code Execution

exploit/windows/http/oracle_endeca_exec 2013-07-16 excellent Yes Oracle Endeca Server Remote Command Execution

exploit/windows/http/oracle_event_processing_upload 2014-04-21 excellent Yes Oracle Event Processing FileUploadServlet ArbitraryFile Upload

exploit/windows/http/osb_uname_jlist 2010-07-13 excellent No Oracle Secure Backup Authentication Bypass/Command Injection Vulnerability

从输出的信息中可以看到过滤出的结果。

2、加载模块

模块是指Metasploit框架中所使用的一段软件 代码 组件。在实施 渗透 攻击 时,需要先选择用于 渗透 攻击 的模块。有时候可能需要使用一个辅助模块(auxiliary module),该模块用来执行一些扫描或系统检查的 攻击 动作。下面介绍选择 渗透 攻击 模块的方法。

选择模块。具体操作步骤如下:

1)登录MSF终端。执行命令如下:

root@daxueba:~# msfconsole

msf5 >

2)在选择模块之前,可以使用show命令查看可利用的模块。执行命令如下:

msf5 > show exploits

执行以上命令行后,将输出大量的信息,具体如下:

Exploits

Name Disclosure Date Rank Check Deion

----- --------------- ----- -------------------

aix/local/ibstat_path 2013-09-24 excellent Yes ibstat $PATH Privilege Escalation

aix/rpc_cmsd_opcode21 2009-10-07 great No AIX Calendar Manager Service Daemon (rpc.cmsd) Opcode 21 Buffer Overflow

aix/rpc_ttdbserverd_realpath 2009-06-17 great No ToolTalk rpc.ttdbserverd _tt_internal_realpath Buffer Overflow (AIX)

android/adb/adb_server_exec 2016-01-01 excellent Yes Android ADB Debug Server Remote Payload Execution

windows/vnc/ultravnc_viewer_bof 2008-02-06 normal No UltraVNC 1.0.2 Client (vncviewer.exe) Buffer Overflow

windows/vnc/winvnc_http_get 2001-01-29 average No WinVNC Web Server GET Overflow

windows/vpn/safenet_ike_11 2009-06-01 average No SafeNet SoftRemote IKE Service Buffer Overflow

windows/winrm/winrm__exec 2012-11-01 manual No WinRM

Exec Remote Code Execution

windows/wins/ms04_045_wins 2004-12-14 great Yes MS04-045 Microsoft WINS Service Memory Overwrite

从输出的信息中可以看到所有可利用的模块。以上输出的信息较多,限于篇幅,部分内容省略了。如果用户对目标的类型、架构及已经有充分的了解,可以选择相应的模块进行 测试。

3)此时,用户可根据目标的来选择对应的模块。本例中选择 XP SP1作为靶机。在该目标中存在MS08_067( Server服务RPC请求),IP地址为192.168.1.104。因此,这里选择可用来MS08_067的模块ms08_067_netapi。其语法格式如下:

use [模块名称]

所以,执行命令如下:

msf5 > use exploit/windows/smb/ms08_067_netapi

msf5 exploit(ms08_067_netapi) >

从输出信息的提示符中可以看出,目前处在ms08_067_netapi模块下。

3、编辑模块

如果模块和现有目标不匹配,还可以编辑模块,修改其 代码 。MSF终端提供了一个edit命令,借助VIM编辑器来编辑当前模块。默认情况下,执行该命令后,将打开当前模块的编辑界面。下面介绍编辑模块的方法。

使用edit命令编辑模块。执行命令如下:

msf5 exploit(windows/smb/ms08_067_netapi) > edit

执行以上命令后,显示ms08_067_netapi模块的编辑界面,如图1所示。

29215d01888bc38abf3d9010d8a14b7a.png

图1 编辑模块

此时就可以对该脚本中的内容进行编辑了。修改完成后,保存并退出即可。退出模块的编辑界面后,将显示如下信息:

[!] LocalEditor or $VISUAL/$EDITOR should be set. Falling back on vim.

[*] Launching vim /usr/share/metasploit-framework/modules/exploits/windows/smb/ms08_067_netapi.rb

从输出的信息中可以看到,执行edit命令相当于执行了vim/usr/share/metasploit-framework/modules/exploits/windows/smb/ms08_067_netapi.rb命令,即s08_067_netapi.rb脚本的编辑界面。

4、退出当前模块

当用户使用一个特定模块完成工作后,或者选择了错误模块,则可以使用back命令退出当前模块。例如,退出当前模块ms08_067_netapi。执行命令如下:

msf5 exploit(windows/smb/ms08_067_netapi) > back

msf5 >

从显示的命令行提示符可以看到,ms08_067_netapi模块已成功退出。返回搜狐,查看更多

责任编辑:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值