MicroadsTeam Cyber by Microads, since 2015 Report an incident

Email & identity

Containing a Microsoft 365 account takeover

How to spot a Microsoft 365 account takeover, contain it in the right order, and pull the audit and sign-in logs before they age out of retention.

Someone is using one of your Microsoft 365 accounts, or you strongly suspect it. This is the order we contain a Microsoft 365 account takeover in, the signals that show how far it went, and where the evidence lives before it ages out.

What does a Microsoft 365 account takeover look like from the inside?

It rarely arrives as one clean alert. More often it’s a supplier asking why their bank details changed, a user who can’t find a reply they were expecting, or an Entra ID Protection risky sign-in that nobody looked at for three days. The individual signals are small. Together they tell a fairly consistent story.

The ones worth checking first:

  • Impossible or atypical travel. Say the user signs in from Hanoi at 09:10 and “again” from a hosting provider in Frankfurt at 09:25. Entra ID Protection reports this as atypical travel; Defender for Cloud Apps calls it impossible travel. Corporate VPNs and mobile carriers generate plenty of false positives, so look at who owns the IP and at the user agent before deciding. A cloud hosting range plus a browser string the user has never used is far more convincing than a country flag on its own.
  • Inbox rules the user didn’t write. The classic is a rule named “.” or “..” that moves anything containing “invoice”, “payment” or the finance director’s surname into RSS Feeds, Archive or Conversation History and marks it as read. The point is to hide replies from the real user while the attacker works the thread.
  • A new MFA method. An Authenticator registration or phone number added shortly after a suspicious sign-in is persistence. In the Entra audit log it shows up as “User registered security info”.
  • OAuth consent to an unfamiliar app. A consent grant with scopes like Mail.Read, Mail.Send and offline_access gives the app its own access to the mailbox. That access does not care that you reset the password.
  • Forwarding. Mailbox-level forwarding to an external address, or a rule with a forward or redirect action. Quiet, cheap, and very effective at copying out every invoice for weeks.

Field note: “But MFA was enabled” doesn’t rule anything out. Adversary-in-the-middle phishing kits proxy the real login page and steal the session cookie after the user completes MFA. In the sign-in logs, the attacker’s sessions often show “MFA requirement satisfied by claim in the token” rather than a fresh prompt.

Containment order, and why the sequence matters

An attacker with a live session, a registered MFA method and a consented app has three separate ways back in. Fix one and leave the others, and they simply use the next. So do the whole sequence in one sitting, by one admin, writing down the time of each step. Those timestamps matter later, when you’re reading logs and trying to tell attacker activity from your own.

If the account is actively sending fraudulent mail, block sign-in first (set Account enabled to No in Entra, or use Block sign-in in the Microsoft 365 admin center). Then:

  1. Revoke sessions. In the Entra admin center, open the user and choose Revoke sessions, or run Revoke-MgUserSignInSession -UserId [email protected]. This invalidates refresh tokens. Access tokens already issued can keep working until they expire, typically around an hour, unless the service supports Continuous Access Evaluation. That gap is the reason to block sign-in alongside. Microsoft’s page on revoking user access in Entra explains the token behavior in detail.
  2. Reset the password where it’s mastered. In a hybrid environment that may be on-premises Active Directory, not the cloud. Don’t send the new password to the compromised mailbox. Phone the user.
  3. Remove authentication methods you can’t verify. Under the user’s Authentication methods, go through each entry with the user on a known phone number. Anything they don’t recognize goes. If you can’t get a straight answer, remove them all and have the user re-register with the helpdesk verifying identity.
  4. Check inbox rules. Export before you delete, because the rules are evidence. Get-InboxRule -Mailbox [email protected] -IncludeHidden | Format-List Name,Enabled,Description gives you a readable list. Check Outlook on the web as well; users will sometimes swear a rule isn’t there when it is.
  5. Check forwarding. Get-Mailbox [email protected] | Format-List ForwardingSmtpAddress,ForwardingAddress,DeliverToMailboxAndForward. If the attacker had any admin rights, check mail flow (transport) rules too.
  6. Review app consents. In Enterprise applications, look at what this user has consented to, or run Get-MgUserOauth2PermissionGrant -UserId <object-id>. Remove grants that don’t belong. If the app itself is malicious, disable its service principal for the whole tenant and check who else consented.

