IR AnalystSwitch roles in the top navigation to see different perspectives.

Collect and analyze the Microsoft 365 Unified Audit Log (UAL) for the investigation window. The UAL captures user and admin activity across Exchange Online, SharePoint, OneDrive, Teams, Azure AD, and other M365 services.

Actions

  1. 1.Export the UAL using PowerShell for the investigation window. Note the 5000-record per query limit: `$results = Search-UnifiedAuditLog -StartDate "T_START" -EndDate "T_END" -ResultSize 5000 -SessionCommand ReturnLargeSet`. Page through all results and export to JSON for parsing.
  2. 2.Use the CISA Sparrow tool or CrowdStrike CRT (Cloud Response Tool) for automated collection: `sparrow.ps1` performs bulk UAL export, Azure AD analysis, and inbox rule enumeration.
  3. 3.Export Azure AD sign-in logs (requires P1/P2): `Get-MgAuditLogSignIn -Filter "createdDateTime ge T_START" -All | Export-Csv signins.csv`. Also export `Get-MgAuditLogDirectoryAudit` for admin activity.
  4. 4.Check for eDiscovery content searches or compliance searches created by the attacker: `Get-ComplianceSearch | Select Name, CreatedBy, CreatedTime, ContentMatchQuery` -- attackers use these to bulk-export mailbox data.
  5. 5.Export mailbox audit logs for targeted mailboxes: `Search-MailboxAuditLog -Identity compromised_user -LogonTypes Delegate,Admin,Owner -StartDate T_START -EndDate T_END -ShowDetails | Export-Csv mailbox_audit.csv`.

Queries

CloudAppEvents | where Timestamp between (datetime(T_START) .. datetime(T_END)) | where AccountObjectId == "<user_object_id>" | where ActionType in ("MailItemsAccessed","Send","SearchQueryInitiatedExchange","SearchQueryInitiatedSharePoint","FileDownloaded","FileUploaded","Set-Mailbox","New-InboxRule","Set-InboxRule","Add-MailboxPermission") | project Timestamp, ActionType, AccountDisplayName, IPAddress, RawEventData | order by Timestamp asc
AuditLogs | where TimeGenerated between (datetime(T_START) .. datetime(T_END)) | where Category in ("ApplicationManagement","UserManagement","Policy","RoleManagement") | where Result == "success" | project TimeGenerated, OperationName, InitiatedBy, TargetResources, AdditionalDetails | order by TimeGenerated desc
OfficeActivity | where TimeGenerated between (datetime(T_START) .. datetime(T_END)) | where Operation in ("New-InboxRule","Set-InboxRule","UpdateInboxRules","Add-MailboxPermission","AddFolderPermissions","Set-OwaMailboxPolicy","New-ManagementRoleAssignment") | project TimeGenerated, UserId, Operation, Parameters, ClientIP | order by TimeGenerated asc

Notes

  • The UAL has a 90-day retention window for E3 licenses and 1 year for E5. If the investigation window exceeds retention, check if Sentinel or a third-party SIEM has a copy.
  • MailItemsAccessed audit records (E5/Advanced Audit required) are the gold standard for proving whether specific emails or attachments were actually read by the attacker.

Common Blockers