Skip to content
IDOR Write-up Intermediate

Azure Active Directory Exposes Internal Information

Several Azure AD APIs did not check that the caller was asking about their own tenant, so any logged-in user could query another organisation's licensing, mailbox, directory-synchronisation and technical-contact details. An attacker could use this to gather reconnaissance information such as the name of a highly privileged synchronisation account or a Global Administrator's name and phone number.

Secureworks Follow

Published on secureworks.com

Microsoft Azure Active Directory (Azure AD) is an identity and access management solution used by over 88 percent of Fortune 500 companies as of this publication. This market penetration makes Azure AD a lucrative target for threat actors.

Secureworks Counter Threat Unit (@Secureworks), on secureworks.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 11 min read.

Context

Azure Active Directory (Azure AD) is Microsoft's identity and access management solution, and by the time of this research it was used by over 88 percent of Fortune 500 companies. That market penetration makes it a valuable reconnaissance target: anything an unauthenticated or low-privileged party can learn about a tenant feeds directly into social engineering, phishing and brute-force campaigns.

Secureworks Counter Threat Unit (CTU) researchers analysed Azure AD tenants in the second half of 2021 and found that several APIs exposed internal information about any organisation using Azure AD. The data collected included licensing information, mailbox information and directory synchronisation status. The findings were shared with Microsoft, which applied updates automatically to all Azure AD tenants, so administrators had nothing to do. All but two issues were mitigated at the time of publication; Microsoft classified those two as "by-design". A later update in April 2022 addressed the remainder.

The two issues left open initially were:

  1. Anyone could query the directory synchronisation status, and in some scenarios Azure AD revealed the name of the high-privileged account used for synchronisation.
  2. An API could reveal internal information about the target tenant, including the technical contact's full name and phone number. That contact usually holds Global Administrator privileges.

Setup

The research is largely about APIs reachable with different levels of access, so the preconditions differ per finding.

  • Unauthenticated reconnaissance. Tools such as AADInternals gather OSINT from Azure AD through unauthenticated APIs. This covers the tenant's registered domains and their types, the tenant name and ID, and seamless single sign-on status (also known as DesktopSSO).
  • Authenticated reconnaissance. Other APIs require a login to an Azure AD tenant, but no administrator privileges: any user can query information about their own tenant.
  • The Diagnostics API. This is an undocumented API used by Microsoft's Support and Recovery Assistant (SaRA) tool to help a logged-in user diagnose problems accessing Microsoft cloud services. The relevant client version analysed in 2021 was SaRA 17.0.7.7119.4.
  • The admin centre API. This API is used by the Microsoft 365 admin centre to retrieve details about a partner's organisation. The admin centre itself is only accessible to administrators, but the API behind it did not require administrative permissions.

Finding it

The starting point was the observation that authenticated APIs, which should only describe the caller's own tenant, could in fact be pointed at any tenant. The researchers discovered authenticated APIs that could access information about any tenant, not just the authenticated user's tenant.

From there the trail led to SaRA. In 2019 the researchers observed SaRA using an analysis API endpoint, and later, in 2021, the same client using a cloudcheck endpoint instead. In both cases the client sent the logged-in user's own address as the target, and the server did not check that it matched the caller.

The third thread came from the signup and admin-centre workflow: an API used exclusively by the admin centre to look up partner details took the partner's tenant ID as input and returned organisation contact data, even for tenants with no partner relationship.

Exploitation

Step 1: unauthenticated OSINT

The Invoke-AADIntReconAsOutsider command in AADInternals returns OSINT about an organisation from unauthenticated APIs. The output lists the tenant's registered domains and types, tenant name and ID, and DesktopSSO status. This is the baseline any attacker can collect without credentials.

Step 2: authenticated OSINT

The Invoke-AADIntReconAsInsider command lists what any user can read from their own tenant through authenticated APIs, without administrator privileges. The important discovery is that the same authenticated APIs could be used against other tenants.

Step 3: understand the Diagnostics API analysis endpoint

The SaRA client talks to the analysis endpoint in a fixed sequence:

  1. A user opens SaRA, enters symptoms, and starts the diagnostic.
  2. SaRA makes an initial HTTP POST request to the analysis endpoint. The request contains an AnalyzerId and DiagnosisInfo.
  3. The response returns the SessionId to SaRA.
  4. The Diagnostics API backend starts the analyzer to explore the defined user's tenant and mailbox.
  5. SaRA uses an HTTP GET request and the SessionId to poll the analysis status.
  6. The Diagnostics API returns analysis results to SaRA.
  7. SaRA displays the results to the user.

