When someone in accounting, legal, or leadership reports strange sent emails or unexpected MFA prompts in Microsoft 365, the reflex on many helpdesks is to reset the password and close the ticket. Ten years ago, that usually worked. Against modern Business Email Compromise (BEC) in a Microsoft 365 and Entra ID tenant, a password change on its own is not sufficient to kick an intruder out.

Consider what happens in the first few minutes after someone steals session cookies through an Adversary-in-the-Middle (AiTM) reverse proxy. Active browser and desktop sessions keep running right past a password reset. Within minutes of landing, it is not unheard of for an attacker to enroll a second Authenticator app, grant Mail.ReadWrite permissions to a rogue multi-tenant OAuth app, and create a hidden MAPI inbox rule that sweeps any reply mentioning "wire" straight into RSS Subscriptions. Reset the password alone, and every one of those footholds stays behind.

How you clean the account up matters as well—specifically, the order you work in. Delete a suspicious inbox rule or rogue MFA device before exporting its metadata, and you have just erased the timestamps legal counsel and cyber insurance will ask for tomorrow. Revoke tokens while sign-in is still enabled, and an automated script has a window to mint fresh ones. The steps below walk through containment, evidence export, log scoping, and wire-fraud holds over the first ninety minutes in a commercial Microsoft 365 and Entra ID environment, assuming responder actions are authorized by your incident commander, legal counsel, or insurance panel.

Block Sign-In, Revoke Tokens, and Check MFA Devices

During the first 15 minutes, stick to a strict order on the identity side: block sign-in first, reset credentials second, revoke refresh and Continuous Access Evaluation (CAE) tokens third, and audit registered MFA devices fourth. Blocking the account before revoking sessions closes the race window where an active script tries to refresh its token mid-cleanup:

# Connect to Microsoft Graph PowerShell with containment and read-audit scopes
Connect-MgGraph -Scopes "User.ReadWrite.All","UserAuthenticationMethod.ReadWrite.All","Directory.AccessAsUser.All","AuditLog.Read.All"

$CompromisedUPN = "ap.controller@example.com"
$Stamp          = Get-Date -Format "yyyyMMddHHmm"
$User           = Get-MgUser -UserId $CompromisedUPN -Property Id,DisplayName,SignInSessionsValidFromDateTime

# 1. Block new Entra ID sign-ins immediately
Update-MgUser -UserId $User.Id -AccountEnabled:$false

# 2. Invalidate active refresh tokens and CAE-capable browser/desktop sessions
Revoke-MgUserSignInSession -UserId $User.Id

# 3. Export registered authentication methods to evidence file before removing rogue devices
$AuthMethods = Get-MgUserAuthenticationMethod -UserId $User.Id | ForEach-Object {
    [PSCustomObject]@{
        Id            = $_.Id
        ODataType     = $_.AdditionalProperties['@odata.type']
        CreatedDate   = $_.AdditionalProperties['createdDateTime']
        DisplayDetail = ($_.AdditionalProperties['displayName'] ?? $_.AdditionalProperties['phoneNumber'] ?? $_.AdditionalProperties['emailAddress'])
    }
}
$AuthMethods | Export-Csv -NoTypeInformation "./evidence-authmethods-$CompromisedUPN-$Stamp.csv"
$AuthMethods | Format-Table -AutoSize

Look closely at CreatedDate in that output. Attackers who steal a live session routinely head straight to mysignins.microsoft.com/security-info within two minutes of entry and register their own TOTP generator or Authenticator phone so they can approve future MFA prompts themselves. Keep the CSV export untouched for counsel and insurance review before deleting any device the employee does not recognize. If the affected person held admin rights, inspect Entra ID directory roles and Privileged Identity Management (PIM) assignments right away too.

Export and Clear Hidden Inbox Rules, Forwarding, and Delegates

Between minutes 15 and 30, move to Exchange Online. Checking rules in the standard Outlook web settings pane is not enough here, because low-level or intentionally corrupted MAPI rules created through Graph or Exchange Web Services often do not show up in the browser UI at all. Pull everything over Exchange Online PowerShell and save the full XML rule dump to disk before deleting anything:

Connect-ExchangeOnline

$CompromisedUPN = "ap.controller@example.com"
$Stamp          = Get-Date -Format "yyyyMMddHHmm"

# 1. Check mailbox-level external SMTP forwarding flags
Get-Mailbox -Identity $CompromisedUPN |
    Select-Object UserPrincipalName,ForwardingAddress,ForwardingSmtpAddress,DeliverToMailboxAndForward

# 2. Preserve full inbox rule properties (including hidden MAPI rules) BEFORE deleting anything
$Rules = Get-InboxRule -Mailbox $CompromisedUPN -IncludeHidden
$Rules | Export-Clixml -Path "./evidence-inboxrules-$CompromisedUPN-$Stamp.xml"
$Rules | Select-Object Name,Enabled,Priority,Description,MoveToFolder,DeleteMessage,ForwardTo,ForwardAsAttachmentTo,RedirectTo | Format-List

# 3. Audit FullAccess, SendAs, and SendOnBehalf delegates added during the intrusion window
Get-MailboxPermission -Identity $CompromisedUPN | Where-Object { $_.User -notlike "NT AUTHORITY\*" -and $_.IsInherited -eq $false }
Get-RecipientPermission -Identity $CompromisedUPN | Where-Object { $_.Trustee -notlike "NT AUTHORITY\*" }
Get-Mailbox -Identity $CompromisedUPN | Select-Object -ExpandProperty GrantSendOnBehalfTo