Only then re-enable sign-in. While you’re in there, look for mailbox delegation the attacker may have added (Get-MailboxPermission) and for SharePoint or OneDrive sharing links created during the window. If the account held an admin role, stop treating this as a single-user problem and widen the scope to the whole tenant.

Reading the Unified Audit Log and sign-in logs

Two sources do most of the work. The Unified Audit Log, searchable through Microsoft Purview audit search or with Search-UnifiedAuditLog in Exchange Online PowerShell, records what was done: mailbox operations, SharePoint activity, admin changes. The Entra sign-in logs record who got in, from where, and how.

Operations worth filtering on

  • New-InboxRule, Set-InboxRule and UpdateInboxRules (the last one catches rules created from Outlook desktop)
  • Set-Mailbox for forwarding changes, Add-MailboxPermission for delegation
  • “Consent to application.” and “Add OAuth2PermissionGrant.” for app consents
  • MailItemsAccessed, if your tenant records it, for what was actually opened
  • FileDownloaded and FileAccessed in SharePoint and OneDrive

The PowerShell cmdlet returns results in pages, so for anything longer than a day or two of a busy mailbox, script it with a session ID and write to CSV rather than scrolling the portal.

What to pull from the sign-in logs

Look at both the interactive and non-interactive tabs. Token replay frequently shows up only as non-interactive sign-ins, which is exactly where people forget to look. For each suspicious entry, note the IP, user agent, client app, authentication details and Session ID. Then take the attacker’s IP addresses and search across all users. On calls like this, the second compromised account is usually found that way, not through anyone reporting it.

The question everyone wants answered is “what did they read?” That depends heavily on whether MailItemsAccessed events exist for the period. If they don’t, you may only be able to say what the attacker had access to, which matters a great deal when someone later has to decide whether this is a reportable breach. Microsoft’s guidance on responding to a compromised email account is a good checklist to keep open alongside your own notes.

How long will those logs be there?

Shorter than you’d like, and it depends on what you pay for. Audit log retention varies with the Purview audit tier your licensing includes, and Microsoft has changed the defaults more than once. Entra sign-in log retention is shorter on the free tier than on the Premium plans. Some events, detailed mailbox access among them, have historically been tied to higher license levels.

We aren’t going to quote day counts here, because they change and they differ by plan. The practical advice doesn’t change: check your tenant’s actual retention today, and in an incident, export on day one. Pull the sign-in logs and audit records for the affected users to CSV or JSON, hash the files, and store them somewhere the attacker can’t reach. Longer term, send Entra logs through diagnostic settings to a Log Analytics workspace or your SIEM, where retention is a setting you control.

Warning: Don’t delete the user or the mailbox to “clean up”. Deleted objects take their data with them on a schedule, and with it most of your ability to work out what happened.

When it’s bigger than one mailbox

Most account takeovers are a means to an end, and the end is usually invoice fraud. If money has moved or a supplier’s bank details have been “updated”, our article on containing business email compromise covers the payment side, and that’s where our business email compromise response picks up. If you see admin role changes, new app registrations with credentials, or several accounts sharing an attacker IP, treat it as a tenant-level incident. That’s the work our Microsoft 365 and cloud identity incident service is built for.

For the next ten minutes: block sign-in, revoke sessions, and export the inbox rules and whatever sign-in history your tenant still holds before you change anything else. If the account is being used against you right now, report it to our 24/7 desk or email [email protected]. Every report is acknowledged within 15 minutes.

Dealing with this right now?

A responder will acknowledge your report within 15 minutes, 24/7.

Related service: Business Email Compromise