The AnalyzerId identifies an analyzer containing the diagnostic instructions that SaRA asks the Diagnostics API to run on the user's behalf. The SaRA client source code contains the list of analyzers. The cloud-related ones are:

Identifier Name
64fc98c3-da51-41f0-9051-1fb5921deb95 TenantInfo.TenantUserInfoAnalyzer
6a60a84b-634c-4fe8-a840-ba1a44a2e6fd TenantInfo.TenantSoftwareSettingsAnalyzer
99916cd2-6bc9-44c6-b58e-0fbca87b1975 ExchangeCmdlets.ExchangeHybridTenantAnalyzer
90c40b3f-251a-4b09-a4b6-5c8d53e986d0 ExchangeCmdlets.GetMailboxAnalyzer
597b1b90-b4a8-4fa0-9ddb-dcd997f0b8c2 ExchangeCmdlets.GetUserAnalyzer
ea7e84ae-041d-4e48-a308-c76bd4f09ac2 ExchangeCmdlets.CasMailboxAnalyzer

The DiagnosisInfo structure carries the parameters passed to each analyzer. The results returned by the analysis endpoint include user information: full licensing information, Office versions enabled in the tenant, the organisation's Exchange hybrid configuration and external relationships, user mailbox information, and Messaging Application Programming Interface (MAPI) status.

Step 4: swap the target address

The SaRA client extracts the logged-in user's email address from their OAuth token and uses it as the target SmtpAddress in the DiagnosisInfo parameter. The Diagnostics API does not validate whether the SmtpAddress matches the logged-in user. By replacing the SmtpAddress with the email address of a target user, it is possible to retrieve information for any user in any tenant. If the target user does not exist but the domain is correct, the API still returns all tenant-related information.

Step 5: the analysis endpoint is fixed

The researchers reported this to Microsoft on 7 September 2021. On 22 September Microsoft responded that the issue was resolved, and the researchers confirmed two changes:

  • Access to other users' information is denied, returning a "You don't have access to given user" response.
  • All AnalyzerId values are invalidated, making the analysis endpoint obsolete, returning an "Unknown analyzer id" response.

Step 6: move to the cloudcheck endpoint

In 2021, analysis of SaRA 17.0.7.7119.4 showed the client using the cloudcheck endpoint instead of the analysis endpoint. The flow is similar:

  1. SaRA makes an initial HTTP POST request to the cloudcheck endpoint. The request contains the Symptom and Parameters details the user entered in step 1.
  2. The response returns the RequestId to SaRA.
  3. The Diagnostics API backend starts the diagnostics to explore the defined user's tenant and mailbox.
  4. SaRA uses an HTTP GET request and the RequestId to poll the analysis status.
  5. The cloudcheck endpoint returns diagnostic results to SaRA.
  6. SaRA displays the results to the user.

The SaRA client revealed symptoms that could retrieve similar diagnostic information to the analysis endpoint:

  • CasMailbox
  • DirSyncCheck
  • ExchangeHybridTenant
  • GetUserDiagnostic
  • TenantUserInfo

As with the analysis endpoint, the UserUpn and UserSMTPEmail attributes in the initial request were the same as the user principal name of the bearer token used to access the API. Replacing those values with the email address of a target user again allowed retrieval of information for other users and tenants.

After Microsoft addressed the analysis endpoint issue, the logged-in user could only retrieve CasMailbox information for users of the same tenant. All other information could still be requested from any tenant.

Step 7: directory synchronisation status

The researchers reported the cloudcheck issue on 23 September 2021. On 2 December 2021 Microsoft applied an update, and the researchers confirmed that everything except the directory synchronisation status issue was addressed. On 28 January 2022 Microsoft closed the issue as fixed, leaving the synchronisation status intact.

The synchronisation status messages are the interesting part, because one of them leaks the synchronisation account name:

