Skip to main content
Back
IntrusionMicrosoft Entra
7 min read

Malicious OAuth apps make compromised Exchange Online tenants relay spam

Victim
Several unnamed enterprise Microsoft 365 tenants
When
not statedDisclosed Sep 22, 2022
Entry
Credential stuffing against Global Administrator accounts with no MFA, through the Azure Active Directory PowerShell application.

Per Microsoft Threat Intelligence, an actor ran credential stuffing against Global Administrator accounts that had no MFA and signed in to several enterprise Microsoft 365 tenants. In each tenant it registered a single-tenant OAuth application, consented a legacy permission for app-only access to Exchange Online PowerShell, gave the application administrator roles and added its own key or certificate. Weeks or months later the application created an inbound connector and transport rules that stripped headers, sweepstakes spam went out looking as if it came from the victims' domains, and after each wave the actor deleted the connector and the rules and kept the application. Microsoft names no victim and no tenant count.

What happened

External Parties
Bulk email services
Consumer mailboxes
Microsoft Threat Intelligence
Internet
Microsoft Entra IDaccepts the password, then the app's key
Microsoft Entra Tenant
Exchange Online
Global Administrator accounts
Malicious OAuth application
Directory role assignments
Inbound connector
Transport rules
Accepted domains

Replaying the Exchange Online OAuth spam intrusion / reported by Microsoft in September 2022

  1. 1

    Stolen passwords, no second factor

    Date not stated

    From a single IP address the actor tries known passwords against Global Administrator accounts through the Azure Active Directory PowerShell application; none of the compromised administrators has MFA, so the password alone signs in.

  2. 2

    An application of its own

    Date not stated

    In each tenant the actor registers a single-tenant application, consents a legacy Exchange Online permission, assigns it the Global Administrator and Exchange Administrator roles and adds its own key or certificate, which outlasts a password change.

  3. 3

    The tenant becomes a relay

    Weeks or months later in some tenants; dates not stated

    The application signs in app-only to Exchange Online PowerShell, creates an inbound connector and 12 transport rules that strip headers, and sweepstakes spam goes out looking as if it came from the victims' domains; Microsoft also names bulk email services outside Microsoft as a path.

  4. 4

    Clean-up, the app stays

    After each wave; dates not stated

    After each wave the actor deletes the connector and the transport rules and keeps the application for the next wave, sometimes months later.

Impact

The victims' Exchange Online tenants passed spam that looked as if it came from their domains, in waves. No credential phishing or malware was found, and Microsoft took the applications down. The victims and the number of tenants are not stated.

Outcome

Where Microsoft Entra and Exchange Online controls fit

A Conditional Access policy that requires MFA for every administrator role would have kept a stuffed password from opening a session for the administrators inside it; emergency access accounts stay outside it and need a passkey or certificate-based authentication of their own. Administrator roles held as eligible in Privileged Identity Management would have kept a password-only session from consenting the Exchange Online permission or assigning the roles, unless the role was already active. A Conditional Access policy for workload identities that limits the tenant's service principals to your named locations would have bounded where the application's key worked. Once a connector exists, the mail it passes and the clean-up after each wave sit outside these settings. Check whether your administrators sign in with a password alone.

Could this have been prevented?

In hindsight, no control would have stopped it. 3 controls would have limited how far it went. 2 steps have no cloud-provider control. The counts below are control assessments, not attack stages: several can address the same step. The same replay with the controls in place before the incident shows where each phase would have been refused or bounded.

0
Prevented
3
Contained
2
Not covered

How it could have been prevented

The same replay with the controls in place. Green marks where a step is refused, blue where it is bounded, and red where no control reaches it. Open a row to read the control, why it acts, and its caveat.

External Parties
Bulk email services
Consumer mailboxes
Microsoft Threat Intelligence
Internet
Microsoft Entra IDaccepts the password, then the app's key
Microsoft Entra Tenant
Exchange Online
Global Administrator accounts
Malicious OAuth application
Directory role assignments
Inbound connector
Transport rules
Accepted domains

Replaying the Exchange Online OAuth spam intrusion / reported by Microsoft in September 2022

1 · Stolen passwords, no second factor

1 Contained3 on other clouds

2 · An application of its own

1 Contained3 on other clouds

3 · The tenant becomes a relay

1 Contained1 Not covered

4 · Clean-up, the app stays

1 Not covered

Key facts

  • Microsoft Threat Intelligence published its account on September 22, 2022 and updated it on September 23 to say that on-premises Exchange servers were not compromised; an independent analysis on September 26 read the campaign as an Exchange Online attack
  • The actor ran credential stuffing from a single IP address against accounts with the Global Administrator role; Microsoft said the high success rate suggested previously compromised credentials, which was not confirmed
  • None of the compromised administrators had MFA enabled, and 86% of the compromised tenants had at least one administrator with a real-time high risk score in Identity Protection
  • In each tenant the actor registered a single-tenant application, consented a legacy permission for app-only Exchange Online PowerShell, assigned it the Global Administrator and Exchange Administrator roles and added its own key or certificate
  • The application created an inbound connector and 12 transport rules that removed headers; after each spam wave the actor deleted them and kept the application, in some tenants for weeks or months
  • The spam was a sweepstakes scheme that signed recipients up for paid subscriptions; no credential phishing or malware was found, and Microsoft took down the applications and notified the affected customers

Sources

Every fact in this breakdown comes from the public reporting below. The replay is a model of that reporting, not a reconstruction of the environment it describes.

  1. 1.
    Malicious OAuth applications abuse cloud email services to spread spamMicrosoft Threat Intelligence (Microsoft Security Blog) · Sep 23, 2022 · Vendor reportEntry by credential stuffing, missing MFA, Azure AD PowerShell application, app registration, legacy Exchange Online permission, admin consent, directory roles, added app credentials, dormancy, inbound connector, transport rules, spam scheme, sending infrastructure, clean-up, takedown, mitigations
  2. 2.
    Attackers Hijacked Exchange Online in Microsoft 365 Tenant to Send SpamPractical 365 · Sep 26, 2022 · ResearchReading of the permission and roles, Exchange Online scope

The estate in the replay is illustrative and drawn at the level of attack stages; the victim's real environment is not public. Verdicts describe what a control does when it is in place before the incident. They are not an assessment of the victim's security program.

More cloud attack breakdowns

All breakdowns