Microsoft 365 User Enumeration

Microsoft 365 and Entra ID respond differently to valid and invalid usernames, so anyone on the internet can confirm which email addresses are real accounts.

SeverityMedium
CVSS 3.15.3 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N Open in the calculator
CVSS 4.06.9 CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N Open in the calculator
CWECWE-204: Observable Response Discrepancy
MITRE ATT&CKT1589.002 Email Addresses, T1110.003 Password Spraying
CategoryInformation Disclosure

Description

Several public Microsoft 365 and Microsoft Entra ID endpoints reveal, without authentication, whether a username or email address belongs to an account in the organisation's tenant. Examples include the GetCredentialType request made by the Microsoft sign-in page, which returns an IfExistsResult value; the error codes returned by sign-in and token endpoints, which differ between an unknown user (AADSTS50034) and a wrong password (AADSTS50126); requests to a user's OneDrive address, which return different responses for existing and unknown users once OneDrive has been provisioned; Autodiscover; and Microsoft Teams external search, where external access is allowed. Microsoft treats this as part of how the service works, and tenants cannot switch most of it off.

An unauthenticated attacker can use these responses to confirm which staff email addresses are valid accounts, and from them the username format. The list itself discloses little, but it makes password spraying, credential stuffing with leaked passwords and targeted phishing more efficient, because effort is spent only on real accounts. The risk therefore depends mostly on the controls that protect the accounts: where every account requires multifactor authentication and legacy authentication is blocked, a valid username gives the attacker little; where some accounts can sign in with a password alone, it brings account compromise closer.

The weakness is identified by submitting known valid and invalid addresses and comparing the responses, manually or with tools such as o365spray, TeamFiltration or AADInternals, and is usually combined with names gathered from public sources to build a list of valid accounts. Username enumeration in the organisation's own web applications is reported separately.

Remediation

The behaviour cannot be removed entirely, so the aim is to make a list of valid usernames of little use to an attacker:

  • Require multifactor authentication for every account through Conditional Access or security defaults, preferring phishing-resistant methods for administrators.
  • Block legacy authentication protocols, which cannot enforce multifactor authentication and are commonly used for password spraying.
  • Enable Microsoft Entra Password Protection with a custom banned password list containing the organisation's name and common local terms, and review the Smart Lockout settings.
  • Restrict Microsoft Teams external access to named partner domains where open federation is not needed, which removes one enumeration route.
  • Monitor sign-in logs for password spraying, such as many failed sign-ins across different accounts from the same source, and use Microsoft Entra ID Protection risk policies where licensed.
  • Disable or remove accounts that are no longer used, since they are attractive targets once enumerated.

As the enumeration itself will remain possible, confirm the remediation by checking that a password spraying test against the enumerated accounts is stopped by multifactor authentication, lockout or Conditional Access.

References


Add This Finding to Your Library

In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.

Free trial  ·  No card required

Only need the reporting? Our reporting tool is free and open source, with the same library.


More Email and DNS Findings

Every Email and DNS finding