Synchronisation status message Description
Directory Synchronization (or) password Synchronization is enabled for your tenant: <redacted> Directory synchronisation is enabled and working normally
Active Directory Synchronization or Password Synchronization needs to be enabled for your tenant: <redacted>. This is something your Office 365 administrator can fix. Directory synchronisation is not enabled
Your tenant <redacted> password Synchronization server hasn't successfully synchronized with Office 365 in the last three hours. The last time it synced was 9/23/2020. Directory synchronisation is enabled but has not successfully synchronised after the listed date
Your tenant <redacted> directory Synchronization server hasn't successfully synchronized with Office 365 in the last three hours. The last time it synced was 1/1/0001. Directory synchronisation is enabled but has never successfully synchronised
Your tenant <redacted> directory synchronization service account <redacted>@<redated>.onmicrosoft.com password is expiring in 11 days. This is something your Office 365 administrator can fix. Directory synchronisation is enabled and working normally, but the password of the account used for synchronisation is expiring soon

The password expiration message is the most valuable to a threat actor because it reveals the account name used for synchronisation. That account has high privileges in the target tenant: it can create, edit and delete users in all tenants, and reset users' passwords in some tenants. By default the synchronisation account's password is generated during configuration and is not set to expire. Some organisations configure the password to expire, which is what exposes the account name. The password expiration reminder can be configured to be sent 1 to 30 days before the expiration date.

Step 8: organisation information through the admin API

When a representative signs up for a new Microsoft 365 or Azure AD environment, the form collects their full name and phone number, and that person becomes the tenant's technical contact. After signup, the contact can edit their details in the Microsoft 365 admin centre; the company name and phone number are pre-populated from the original signup form.

Partner relationships are created when an Azure AD administrator in a customer organisation authorises a Microsoft business partner to access their tenant. These relationships can only be accessed through the Microsoft 365 admin centre, which only administrators can use. However, the API the admin centre uses to retrieve details about the partner's organisation does not require administrative permissions. It takes the partner's tenant ID as input.

The response contains contact data from the organisation information and signup form. After the initial signup, the first and last name can only be changed by Microsoft; those fields cannot be viewed or modified in the admin centre. The researchers verified that the API could retrieve this information for any tenant, regardless of partner status.

This was reported on 14 December 2021. On 12 January 2022 Microsoft stated that "this information is expected to be shown" and did not mitigate the issue.

Root cause

The common pattern is missing authorisation on a target identifier. The Diagnostics API accepted a SmtpAddress (analysis endpoint) or UserUpn/UserSMTPEmail (cloudcheck endpoint) supplied by the client and never checked it against the identity in the bearer token. The admin API did not require administrative permissions and returned data regardless of the tenant's partner relationship with the caller. In both cases the server trusted a client-supplied value to select whose data to return.

The synchronisation status leak is a design issue rather than a missing check: the diagnostic messages were written to be helpful to an administrator and include the synchronisation account name in the password expiration case, and that message was reachable by anyone.

Impact

A threat actor can gather a significant amount of OSINT from an Azure AD tenant. The two issues Microsoft initially left open were:

  • Synchronisation status. It reveals whether synchronisation is configured, whether it is operational, the time of the last synchronisation, and the synchronisation account's name. Attackers can use this for social engineering, leveraging the synchronisation error data, and for targeted brute-force attacks using the account name.
  • Organisation information. It could expose the name and phone number of the tenant's Global Administrator. This can be abused for social engineering, spearphishing and targeted brute-force attacks.

The Diagnostics API data is also valuable: licensing information shows which protective components the target tenant could be using, and organisational relationships identify additional individuals who could be targeted in phishing attacks to gain access to a tenant. The cross-tenant retrieval worked for any user in any tenant, and even for a non-existent user as long as the domain was correct.

Fix

Microsoft applied the following changes, automatically, to all Azure AD tenants:

  • The analysis endpoint denies access to other users' information and invalidates all AnalyzerId values, making the endpoint obsolete.
  • After the analysis endpoint fix, CasMailbox information was only retrievable for users of the same tenant, while all other information could still be requested from any tenant.
  • In the April 12, 2022 update, Microsoft reassessed the two remaining issues and the researchers verified that the synchronisation status is only visible for the user's own tenant, and that only administrators can access the admin API that exposes organisational information, which additionally no longer returns the technical contact's name.

The researchers also recommended defensive actions for tenants:

  • Ensure directory synchronisation completes within the defined timeframes to avoid exposing details in error messages. Administrators receive an email if synchronisation has not been successful in more than 24 hours, but the error message is displayed after three hours of inactivity.
  • If a synchronisation account password expiration is configured, reset the password before Azure AD displays the expiration reminder, to prevent exposure of the account name.
  • Change the details associated with the tenant to general labels such as "IT Department" rather than personally identifiable data. Some fields, such as the phone number, can be modified directly, but changing the first and last name of the technical contact requires a support request in the Azure portal.

