Complete BEC Incident Response Playbook: First Alert to Verified Containment
Complete Microsoft 365 Business Email Compromise containment must execute six coordinated steps in order: block/reset credentials, revoke refresh tokens (Revoke-MgUserSignInSession), purge rogue MFA registrations, remove illicit OAuth consent grants, strip hidden Inbox/Transport/Forwarding rules, and export Entra + Purview UAL logs to scope email and SharePoint exposure.
Why This Artifact Matters in M365 Incident Response
A partial containment in Microsoft 365 is worse than none at all: resetting a victim’s password without revoking active refresh tokens, deleting rogue Authenticator apps, or removing illicit OAuth consents gives the intruder a false sense of urgency to pivot faster before getting locked out.
This end-to-end M365 BEC playbook orders every triage, eradication, scoping, and recovery step in strict sequence so small IT teams and enterprise SOCs close every backdoor simultaneously.
Modern cloud compromises routinely span three planes at once: Identity (Entra ID Sign-In cookies, PRT, and MFA security info), Applications (OAuth2PermissionGrants and Graph CLI apps), and Exchange/SharePoint Data (stealth Inbox Rules, SendAs, ForwardingSmtpAddress, and FileDownloaded bursts).
Merging Entra Sign-In JSON, Entra Audit JSON, and Purview UAL CSV exports inside AuditVane gives responders one unified UTC kill chain—surfacing all 12 rules (`AV-001`–`AV-012`) and generating a client-side Markdown report ready for executive briefing or cyber insurance claims.
Real-World Incident Walkthrough
A finance lead reports receiving an unexpected MFA notification followed by a strange email draft. Within 10 minutes, the responder exports 30 days of Entra Sign-In + Directory Audit JSON and 90 days of Purview UAL CSV, temporarily blocks sign-in, resets credentials, runs `Revoke-MgUserSignInSession`, and drops the raw logs into AuditVane.
AuditVane immediately uncovers the full chain: Evilginx cookie replay from Frankfurt (`AV-003`/`AV-006`), a newly registered Pixel 8 Authenticator (`AV-004`), an illicit PDF Viewer OAuth consent (`AV-005`), a mailbox keyword search for "wire" (`AV-007`), and a stealth `..` rule moving replies to RSS Feeds (`AV-001`). All five persistence doors are purged in 25 minutes.
Forensic Telemetry Fields & High-Signal Indicators
| Telemetry Field / Pattern | Meaning in M365 / Entra | High-Signal Threat Indicator |
|---|---|---|
Phase 1: Preserve Evidence | Export Entra Sign-In/Audit JSON + Purview UAL CSV | Must run before cleanup overwrites/expires logs |
Phase 2: Session Kill | Set AccountEnabled=$false or Reset + Revoke-MgUserSignInSession | Terminates AiTM & refresh-token access |
Phase 3: MFA Hygiene | Get-MgUserAuthenticationMethod | Deletes attacker phone/TOTP/Authenticator devices |
Phase 4: OAuth & App Purge | Get-MgOauth2PermissionGrant / Enterprise Apps | Kills passwordless Mail.Read API persistence |
Phase 5: Exchange Cleanup | Get-InboxRule -IncludeHidden + ForwardingSmtpAddress | Removes stealth hiding & forwarding rules |
Phase 6: Impact Scoping | MailItemsAccessed + Send + FileDownloaded + Message Trace | Determines breached emails, phishing targets & PII |
Incomplete Password Reset vs. Full Cloud BEC Containment
| Attacker Foothold | Survived Password Reset Alone? | Required Containment Action |
|---|---|---|
| Stolen AiTM Session Cookie / PRT | Yes — stays valid until refresh expiry | Revoke-MgUserSignInSession + CAE enforcement |
| Attacker Registered Authenticator App | Yes — passes new MFA challenges | Remove unrecognized method via Graph / Entra |
| Approved Third-Party OAuth App | Yes — app holds independent refresh token | Remove OAuth2PermissionGrant & ServicePrincipal |
| Stealth Inbox Rule / Forwarding | Yes — executes server-side on Exchange | Remove-InboxRule -IncludeHidden & clear ForwardingSmtpAddress |
End-to-End Multi-Stage BEC Telemetry Sequence
{
"T_00_InitialAccess": "Entra Sign-In -> Frankfurt IP 194.26.135.210 (Risk=High, UA=python-requests)",
"T_01_MFAPersistence": "Entra Audit -> User registered security info (Authenticator App - Pixel 8)",
"T_02_AppPersistence": "Entra Audit -> Consent to application (Mail.Read offline_access)",
"T_04_Recon": "Purview UAL -> SearchQueryInitiatedExchange (wire OR invoice)",
"T_06_Evasion": "Purview UAL -> New-InboxRule (MoveToFolder: RSS Feeds, MarkAsRead: True)"
}
Every phase above corresponds directly to AuditVane rules AV-003/006, AV-004, AV-005, AV-007, and AV-001—highlighting why inspecting only Exchange or only Entra leaves blind spots.
Rapid First-15-Minutes M365 Containment Script (Microsoft.Graph + Exchange)
Connect-MgGraph -Scopes "User.ReadWrite.All","UserAuthenticationMethod.ReadWrite.All","DelegatedPermissionGrant.ReadWrite.All"
$upn = "victim@domain.com"
# 1. Kill refresh tokens & inspect rogue MFA methods:
Revoke-MgUserSignInSession -UserId $upn
Get-MgUserAuthenticationMethod -UserId $upn | Format-Table Id, @{N="Type";E={$_.AdditionalProperties["@odata.type"]}}
# 2. Check Exchange rules & forwarding:
Get-InboxRule -Mailbox $upn -IncludeHidden | Format-Table Name, Enabled, MoveToFolder, DeleteMessage
Get-Mailbox -Identity $upn | Format-List ForwardingSmtpAddress, ForwardingAddress
Sample Containment Verification Output
Value
-----
True (Revoke-MgUserSignInSession succeeded)
Id Type
-- ----
3179e48a-750b-4051-897c-87b9720928f7 #microsoft.graph.microsoftAuthenticatorAuthenticationMethod <-- VERIFY!
Step-by-Step Triage, Containment & Verification
- Preserve raw telemetry first: export 30 days of Entra Interactive + Non-Interactive Sign-Ins (JSON), Entra Directory Audit (JSON), and 90+ days of Purview UAL (CSV).
- Contain the identity: reset the user’s password to a strong unique secret AND immediately run Revoke-MgUserSignInSession.
- Purge rogue MFA: list all authentication methods (`Get-MgUserAuthenticationMethod`), verify each phone/authenticator device verbally with the employee, and delete unknown entries.
- Purge OAuth grants: check `Get-MgOauth2PermissionGrant` and AuditVane AV-005 hits to delete any rogue Enterprise Applications.
- Sanitize Exchange: inspect `Get-InboxRule -IncludeHidden`, `Get-Mailbox` forwarding, `Get-MailboxPermission` delegates, and restore any emails hidden in RSS Feeds or Recoverable Items\Purges.
- Scope impact & harden: drop all logs into AuditVane, review `MailItemsAccessed`, `Send`, and `FileDownloaded`, issue vendor fraud warnings if financial threads were exposed, and migrate the user to phishing-resistant FIDO2/Passkey MFA.
How to Verify Containment Completed Cleanly
- Zero active unrecognized sessions or Non-Interactive token refreshes after containment timestamp.
- All MFA methods, OAuth grants, Inbox Rules, and Forwarding properties verified clean.
- Final post-containment UAL + Entra sweep confirms zero lingering attacker IOCs.
Analyst Blind Spots, Licensing Quirks & False Positives
Always verify verbally by phone (never via email or Teams chat on the potentially compromised tenant!) before sending bank updates or confirming MFA devices with an affected employee.
Remember that `Revoke-MgUserSignInSession` invalidates refresh tokens immediately, while short-lived access tokens may persist up to 60 minutes unless Continuous Access Evaluation (CAE) revokes them instantly.
Frequently Asked Questions
Should I reset the password first or run Revoke-MgUserSignInSession first?
Block sign-in or reset the password first, then run Revoke-MgUserSignInSession immediately afterward so the attacker cannot use an active session during password reset.
How long does it take for session revocation to stop the attacker?
Refresh token renewal stops instantaneously; existing access tokens expire within ~60 minutes (or minutes under CAE-capable Exchange/Graph).
Can AuditVane produce an incident report for management or insurers?
Yes—click Export Markdown Report or Export IOCs JSON after analyzing the merged Entra and Purview logs.
What is the most common persistence method missed after password reset?
Illicit OAuth app consents (`Mail.Read`) and rogue secondary Authenticator app registrations.