Skip to main content
Print

How to Detect a Compromised Microsoft 365 Account

Something is off with a Microsoft 365 account and you cannot prove it yet. A vendor received an invoice from your accounting manager with new bank details she never sent. A client replies to an email that is not in Sent Items. Messages from certain people stopped arriving, or Microsoft sent an Unusual sign-in activity alert for a city no one has visited.

This guide explains how to confirm or rule out a compromised account using the evidence Microsoft 365 already records, and what to do once you know. The stakes are highest where a mailbox handles payments, patient data, or contract information.

Why This Happens

Attackers use a handful of repeatable methods, each leaving a different fingerprint in the logs.

Token theft through adversary-in-the-middle phishing

The user signs in on a proxy page that relays to the real Microsoft login and completes MFA, so the attacker receives a valid session cookie. In the logs this appears as a successful, MFA-satisfied sign-in from an IP the user has never used, often a cloud hosting range.

Password spray and credential stuffing

Attackers try common passwords against thousands of accounts, or reuse passwords leaked elsewhere. This leaves failed sign-ins with error code 50126 across many users from the same IP ranges, then one success. Legacy protocols such as IMAP and SMTP AUTH, where still enabled, bypass MFA entirely.

Consent phishing

The user is tricked into granting a third-party application permission to read mail and files. No password is stolen; the app reads the mailbox through the Microsoft Graph API indefinitely, and the logs show only a consent event.

Persistence techniques

Whatever the entry point, attackers immediately install persistence: inbox rules that hide replies, external forwarding, a new MFA method or device, or an OAuth app. These survive a password reset, and finding them confirms compromise even after the original sign-in has aged out of the logs.

How to Fix It

Method 1: Check the sign-in logs in Entra ID

  1. In the Microsoft Entra admin center (Entra ID, formerly Azure AD), go to Identity, Monitoring & health, Sign-in logs, and filter by User for the last seven days (thirty with P1 or P2).
  2. Review Location, IP address, Client app, and Status. Red flags: a success from a country or hosting provider the user does not use, distant locations minutes apart, legacy protocol sign-ins, and a non-compliant device.
  3. Open a suspicious entry and check Authentication Details. Token replay shows MFA satisfied by a claim in the token rather than a fresh prompt.
  4. With Entra ID P2, review Identity Protection, Risk detections. Anomalous token and Impossible travel are strong signals.

Method 2: Inspect the mailbox for persistence

In Exchange Online PowerShell:

Connect-ExchangeOnline
$u = "user@yourdomain.com"
Get-InboxRule -Mailbox $u | Format-List Name, Enabled, Description
Get-Mailbox $u | Format-List ForwardingAddress, ForwardingSmtpAddress, DeliverToMailboxAndForward
Get-MailboxPermission $u | Where-Object { $_.User -notlike "NT AUTHORITY\SELF" }
Get-RecipientPermission $u | Where-Object { $_.Trustee -ne "NT AUTHORITY\SELF" }
  1. Rules named with a single character, rules that move mail to RSS Feeds or Archive, and rules that mark as read and delete are almost never user-created.
  2. Any external forwarding the user did not set is conclusive, and unexpected Full Access or Send As permissions indicate a second foothold.

Method 3: Check authentication methods, devices, and app consents

  1. In the Entra admin center, open the user, then Authentication methods and Devices. Compare every phone number, authenticator, and device against what the user actually owns, and check registration dates.
  2. Go to Enterprise applications, sort by Created on, and review recent additions. Apps requesting Mail.ReadWrite or offline_access from unverified publishers are the classic consent-phishing pattern.

Method 4: Search the unified audit log

  1. In the Microsoft Purview portal, open Audit and search the past 30 days for the user with activities New-InboxRule, Set-Mailbox, Consent to application, and MailItemsAccessed.
  2. MailItemsAccessed events show which messages were opened and from what IP, the evidence needed to scope what the attacker saw.
  3. In the Microsoft Defender portal, check Incidents & alerts for alerts such as Suspicious inbox manipulation rule.

Method 5: Contain once compromise is confirmed

  1. Revoke sessions for the user in Entra, then reset the password, in that order so the attacker’s token dies first.
  2. Delete unrecognized authentication methods and devices. Remove malicious inbox rules, forwarding, and added mailbox permissions.
  3. Delete any malicious enterprise application and revoke its OAuth grants.
  4. Use Threat Explorer to purge phishing the account sent internally; notify external recipients.
  5. Document every finding with timestamps for HIPAA, CMMC, or cyber insurance reporting.

How to Verify the Fix Worked

  • Sign-in logs show only expected locations and devices for 48 hours after containment.
  • Get-InboxRule and forwarding attributes are clean, and mail from “missing” senders is arriving.
  • Authentication methods and devices match what the user physically has.
  • No new consent events or enterprise applications appear in the audit log.

If It Still Isn’t Working

If suspicious activity continues after reset and revocation, you missed a persistence mechanism. Recheck OAuth grants, Power Automate flows under the user, and Get-TransportRule, and search tenant-wide sign-in logs for the same attacker IPs.

If the logs do not go back far enough, the persistence artifacts and MailItemsAccessed events are your evidence; extend retention by streaming logs to Microsoft Sentinel. If legacy authentication is still allowed, a password spray will succeed again, so block it with Conditional Access and disable SMTP AUTH.

Stop and escalate to an incident response provider if an admin account is involved, if money moved on changed wire instructions, if regulated data was accessed, or if the same attacker is in multiple accounts. Your cyber insurance carrier will likely require a firm from their panel.

How Capital Techies Handles This for Managed Clients

For managed clients we do not wait for a vendor to report a fake invoice. Entra ID Protection forces re-authentication and session revocation on risky sign-ins, Conditional Access requires a compliant Intune-managed device so a stolen token is useless from the attacker’s machine, legacy authentication is blocked, and app consent requires admin approval. New inbox rules, forwarding changes, and unusual MFA registrations alert our security team through Microsoft Defender, with SentinelOne on the endpoint and KnowBe4 training reducing the clicks that start these incidents. When a compromise occurs, we run this investigation as a runbook and deliver a written timeline for HIPAA, CMMC, and insurance reporting.

If you are not sure who is watching your sign-in logs, contact Capital Techies about cybersecurity services before it costs you a wire transfer.

Frequently Asked Questions

What is the fastest way to tell if a Microsoft 365 account is compromised?

Check the user’s sign-in logs in the Entra admin center for successes from unfamiliar locations or hosting-provider IP ranges, then run Get-InboxRule against the mailbox. A foreign sign-in plus a rule that hides or deletes mail is close to conclusive. Both checks take under five minutes.

Can an account be compromised even with MFA turned on?

Yes. Adversary-in-the-middle phishing relays the real Microsoft login, so the user completes MFA and the attacker captures the session token. MFA fatigue, SIM swaps, and consent phishing are also common. Only phishing-resistant methods such as FIDO2 keys or Windows Hello for Business, with device-based Conditional Access, reliably stop token theft.

Do we need a paid license to see Microsoft 365 sign-in logs?

Interactive sign-in logs are available in every Entra ID tenant, retained seven days on the free tier and thirty days with Entra ID P1 or P2. Identity Protection risk detections require P2, included in Microsoft 365 E5; Business Premium includes P1. Purview audit logging is on by default for most tenants.

Related Articles

Table of Contents