Variants to test

  • Client-supplied target identifiers on diagnostic or support APIs. Take any endpoint that accepts an email address, UPN or tenant ID and returns data about that entity, and substitute a value from a different tenant. A positive result is data for the substituted target coming back with the caller's own token.
  • Non-existent users with a valid domain. Submit an address that does not exist but whose domain belongs to a real tenant. A positive result is tenant-level information being returned anyway.
  • Admin-centre-only APIs called without admin rights. Identify APIs used by administrative portals and call them with a low-privileged token. A positive result is a successful response containing organisation or partner data.
  • Tenant ID enumeration against partner lookups. Supply tenant IDs of organisations with no partner relationship. A positive result is contact data being returned regardless of partner status.
  • Diagnostic message content. Trigger error and status paths in synchronisation or health diagnostics and inspect the text for account names, hostnames or timestamps. A positive result is any internal identifier appearing in a message reachable by a non-administrator.
  • Deprecated endpoint identifiers. After a vendor retires an endpoint, check whether old analyzer or task identifiers still resolve on the replacement endpoint. A positive result is the old identifier being accepted or mapped to new behaviour.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 18 min read.

What happened, in plain words

Microsoft Azure Active Directory, usually shortened to Azure AD, is Microsoft's system for managing who can log in to what. Think of it as the reception desk of a large office building: it checks your badge, decides which floors you may enter, and keeps a record of who you are. Many companies use it to run their email, their file storage and their staff accounts. At the time of this research it was used by over 88 percent of Fortune 500 companies, which makes it a very attractive target for criminals: break the reception desk once and you potentially reach thousands of buildings.

A tenant is one organisation's own private slice of Azure AD. Every company that signs up gets its own tenant, with its own users, its own domains and its own settings. Tenants are supposed to be sealed off from each other.

Researchers from Secureworks Counter Threat Unit (CTU) spent the second half of 2021 looking at Azure AD tenants. They found several APIs that handed out internal information about any organisation using Azure AD. The information included which licences a company had bought, details about its mailboxes, and whether its user directory was synchronised with an on-premises system. They told Microsoft, Microsoft fixed most of it automatically for every tenant, and administrators did not have to do anything.

Two issues were left open at first. Microsoft called them "by-design", meaning the company considered the behaviour intended rather than a bug. The first let anyone ask whether directory synchronisation was switched on, and in some situations it revealed the name of the powerful account used for that synchronisation. The second could reveal internal information about a tenant, including the full name and phone number of its technical contact, a person who usually holds Global Administrator rights, the highest level of control in a tenant. A later update in April 2022 closed both.

An API, short for Application Programming Interface, is the way one piece of software asks another for something. A useful comparison is a restaurant: you do not walk into the kitchen, you tell the waiter what you want and the waiter brings it back. The API is the waiter. When a website shows you data, it is usually the website asking an API behind the scenes. If an API answers questions from people it should not answer, information leaks even though the website itself looks fine.

The starting point: what anyone can learn without logging in

Some Azure AD APIs answer questions without any login at all. Security people call this unauthenticated access: no username, no password, no badge. A tool called AADInternals collects this kind of open-source intelligence, or OSINT, which simply means information gathered from public or freely reachable sources. A tool called AADInternals gathers this kind of OSINT; its Invoke-AADIntReconAsOutsider command lists what those open APIs know about a tenant. The answer included the tenant's registered domains and their types, the tenant name and ID, and whether seamless single sign-on was enabled. Seamless single sign-on, also called DesktopSSO, is a feature that lets staff log in to Microsoft cloud services automatically when they are already logged in on a company computer.

Figure 1 shows the output of that command: a list of OSINT about an organisation, collected without any credentials. This is the baseline. Before touching anything private, an attacker can already map out a company's internet presence.

Other APIs need a login, but only an ordinary one. Any user in a tenant can query information about their own tenant without being an administrator. The Invoke-AADIntReconAsInsider command lists what such a user can read.

Figure 2 shows that output. The important discovery came next: the same logged-in APIs could be pointed at other tenants, not just the user's own. That is the difference between reading your own file and reading someone else's because the filing cabinet never checked whose name was on the request.