# 4. If the account held Exchange or Global Admin permissions, inspect tenant-wide transport rules
Get-TransportRule | Select-Object Name,State,WhenChanged,RedirectMessageTo,BlindCopyTo

Once the .xml snapshot is saved safely, clear out attacker-created rules with Remove-InboxRule -Mailbox $CompromisedUPN -Identity <RuleId> -Confirm:$false and strip any unauthorized ForwardingSmtpAddress or mailbox delegate.

Revoke Unauthorized OAuth Application Grants

What if sign-in is disabled and every inbox rule is gone, yet someone can still read the mailbox? Delegated OAuth 2.0 grants work that way. An application granted Mail.ReadWrite, Mail.Send, or Files.ReadWrite.All can keep polling Microsoft Graph API even while interactive user sign-ins are blocked, right up until the underlying permission grant is removed. Spend minutes 30 to 45 exporting and reviewing every grant tied to the user:

# Export delegated OAuth permission grants tied to the compromised user's Object ID
$Grants = Get-MgOauth2PermissionGrant -Filter "principalId eq '$($User.Id)'" | ForEach-Object {
    $Sp = Get-MgServicePrincipal -ServicePrincipalId $_.ClientId -ErrorAction SilentlyContinue
    [PSCustomObject]@{
        GrantId        = $_.Id
        AppDisplayName = $Sp.DisplayName
        AppId          = $Sp.AppId
        PublisherName  = $Sp.PublisherName
        Scope          = $_.Scope
    }
}
$Grants | Export-Csv -NoTypeInformation "./evidence-oauthgrants-$CompromisedUPN-$Stamp.csv"
$Grants | Format-Table -AutoSize

# After preserving evidence, revoke any unauthorized OAuth grant:
# Remove-MgOauth2PermissionGrant -OAuth2PermissionGrantId "<GrantId>"

Pay particular attention to unverified multi-tenant apps dressed up as everyday utilities, such as fake PDF viewers, eFax readers, or voicemail connectors, consented right around the first suspicious login.

Scope Exposure in Purview Unified Audit Logs

Once the intruder is out, leadership, counsel, and cyber insurers all ask the same two questions: how long were they inside, and which emails or SharePoint files did they touch? Between minutes 45 and 90, pull Unified Audit Log records in narrow date slices so large result sets do not truncate silently:

$Start = (Get-Date).AddDays(-14)
$End   = Get-Date
$Ops   = @(
    "UserLoggedIn","New-InboxRule","Set-InboxRule","UpdateInboxRules",
    "Set-Mailbox","Add-MailboxPermission","Add-RecipientPermission",
    "Consent to application","Add OAuth2PermissionGrant.",
    "FileDownloaded","FileAccessed","MailItemsAccessed","Send","SendAs"
)

Search-UnifiedAuditLog -StartDate $Start -EndDate $End -UserIds $CompromisedUPN `
    -Operations $Ops -SessionCommand ReturnLargeSet -SessionId "BEC-$Stamp" -ResultSize 5000 |
    Export-Csv -NoTypeInformation -Path "./evidence-ual-$CompromisedUPN-$Stamp.csv"

Can those logs prove whether the attacker opened a specific email thread containing W-9s or wire instructions? That depends on what licensing the tenant carried before the incident began. Microsoft Purview Audit (Standard) logs sign-ins, inbox rule edits, file downloads, sent items, and OAuth consents across standard commercial plans, whereas granular message-read records (MailItemsAccessed) and default one-year retention depend on Microsoft Purview Audit (Premium) / E5 or equivalent Defender and Purview add-ons enabled ahead of time. While searching mail logs, check whether $CompromisedUPN sent internal phishing links to coworkers in finance or HR so a second compromised account does not catch you off guard an hour later.

Freeze Exposed Wire and ACH Workflows in Parallel

Technical containment is only half of a BEC response. Someone in finance or leadership should work through these four checks during the very first hour rather than waiting for log analysis to wrap up:

Financial Control First-Hour Action
Outbound wire and ACH hold Freeze pending ACH batches, wires, and vendor or employee bank-routing changes touched by the compromised mailbox over the past 30 days until verified by phone using pre-existing directory numbers.
Recoverable Items inspection Check purged messages (Get-RecoverableItems -Identity $CompromisedUPN) to find every customer or vendor who received altered W-9 forms or substituted wire instructions.
Out-of-band customer calls Call—not email—customers with open receivables who corresponded with the hijacked mailbox so nobody wires money to an attacker drop account.
Bank recall escalation (24-48h) If funds already moved, call your originating bank's fraud desk immediately to start a NACHA reversal or SWIFT recall and file an FBI IC3 report (ic3.gov) requesting Financial Fraud Kill Chain escalation.

Close the Entry Path Before Re-Enabling Sign-In

Before flipping -AccountEnabled:$true back on, make sure the door the attacker walked through is actually shut. Block legacy authentication protocols in Conditional Access, turn off end-user OAuth self-consent for mail and file scopes, disable external auto-forwarding in Defender for Office 365 outbound spam policies, and move exposed roles onto phishing-resistant FIDO2 or passkey MFA. You can pair these steps with our incident response runbook template, or reach out to our email security and cybersecurity response engineers if you want a hand containing and hardening a tenant.