How do I investigate a business email compromise in Microsoft 365?
In a business email compromise an attacker gets into a mailbox, often hides their tracks with mail rules, and uses the mailbox to read mail or cheat others. This workflow shows how to collect the Microsoft 365 logs and read them for the sign-in, the rules, the mail that was read and the changes that were made.
This workflow was written from the tools' documentation and published references. It has not yet been checked step by step on the practice data. If a step does not match what you see, please report it.
What you will be able to answer
- When and from which address the account was signed in by someone else
- Whether inbox rules or forwarding were created, and when
- Which mail was opened, searched for or sent
- Whether mailbox permissions, MFA methods or app consents were changed
- Which time window and which accounts are affected
What you need
- Written authority from the tenant owner, and an account with an audit log role (Audit Logs or View-Only Audit Logs)
- A Windows machine with PowerShell, to run the collection tools
- A clear list of the affected users and the first date of suspicion
- For practice: the public data set in the practice section
Steps
- 1
Agree scope, authority and retention
Ask who owns the tenant, who may sign in, and who handles containment. Then check the clock. Audit records are kept 180 days by default, and one year for Entra ID, Exchange and SharePoint records with E5-level licences. Entra sign-in logs in the portal were reported as kept about 30 days. Check that audit search is on in Exchange Online PowerShell. Export early, because old data disappears.
Get-AdminAuditLogConfig | Format-List UnifiedAuditLogIngestionEnabled
Your own sign-in and searches will appear in the logs too. Record the account you used and the time.
- 2
Install and connect Microsoft Extractor Suite
Microsoft Extractor Suite is a PowerShell module from Invictus IR that collects logs from Microsoft 365 and Entra ID. Install it from the PowerShell Gallery. It uses the Exchange Online, Az and Microsoft Graph modules too, so install those if they are missing. Sign in before you run its functions.
Install-Module -Name Microsoft-Extractor-Suite
Connect-M365
- 3
Pull the Unified Audit Log
Get-UAL collects the audit log. Give it the user and the date range, and keep the range wide enough to include the first suspicious sign-in. By default it writes CSV into a folder named UnifiedAuditLog. Dates without a time are taken as midnight, and times are converted to UTC. The search returns at most 5,000 records per call, so the tool splits the range and large pulls are slow.
Get-UAL -UserIds <user principal name> -StartDate <yyyy-mm-dd> -EndDate <yyyy-mm-dd>
Get-UAL -Operation New-InboxRule
Run a second pull without a user filter, for the whole tenant, to find actions by other accounts such as a new look-alike account.
- 4
Read the sign-in logs
Export the Entra ID sign-in logs with Get-GraphEntraSignInLogs. Read interactive and non-interactive sign-ins. Look at the IP address, user agent, application, device, whether MFA was applied, and whether the sign-in was flagged as risky. A sign-in from a new address, followed soon by rule changes, is a strong lead. Non-interactive sign-ins show sessions an attacker may keep using, and they are not in the audit log.
An IP address location can be wrong, especially behind a VPN or a mobile network. Use it as a clue only.
- 5
Check inbox rules and forwarding
Attackers often create rules that hide replies, move mail to rarely used folders, mark it read, or forward it. Look at the rules that exist now, including hidden ones, and at the forwarding settings of the mailbox. Odd patterns are single-character rule names, rules that move mail to RSS folders, and rules matching words such as scam, hacked or phishing. The audit log tells you when a rule was made or removed.
Get-InboxRule -Mailbox <identity> -IncludeHidden | Format-List Name,Enabled,RedirectTo,Forward*,Identity
Get-Mailbox -Identity <identity> | Format-List Forwarding*Address,DeliverTo*
These two commands are Exchange Online PowerShell. Microsoft Extractor Suite also has Get-MailboxRules to export rules.
- 6
See what the attacker read, searched and sent
In the audit log look for MailItemsAccessed, which shows mail that was opened, and SearchQuery, which shows what the attacker searched for. Also look at sent and deleted items and at mailbox permission changes. Get-MessageTraceLog lists messages sent and received. Whether MailItemsAccessed exists depends on your licence and audit settings, so check before you rely on its absence.
- 7
Analyse with Microsoft Analyzer Suite
Microsoft Analyzer Suite is a set of PowerShell scripts that read the output of Microsoft Extractor Suite. UAL-Analyzer reads the Get-UAL output, EntraSignInLogs-Analyzer reads the sign-in export and MTL-Analyzer reads the message trace. The UAL analyzer lets you give a file path or pick the file in a dialog. Its screenshots show tables, charts and statistics, such as risk levels and ATT&CK techniques for risky detections. Match the analyzer version to the extractor version.
- 8
Consider Untitled Goose Tool for wider collection
Untitled Goose Tool, from the US cyber agency CISA, collects Entra ID, Azure and Microsoft 365 data including inbox rules and the audit log. It is read-only, but setup needs a service principal with many read permissions, so the tenant owner must take part. Run goosey conf, then goosey auth, then goosey honk with a switch such as --m365 or --entraid. It writes to an output folder.
goosey conf
goosey auth
goosey honk --m365 --entraid
In its configuration, the audit log filters for operation, user and client IP cannot be used together, so run a separate pull for each.
ToolsUntitled Goose Tool - 9
Build the time line and look for persistence
Sort the key events by UTC time: first unusual sign-in, rule creation, mail opened, mail sent, permission change. Then look for ways the attacker could return: new mailbox permissions, new MFA methods, consented apps and role changes. Containment, such as disabling the account or revoking sessions, belongs to the tenant administrator. Agree the time of each action first so it is not confused with the attacker's actions.
Get-UAL can write output in a SOF-ELK format, and SOF-ELK has a microsoft365 input folder, if you want a searchable dashboard.
Where the evidence is stored
Unified Audit LogMicrosoft Purview, Exchange Online (Search-UnifiedAuditLog)Admin and user actions: rules, permissions, mail access, sign-ins to Microsoft 365
Entra ID sign-in logsEntra admin center, Graph APISign-ins with IP, application, device and MFA result, including non-interactive ones
Entra ID audit logsEntra admin center, Graph APIChanges to users, roles, apps and authentication methods
Inbox rules and forwarding settingsExchange Online mailboxRules that hide, move or forward mail, as they exist now
Message traceExchange OnlineMessages sent and received through the account
MailItemsAccessed and SearchQueryUnified Audit Log, if enabled by licence and settingsWhich mail was opened and what was searched for
Mailbox permissionsExchange OnlineOther accounts with access to the mailbox
Check your result
- Compare the IP address of a rule creation in the audit log with the sign-in in the Entra sign-in logs.
- Check each rule found in the audit log against the rules that exist in the mailbox now.
- Compare the messages the analyzers list as sent with the message trace and the Sent Items folder.
Common mistakes
- Resetting the password and revoking sessions before the logs were exported.
- Searching only the victim's account and missing actions by other accounts, such as a look-alike account.
- Mixing local time and UTC when building the time line.
- Relying on the current inbox rules and forgetting that the attacker may have deleted them.
- Reading a truncated export as complete, when the search or export limit was reached.
Write it up
A short, careful way to state this kind of finding in a report. Change the details to match your own results.
The audit log shows that at [time] UTC the account [user] created the inbox rule [rule name] from IP address [address]. The Entra sign-in log shows a sign-in at [time] UTC from the same address using [application]. The data was exported on [date] with [tool and version].
What this does not prove
- Retention depends on licence. Data older than the retention time is gone.
- The audit log holds interactive sign-ins only. Non-interactive sign-ins are in the Entra sign-in logs.
- Rules can be deleted by the attacker, so the current state of a mailbox is not the whole story. Use the audit log for history.
- IP address locations are estimates. VPNs and mobile networks make them less reliable.
- Logs show what an account did, not who was at the keyboard.
- Collection tools need the right roles and licences. Missing data may show as an empty result, not an error.
- This is cloud evidence under the tenant owner's control. Rules on access and privacy depend on your country and employer.
Practise on public data
Invictus IR: O365 Unified Audit Log dataset
Audit records from Business Email Compromise cases, in one file, auditrecords.7z (extract with 7-Zip). The README says the data is JSON or CSV, one JSON object per line, and licensed CC BY 4.0, with credit to Invictus IR. It covers inbox rule changes used for invoice fraud and mailbox permission abuse where a look-alike account was given access, and it reports that the activity comes from real incidents. The README gives no answers.
Your task. Find every New-InboxRule and rule-related record. Then find the mailbox permission changes. For each, write who did it, from which IP address and at what UTC time, and put the records in time order.
The data holds real malicious activity. Do not scan or contact the addresses in it. It is audit log data only, so the sign-in and current rule steps cannot be practiced with it.
Where to go next
- Which websites were visited on this Windows computer? Check the user's browser for the phishing page
- Who logged in to this Windows computer, and when? Check the user's Windows computer for logons
- How do I make a forensic copy of a drive and prove it is exact? Document how the exported files were stored and hashed
Sources and further reading
- Microsoft: Responding to a compromised email account
- Microsoft Purview: Search the audit log
- Pen Test Partners: BEC-ware the phish, investigating incidents in M365
- Microsoft Extractor Suite documentation
- Awesome-BEC: resources for BEC investigations
A study guide written in our own words. It is not a legal or laboratory procedure. Follow your own lab's approved method on real cases. Last reviewed 24 Nov 2026.