The Diagnostics API and the SaRA tool

Microsoft ships a tool called Support and Recovery Assistant, or SaRA, which helps a logged-in user work out why something in Microsoft's cloud services is not working. SaRA talks to an undocumented API called the Diagnostics API. Undocumented means Microsoft does not publish how it works; the researchers learned about it by watching the traffic.

In 2019 the researchers saw SaRA using one part of that API, the analysis endpoint. An endpoint is simply one address on a server that accepts a particular kind of request, like one specific counter in a large office. The conversation between the SaRA program on the user's computer and the analysis endpoint followed a fixed sequence.

Figure 3 draws that sequence. Here it is step by step:

  1. A user opens SaRA, types in their symptoms, and starts the diagnostic.

  2. SaRA sends an initial HTTP POST request to the analysis endpoint. HTTP is the language browsers and programs use to talk to web servers; a POST request is one that carries data to the server, as opposed to a GET request, which asks for something back. The request contains an AnalyzerId and DiagnosisInfo.

    Figure 4 shows that initial request. The AnalyzerId is a long code that tells the server which diagnostic recipe to run. The DiagnosisInfo is the bag of details that recipe needs.

  3. The server replies with a SessionId, a temporary ticket number for this particular diagnostic run.

  4. The Diagnostics API backend starts the analyzer, which explores the defined user's tenant and mailbox.

  5. SaRA then uses an HTTP GET request with the SessionId to poll the analysis status, meaning it keeps asking "is it done yet?" until the answer is yes.

    Figure 5 shows that poll request. The SessionId is what ties each question to the right run.

  6. The Diagnostics API returns the analysis results to SaRA.

  7. SaRA displays the results to the user.

The AnalyzerId matters because it selects which set of instructions the server will carry out on the user's behalf. The SaRA program's source code contains the full list of analyzers, and the researchers pulled out the ones related to the cloud.

Figure 6 shows a sample of those analyzer IDs and names from the source code. The cloud-related ones are listed in Table 1.

Identifier Name
64fc98c3-da51-41f0-9051-1fb5921deb95 TenantInfo.TenantUserInfoAnalyzer
6a60a84b-634c-4fe8-a840-ba1a44a2e6fd TenantInfo.TenantSoftwareSettingsAnalyzer
99916cd2-6bc9-44c6-b58e-0fbca87b1975 ExchangeCmdlets.ExchangeHybridTenantAnalyzer
90c40b3f-251a-4b09-a4b6-5c8d53e986d0 ExchangeCmdlets.GetMailboxAnalyzer
597b1b90-b4a8-4fa0-9ddb-dcd997f0b8c2 ExchangeCmdlets.GetUserAnalyzer
ea7e84ae-041d-4e48-a308-c76bd4f09ac2 ExchangeCmdlets.CasMailboxAnalyzer

Table 1. Cloud-related analyzers on the analysis endpoint.

The DiagnosisInfo structure is the set of parameters, the specific values, passed to each analyzer. Figure 7 lists the parameters each cloud-related analyzer uses.

Figure 7 shows the DiagnosisInfo content for each of those analyzers. The results that come back include user information: full licensing information, which Office versions are enabled in the tenant, the organisation's Exchange hybrid configuration and external relationships, user mailbox information, and Messaging Application Programming Interface (MAPI) status. MAPI is an older Microsoft protocol that mail programs use to talk to a mail server; its status tells you something about how a mailbox is set up.

Figure 8 shows the kind of information the analysis endpoint returned. For an attacker this is a shopping list: licensing tells you which protective products a company might be running, and external relationships name other organisations and people who could be approached in a phishing campaign, a fake message designed to trick someone into handing over access.

The flaw: trusting the address the client sends

To know whose mailbox to look at, SaRA takes the logged-in user's email address from their OAuth token and puts it into the DiagnosisInfo parameter as the target SmtpAddress. An OAuth token is a small piece of data issued after a successful login that proves who you are for a while, like a wristband at an event: you show it instead of your ID every time. SMTP address is simply the technical name for an email address.

Figure 9 shows the OAuth token used for the Diagnostics API. The problem is what happened next: the Diagnostics API did not check whether the SmtpAddress in the request matched the user the token belonged to. It just used whatever address it was given. By replacing that address with the email address of a target user, it was possible to retrieve information for any user in any tenant. Even stranger, if the target user did not exist but the domain was correct, the API still returned all the tenant-related information.

