基于Armitage的MSF自动化集成攻击实践

0x01 实践环境

  • macOS下Parallels Desktop虚拟机中(网络源均设置为共享网络模式):
    • Kali Linux - 64bit(攻击机,IP为10.211.55.10
    • Windows 7 - 64bit(靶机,IP为10.211.55.14
    • Windows XP Professional Version 2002 Service Pack 3(靶机,IP为10.211.55.16

0x02 预备知识

  • Armitage基本介绍:

    • Armitage是一款基于Java的Metasploit图形界面化的攻击软件,可以用它结合 Metasploit中已知的exploit来针对主机存在的漏洞自动化攻击。通过命令行的方式使用Metasploit难度较高,需要记忆的命令过多,而Armitage完美的解决了这一问题,用户只需要简单的点击菜单,就可以实现对目标主机的安全测试和攻击。Armitage良好的图形展示界面,使得攻击过程更加直观,用户体验更好。因其操作的简单性,尤其适合Metasploit初学者对目标系统进行安全测试和攻击。
  • Armitage攻击目标主机的的一般方法:

    • 目标网络扫描:为了确定目标主机所在网络结构的网络拓扑,为后续目标主机信息搜索和攻击奠定基础。
    • 目标主机信息搜集:为了收集目标主机的漏洞信息,根据收集到的漏洞信息可以利用Armitage在Metasploit中自动搜索合适的攻击模块。
    • 目标主机攻击模块搜索:主要方法是依据发现的漏洞信息寻找可以突破目标系统的现有漏洞利用模块,为具体的攻击方案制定提供尽可能多的可靠支撑。

0x03 Armitage基础配置

  • Armitage官网妹子镇楼:

  • 打开Kali攻击机,在终端中输入/etc/init.d/postgresql start命令启动postgresql服务:

  • 在msfconsole中输入armitage命令启动Armitage(在终端中直接输入也可以):


    也可以通过菜单栏图标直接打开Armitage! 对就是这个一脸坏笑的科技感十足的妹子233


    界面如下:

0x04 Nmap:Armitage下信息搜集与漏洞扫描

  • 由于本次实践中靶机的IP已知,这里可以直接导入靶机的IP10.211.55.16,不过更一般的方法是根据已知信息推导出目标主机所在网段的IP,扫描目标网段完整信息,确认目标网络拓扑结构以实施网络侦查。在Armitage上方工具栏中依次选择Hosts->Nmap Scan->Quick Scan(OS detect)


    填写靶机所在网段10.211.55.0/24


    唔...这不就同样给靶机扫出来了吗!

  • 选中靶机10.211.55.16,右键选择Services,查看靶机上开启的服务:


    可见靶机的139端口开启了netbios-ssn服务,445端口开启了microsoft-ds服务~
  • 选中靶机10.211.55.16,右键选择Scan,Armitage会调用Metasploit的漏洞扫描模块,定向扫描靶机,寻找存在的漏洞,为下一步确定攻击方法提供参考依据:


    可见类似前几次实验在Metasploit中手动配置主机号、端口号等设置现在统统直接自动化了!
  • 利用上一步中漏洞扫描得到的漏洞信息,自动搜索Metasploit攻击模块库,寻找合适的攻击模块。选中靶机10.211.55.16,依次选择菜单栏Attacks->Find Attacks,Armitage会开始自动搜索寻找合适的攻击模块:

  • 搜索完成,Happy hunting_

0x05 Armitage下漏洞自动化攻击实践

5.1 ms08_067_netapi(CVE-2008-4250):Windows远程溢出漏洞自动化攻击

  • ms08_067漏洞介绍:

    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.

    • ms08_067_netapi是一款Metasploit中有点老的溢出攻击载荷,攻击可以获得一个相对高的权限。

    • CVE ID:CVE-2008-4250

    • 原理:攻击者利用受害者主机默认开放的SMB服务端口445,发送特殊RPC(Remote Procedure Call 远程过程调用)请求,通过MSRPC over SMB通道调用Server程序中的NEtPathCanonicalize()函数时触发,NetPathCanonicalize()函数在远程访问其他主机时,会调用NetpwPathCanonicalize()函数,对远程访问的路径进行规范化,而在NetpwPathCanonicalize()函数中发生了栈缓冲区内存错误,造成可被利用实施远程代码执行。

    • 危害:攻击者能远程主动发起对漏洞主机端口的扫描,并且能直接获得漏洞主机的系统权限,属于最高严重级别的漏洞。

  • 在利用Armitage完成对靶机的攻击模块自动化搜索以后,选中10.211.55.16主机右键可以发现多了Attack菜单。依次选择Attack->smb->ms08_067_netapi菜单,选择smb漏洞下的ms08_067漏洞对XP靶机进行攻击(也可以在Armitage左侧树型目录下依次选择exploit->windows->smb->ms08_067_netapi找到该漏洞):

  • 在弹出的攻击配置对话框中配置LHOST/RHOST、LPORT/RPORT等信息(一般会自动配置好,这里把LPORT改成学号),Targets处配置靶机的系统(一般默认自动检测靶机系统),勾选Use a reverse connection,点击Launch开始攻击:

  • Armitage会进行一系列自动化攻击!攻击完成后,可以看到靶机的图标会发生明显变化:

  • Armitage会自动建立一个驻留在内存的shellcode即Meterpreter。在攻击成功的靶机上右键选择Meterpreter 1->Interact->Command Shell,输入dir命令查看靶机C:\WINDOWS\system32目录下的系统文件:
     


    攻击完成(⁎⁍̴̛ᴗ⁍̴̛⁎):

  • 在攻击成功的靶机上右键选择Meterpreter 1->Interact->Meterpreter Shell,输入getuid命令查看靶机当前用户的权限是SYSTEM权限:
     


    攻击完成(⁎⁍̴̛ᴗ⁍̴̛⁎):

5.2 ms14_064_ole_code_execution(CVE-2014-6352):IE远程代码执行漏洞自动化攻击

  • ms14_064_ole_code_execution漏洞简介:

    This module exploits the Windows OLE Automation array vulnerability, CVE-2014-6332. The vulnerability is known to affect Internet Explorer 3.0 until version 11 within Windows 95 up to Windows 10, and no patch for Windows XP. However, this exploit will only target Windows XP and Windows 7 box due to the Powershell limitation. Windows XP by defaults supports VBS, therefore it is used as the attack vector. On other newer Windows systems, the exploit will try using Powershell instead.

    • CVE ID:CVE-2014-6352

    • 原理及危害:OLE(对象链接与嵌入)是一种允许应用程序共享数据和功能的技术。UAC(User Account Control,用户帐户控制)是微软为提高系统安全而在Windows Vista中引入的新技术。Microsoft Windows在OLE组件的实现上存在安全漏洞,未经身份验证的远程攻击者可利用此漏洞执行远程代码。此漏洞源于没有正确处理含有OLE对象的Office文件。

    • 受影响系统版本:

      • Microsoft Windows Vista
      • Microsoft Windows Server 2012
      • Microsoft Windows Server 2008
      • Microsoft Windows RT
      • Microsoft Windows 8.1
      • Microsoft Windows 8
      • Microsoft Windows 7
  • 在Armitage左侧树型目录下依次选择exploit->windows->browser->ms14\_064\_ole\_code\_execution找到该漏洞并双击打开配置界面开始配置。注意!此处需要把AllowPowershellPrompt置为1!!然后配置好LHOST/RHOST、LPORT/RPORT等信息(把LPORT改成学号,其余均取默认值),Targets处配置靶机的系统Windows XP,点击Launch开始攻击:

  • Armitage会进行一系列自动化攻击!

  • 靶机打开IE浏览器,输入meterpreter提供的URLhttp://10.211.55.10:8080/0KO2YrGZdZ1viW/SrEsdO/并回车,在靶机看来似乎并没有发生什么!然而此时Armitage中靶机的图标已发生明显变化,表明Kali攻击机已攻击成功!!
     

  • 开始操作一波吧_在攻击成功的靶机上右键选择Meterpreter 1,发现除了上个攻击实践中查看Command ShellMeterpreter Shell功能之外,还具有查看浏览器文件、进程、截屏等功能!

    • 选择Explore->Browse Files查看浏览器文件:

    • 选择Explore->Show Processes查看靶机进程(这个比较有用啊emmm):

    • 选择Explore->Screenshot进行截屏(听说你是截屏狂魔?):

    • 选择Explore->Webcam shot调一波网络摄像头(颜控必备233):


      什么?!竟然没装摄像头!欺骗我感情啊o(︶︿︶)o

5.3 ms17_010_eternalblue(CVE-2017-0143):“永恒之蓝”自动化攻击

  • ms17_010_eternalblue漏洞介绍:

    This module is a port of the Equation Group ETERNALBLUE exploit, part of the FuzzBunch toolkit released by Shadow Brokers. There is a buffer overflow memmove operation in Srv!SrvOs2FeaToNt. The size is calculated in Srv!SrvOs2FeaListSizeToNt, with mathematical error where a DWORD is subtracted into a WORD. The kernel pool is groomed so that overflow is well laid-out to overwrite an SMBv1 buffer. Actual RIP hijack is later completed in srvnet!SrvNetWskReceiveComplete. This exploit, like the original may not trigger 100% of the time, and should be run continuously until triggered. It seems like the pool will get hot streaks and need a cool down period before the shells rain in again. The module will attempt to use Anonymous login, by default, to authenticate to perform the exploit. If the user supplies credentials in the SMBUser, SMBPass, and SMBDomain options it will use those instead. On some systems, this module may cause system instability and crashes, such as a BSOD or a reboot. This may be more likely with some payloads.

    • EternalBlue是2017年席卷全球的WannaCry勒索病毒的罪魁祸首,是微软近些年来最为严重的远程代码执行漏洞,可以直接获得系统权限。百度上EternalBlue一般指去年爆发的WannaCry,实际上是该勒索病毒软件利用了NSA泄露的危险漏洞EternalBlue进行传播。

    • CVE ID:CVE-2017-0143

    • 原理:

      • 利用Metasploit中近期更新的针对ms17-101漏洞的攻击载荷进行攻击获取主机控制权限。
      • 利用windows系统的Windows SMB远程执行代码漏洞向Microsoft服务器消息块(SMBv1)服务器发送经特殊设计的消息,能允许远程代码执行。
    • 主要用途:

      • Windows的SMBv1、SMBv2远程溢出漏洞,对应MS17_010,主要针对445端口
    • 受影响系统版本:

      • 较广,从WindowsXP到Window
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值