This is an authorisation failure, one of the most common classes of web vulnerability. Authentication asks "who are you?" and authorisation asks "are you allowed to do this?". Here the server did the first and skipped the second. It is the difference between a hotel checking your key card at the front door and then letting you into every room because you asked politely.

The analysis endpoint gets fixed

The researchers reported this to Microsoft on 7 September 2021. On 22 September Microsoft replied that the issue was resolved, and the researchers confirmed two changes:

  • Access to other users' information was denied, with the response "You don't have access to given user".

    Figure 10 shows that refusal message.

  • All AnalyzerId values were invalidated, which made the analysis endpoint obsolete, with the response "Unknown analyzer id".

    Figure 11 shows that second refusal. Invalidating the IDs is like changing every lock in the building: even someone holding an old key gets nowhere.

The cloudcheck endpoint takes over

In 2021 the researchers analysed SaRA version 17.0.7.7119.4 and found the program now using a different endpoint, called cloudcheck, instead of the analysis endpoint. The flow looked very similar.

Figure 12 draws the cloudcheck process. Step by step:

  1. A user opens SaRA, enters symptoms, and starts the diagnostic.

  2. SaRA sends an initial HTTP POST request to the cloudcheck endpoint.

    Figure 13 shows that initial request. This time it carries Symptom and Parameters details, the things the user typed in step 1.

    Figure 14 shows the information sent to the cloudcheck endpoint.

  3. The response returns a RequestId to SaRA.

    Figure 15 shows that initial response. The RequestId plays the same role the SessionId played before: a ticket number for this run.

  4. The Diagnostics API backend starts the diagnostics to explore the defined user's tenant and mailbox.

  5. SaRA uses an HTTP GET request and the RequestId to poll the analysis status.

    Figure 16 shows that poll request.

  6. The cloudcheck endpoint returns diagnostic results to SaRA.

  7. SaRA displays the results to the user.

The SaRA client contained several symptoms that could pull back similar diagnostic information to the old analysis endpoint:

  • CasMailbox
  • DirSyncCheck
  • ExchangeHybridTenant
  • GetUserDiagnostic
  • TenantUserInfo

Figure 17 lists the parameters used by the DirSyncCheck symptom.

Figure 17 shows those parameter values. As before, the UserUpn and UserSMTPEmail attributes in the initial request were the same as the user principal name of the bearer token used to reach the API. A user principal name is the login name in email form, and a bearer token is a token that the server accepts simply because the caller presents it, like a cloakroom ticket: whoever holds it gets the coat. Replacing those values with the email address of a target user again allowed retrieval of information for other users and tenants.

After Microsoft fixed the analysis endpoint, a logged-in user could only retrieve CasMailbox information for users of the same tenant. All the other information could still be requested from any tenant.

The directory synchronisation status leak

The researchers reported the cloudcheck issue on 23 September 2021. On 2 December 2021 Microsoft applied an update, and the researchers confirmed that everything except the directory synchronisation status issue had been addressed. On 28 January 2022 Microsoft closed the issue as fixed, leaving the synchronisation status intact.

Directory synchronisation is the process that copies user accounts from a company's own servers into Azure AD so that one set of accounts works everywhere. It needs a dedicated account with high privileges to do the copying. The status messages about that process are the interesting part, because one of them leaks the synchronisation account's name.

Synchronisation status message Description
Directory Synchronization (or) password Synchronization is enabled for your tenant: <redacted> Directory synchronisation is enabled and working normally
Active Directory Synchronization or Password Synchronization needs to be enabled for your tenant: <redacted>. This is something your Office 365 administrator can fix. Directory synchronisation is not enabled
Your tenant <redacted> password Synchronization server hasn't successfully synchronized with Office 365 in the last three hours. The last time it synced was 9/23/2020. Directory synchronisation is enabled but has not successfully synchronised after the listed date
Your tenant <redacted> directory Synchronization server hasn't successfully synchronized with Office 365 in the last three hours. The last time it synced was 1/1/0001. Directory synchronisation is enabled but has never successfully synchronised
Your tenant <redacted> directory synchronization service account <redacted>@<redated>.onmicrosoft.com password is expiring in 11 days. This is something your Office 365 administrator can fix. Directory synchronisation is enabled and working normally, but the password of the account used for synchronisation is expiring soon

Table 2. Directory synchronisation status messages.

The password expiration message is the most valuable to a threat actor, because it reveals the account name used for synchronisation. That account has high privileges in the target tenant: it can create, edit and delete users in all tenants, and reset users' passwords in some tenants. By default the synchronisation account's password is generated during configuration and is not set to expire. Some organisations configure the password to expire, and that is exactly what exposes the account name. The password expiration reminder can be configured to be sent 1 to 30 days before the expiration date.

Think of it as a helpful sign on the front door saying "the master key for this building belongs to janitor.smith and it expires in 11 days". The sign was written to help the building manager, but anyone walking past could read it.

Organisation information through the admin API

When a representative signs up for a new Microsoft 365 or Azure AD environment, the signup form collects their full name and phone number, and that person becomes the tenant's technical contact.

Figure 18 shows the Office 365 signup form. After signing up, the contact can edit their details in the Microsoft 365 admin centre, the web console where administrators manage the tenant. The company name and phone number are pre-populated from the original signup form.

Figure 19 shows the organisation information in the admin centre.

Microsoft business partners offer services to customer organisations that use Microsoft cloud services. An Azure AD administrator in a customer organisation can authorise a partner to access their tenant, which creates a partner relationship in the customer's tenant. These partner relationships can only be accessed through the Microsoft 365 admin centre, and only administrators can use the admin centre.

The researchers found an API used by the admin centre to retrieve details about a partner's organisation. Although the API is used exclusively by the admin centre, it did not require administrative permissions to be accessed. It takes the partner's tenant ID as input.

Figure 20. Admin API request for partner details. (Source: Secureworks)

The response contains contact data from the organisation information and signup form. After the initial signup, the first and last name can only be changed by Microsoft; those fields cannot be viewed or modified in the admin centre.

Figure 21 shows the partner information returned by the admin API. The researchers verified that this API could retrieve this information for any tenant, regardless of whether that tenant had a partner relationship at all. They reported it on 14 December 2021. On 12 January 2022 Microsoft stated that "this information is expected to be shown" and did not mitigate the issue.

Why it worked

The common pattern is missing authorisation on a target identifier. The Diagnostics API accepted a SmtpAddress on the analysis endpoint, or UserUpn and UserSMTPEmail on the cloudcheck endpoint, supplied by the client, and never checked it against the identity in the bearer token. The admin API did not require administrative permissions and returned data regardless of the tenant's partner relationship with the caller. In both cases the server trusted a value the client chose to decide whose data to return.

The synchronisation status leak is a design issue rather than a missing check. The diagnostic messages were written to be helpful to an administrator and include the synchronisation account name in the password expiration case, and that message was reachable by anyone.

What an attacker could do with it

A threat actor can gather a significant amount of OSINT from an Azure AD tenant. The two issues Microsoft initially left open were:

  • Synchronisation status. It reveals whether synchronisation is configured, whether it is operational, the time of the last synchronisation, and the synchronisation account's name. Attackers can use this for social engineering, manipulating people rather than machines, by leaning on the synchronisation error data, and for targeted brute-force attacks, trying many passwords against a known account name, using that name.
  • Organisation information. It could expose the name and phone number of the tenant's Global Administrator. This can be abused for social engineering, spearphishing, a phishing message aimed at a specific person, and targeted brute-force attacks.

The Diagnostics API data is valuable too: licensing information shows which protective components the target tenant could be using, and organisational relationships identify additional individuals who could be targeted in phishing attacks to gain access to a tenant. The cross-tenant retrieval worked for any user in any tenant, and even for a non-existent user as long as the domain was correct.

The fix

Microsoft applied the following changes automatically to all Azure AD tenants:

  • The analysis endpoint denies access to other users' information and invalidates all AnalyzerId values, making the endpoint obsolete.
  • After the analysis endpoint fix, CasMailbox information was only retrievable for users of the same tenant, while all other information could still be requested from any tenant.
  • In the 12 April 2022 update, Microsoft reassessed the two remaining issues. The researchers verified that the synchronisation status is only visible for the user's own tenant, and that only administrators can access the admin API that exposes organisational information, which additionally no longer returns the technical contact's name.

The researchers also recommended defensive actions for tenants:

  • Ensure directory synchronisation completes within the defined timeframes to avoid exposing details in error messages. Administrators receive an email if synchronisation has not been successful in more than 24 hours, but the error message is displayed after three hours of inactivity.
  • If a synchronisation account password expiration is configured, reset the password before Azure AD displays the expiration reminder, to prevent exposure of the account name.
  • Change the details associated with the tenant to general labels such as "IT Department" rather than personally identifiable data. Some fields, such as the phone number, can be modified directly, but changing the first and last name of the technical contact requires a support request in the Azure portal.

Patterns worth testing elsewhere

These are the general lessons, written so that someone testing another product can reuse them:

  • Client-supplied target identifiers on diagnostic or support APIs. Take any endpoint that accepts an email address, UPN or tenant ID and returns data about that entity, and substitute a value from a different tenant. A positive result is data for the substituted target coming back with the caller's own token.
  • Non-existent users with a valid domain. Submit an address that does not exist but whose domain belongs to a real tenant. A positive result is tenant-level information being returned anyway.
  • Admin-centre-only APIs called without admin rights. Identify APIs used by administrative portals and call them with a low-privileged token. A positive result is a successful response containing organisation or partner data.
  • Tenant ID enumeration against partner lookups. Supply tenant IDs of organisations with no partner relationship. A positive result is contact data being returned regardless of partner status.
  • Diagnostic message content. Trigger error and status paths in synchronisation or health diagnostics and inspect the text for account names, hostnames or timestamps. A positive result is any internal identifier appearing in a message reachable by a non-administrator.
  • Deprecated endpoint identifiers. After a vendor retires an endpoint, check whether old analyzer or task identifiers still resolve on the replacement endpoint. A positive result is the old identifier being accepted or mapped to new behaviour.

Glossary

  • API (Application Programming Interface): the way one piece of software asks another for data or an action, like a waiter carrying your order to the kitchen.
  • Authentication: proving who you are, usually with a password or a token.
  • Authorisation: deciding whether the person who just proved who they are is allowed to do the thing they asked for.
  • Azure AD (Azure Active Directory): Microsoft's cloud service for managing user accounts, logins and access to services.
  • Bearer token: a token the server accepts simply because it is presented, without further proof of who is holding it.
  • Brute-force attack: trying many passwords or guesses until one works.
  • CasMailbox: a SaRA symptom name relating to mailbox configuration.
  • Cloudcheck endpoint: the newer Diagnostics API address used by SaRA in place of the analysis endpoint.
  • Diagnostics API: an undocumented Microsoft API used by the SaRA tool to run diagnostics.
  • Directory synchronisation: copying user accounts from a company's own servers into Azure AD so one set of accounts works everywhere.
  • DirSyncCheck: a SaRA symptom name relating to directory synchronisation status.
  • Endpoint: one specific address on a server that accepts a particular kind of request.
  • Exchange hybrid configuration: a setup where a company runs some mailboxes on its own servers and some in Microsoft's cloud.
  • GET request: an HTTP request that asks the server to return something.
  • Global Administrator: the highest level of administrative role in an Azure AD tenant.
  • HTTP: the language programs and browsers use to talk to web servers.
  • MAPI (Messaging Application Programming Interface): a Microsoft protocol mail programs use to talk to a mail server.
  • OAuth token: a piece of data issued after a successful login that proves your identity for a period of time.
  • OSINT (open-source intelligence): information gathered from public or freely reachable sources.
  • Partner relationship: a link created when a customer organisation authorises a Microsoft business partner to access its tenant.
  • Phishing: a fake message designed to trick someone into handing over access or information.
  • POST request: an HTTP request that carries data to the server.
  • SaRA (Support and Recovery Assistant): Microsoft's tool that helps a logged-in user diagnose problems with Microsoft cloud services.
  • Seamless single sign-on (DesktopSSO): a feature that logs staff in to Microsoft cloud services automatically when they are already logged in on a company computer.
  • SMTP address: the technical name for an email address.
  • Social engineering: manipulating people, rather than machines, into giving up access or information.
  • Spearphishing: a phishing message aimed at one specific person.
  • Tenant: one organisation's own private slice of Azure AD, with its own users, domains and settings.
  • User principal name (UPN): the login name in email form.
  • Unauthenticated: reachable without any login.

More by Secureworks

View all

2 more disclosed reports, best first.

More from Microsoft

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Insecure direct object reference (IDOR)

The lesson behind this report.

One user can read or change another user's data, usually by changing an identifier the server trusts without checking who is asking. One of the most paid bug classes on web programs.