Forensic ArtifactCloud

M365 Unified Audit Log

The Microsoft 365 Unified Audit Log records all user and admin activities across Exchange, SharePoint, OneDrive, Teams, and Azure AD.

The Microsoft 365 Unified Audit Log is the single most important forensic artifact in any cloud-focused investigation involving Microsoft services. It provides a centralized, timestamped record of all user and administrator activities across Exchange Online, SharePoint, OneDrive, Teams, Azure AD (Entra ID), and Microsoft Purview — but with a critical constraint: retention is limited to 90 days on E3 licenses and 365 days on E5. If you are reading this during an active investigation, begin log extraction immediately.

What Is the Unified Audit Log?

The Microsoft 365 Unified Audit Log (UAL) is a centralized logging system that aggregates audit events from across the entire Microsoft 365 ecosystem. When a user reads an email, downloads a SharePoint document, creates an inbox forwarding rule, logs in from a new IP address, or grants OAuth consent to a third-party application, that action is recorded as a JSON audit event in the UAL. The log is “unified” because it consolidates events from services that previously maintained separate, incompatible audit logs into a single searchable repository.

The UAL is accessed through three primary interfaces: the Microsoft Purview Compliance Portal (GUI-based search with limited result sets), the Search-UnifiedAuditLog PowerShell cmdlet (programmable, supports pagination for bulk extraction), and the Office 365 Management Activity API (REST-based, designed for SIEM integration and continuous log streaming). For forensic investigations, the PowerShell cmdlet is the standard extraction method because it supports date-range filtering, operation-type filtering, and handles the 5,000-record per-page pagination required for comprehensive collection.

Each UAL record is a JSON object containing a standard set of fields (CreationDate, UserIds, Operations, ResultStatus, ClientIP) plus an AuditData field that contains a nested JSON payload specific to the operation type. The AuditData field is where the forensically critical detail lives — for a MailItemsAccessed event, it contains the ClientInfoString, MailboxGuid, and individual message IDs; for a FileDownloaded event, it contains the file name, site URL, source IP, and user agent string.

Key Insight

The UAL retention clock is non-negotiable: E3 tenants lose audit data after 90 days, and E5 tenants after 365 days. If the investigation concerns events that occurred more than 90 days ago on an E3 tenant without a SIEM, that data is permanently gone. The single most impactful preventive measure for any M365 environment is streaming UAL to long-term storage (Sentinel, Splunk, or even Azure Blob) before an incident occurs.

Location & Format

Access Methods

MethodInterfaceMax ResultsNotes
Purview Compliance PortalGUI (browser)50,000 per searchGood for initial triage; limited filtering; exports to CSV
Search-UnifiedAuditLogPowerShell5,000 per page (paginate for more)Standard forensic extraction method; supports date/operation filters
Management Activity APIREST APIStreaming / subscription-basedDesigned for SIEM integration; 7-day content blob availability
Microsoft SentinelKQL queriesUnlimited (within ingested data)If UAL is being ingested into Sentinel, query OfficeActivity / AuditLogs tables

Record Format

Each UAL record is a JSON object. The top-level fields are consistent across all record types:

FieldTypeForensic Value
CreationDateDateTime (UTC)Timestamp of the audited action
UserIdsString (UPN)User principal name of the actor (e.g., jdoe@contoso.com)
OperationsStringOperation name (e.g., MailItemsAccessed, FileDownloaded, New-InboxRule)
ResultStatusStringSuccess or failure indicator
AuditDataJSON (nested)Operation-specific payload containing IPs, user agents, resource identifiers, and detailed parameters

Key Operations by Service

ServiceOperationForensic Significance
ExchangeMailItemsAccessedEmail reads with Bind (specific message) or Sync (bulk folder sync); ClientInfoString identifies client type
ExchangeNew-InboxRuleInbox forwarding rules — the signature of BEC; check for ForwardTo, ForwardAsAttachmentTo, RedirectTo
ExchangeSet-MailboxMailbox delegation changes; -ForwardingSmtpAddress parameter indicates mail forwarding
ExchangeSend / SendAs / SendOnBehalfEmail sent from the compromised account; proves attacker sent messages
SharePointFileDownloadedFile downloads from SharePoint/OneDrive with filename, site URL, source IP
SharePointFileAccessedFile viewed (not downloaded); still indicates access to sensitive content
SharePointFileSyncDownloadedFullOneDrive sync client downloaded a full file; indicates sync-based exfiltration
Azure ADUserLoggedInAuthentication events with IP, user agent, conditional access result, MFA status
Azure ADConsent to applicationOAuth consent grants — critical for detecting OAuth phishing / illicit consent attacks
TeamsMemberAdded / MessageSentTeams activity; channel membership changes and message sends
PurviewDLPRuleMatchDLP policy violations; proves sensitive data was detected in transit
MailItemsAccessed: Bind vs. Sync

The MailItemsAccessed operation has two subtypes that are critical for BEC investigation. Bind means a specific email message was opened/read — the AuditData contains individual InternetMessageId values. Sync means a folder was synchronized (e.g., by Outlook or a mail client) — this generates fewer, aggregated records. The ClientInfoString field distinguishes between Client=OWA (browser), Client=Microsoft Outlook (MAPI), and Client=REST or Client=Microsoft Graph (API-based access, common in AiTM attacks). Seeing Client=REST from an IP that differs from the user’s normal pattern is a strong indicator of session token replay.

What It Reveals

The UAL provides cross-service visibility that no single endpoint artifact can match. The following investigative questions are directly answerable from UAL data:

Investigative Benchmark

In BEC investigations, the three most critical UAL operations are: New-InboxRule (proves the attacker established persistence and mail interception), MailItemsAccessed with Client=REST from a non-corporate IP (proves the attacker read emails via API), and Send operations from the compromised account (proves the attacker sent fraudulent messages). If all three are present, the BEC attack chain is fully documented.

Forensic Use Cases

1. Business Email Compromise (BEC) Investigation

The most common UAL forensic use case. An attacker compromises a user’s credentials via AiTM phishing, replays the stolen session token to access the mailbox, creates an inbox rule forwarding copies of financial correspondence to an external email address, surveys the mailbox for ongoing payment conversations, and then sends a fraudulent wire transfer instruction from the compromised account. The UAL records every step: UserLoggedIn from the attacker’s IP, New-InboxRule with ForwardTo parameter, MailItemsAccessed Bind events showing which emails were read, and Send events for the fraudulent messages.

2. OAuth Consent Phishing

The attacker sends a link that prompts the user to grant OAuth permissions to a malicious Azure AD application. Once consent is granted, the application has persistent API-level access to the user’s mailbox, calendar, and files — access that survives password changes and MFA enforcement. The UAL Consent to application event records the AppId, the permissions granted (e.g., Mail.Read, Files.ReadWrite.All), and the timestamp. Revoking the application via Remove-AzureADOAuth2PermissionGrant terminates the persistent access.

3. SharePoint/OneDrive Data Theft

An insider or compromised account downloads hundreds of files from a sensitive SharePoint site. The UAL FileDownloaded events record each file by name, site URL, and source IP. Aggregating download volume by hour reveals activity spikes that correlate with off-hours access. If the downloads occurred from an IP address that does not match the user’s known locations, or if the user agent string indicates an automated tool rather than a browser, the access is likely unauthorized.

4. Insider Threat Cross-Service Correlation

The UAL’s cross-service visibility is uniquely valuable for insider threat investigations. A single query can show that the same user account read sensitive emails (MailItemsAccessed), downloaded the attached documents from SharePoint (FileDownloaded), forwarded them to a personal email address (Send with external recipient), and then deleted the sent items (SoftDelete). No other single artifact provides this cross-service activity correlation.

5. Account Takeover Scope Assessment

After an account compromise is detected, the UAL provides rapid scope assessment. Querying all operations for the compromised UserIds during the attack window reveals exactly which services the attacker accessed, which emails they read, which files they downloaded, which rules they created, and whether they pivoted to other accounts via delegation or impersonation. This scope assessment drives the remediation plan: if the attacker only accessed email, the response is different than if they also downloaded SharePoint content and granted OAuth consent.

Acquisition Methods

Critical: Retention Deadline

UAL data is permanently deleted after the retention window (90 days E3, 365 days E5). There is no recovery mechanism. If you are investigating an incident, extract all relevant UAL data immediately. Do not wait for authorization, scope definition, or legal review if there is any risk of data aging out. Extract first, analyze later.

PowerShell — Search-UnifiedAuditLog

POWERSHELL / M365 FORENSICS
# Connect to Exchange Online
Connect-ExchangeOnline -UserPrincipalName admin@contoso.com

# Search for all activity by a specific user in a date range
# Note: Max 5,000 results per page; must paginate for full extraction
$results = @()
$sessionId = [guid]::NewGuid().ToString()
$startDate = "2026-02-01"
$endDate = "2026-03-01"
$userIds = "jdoe@contoso.com"

do {
    $batch = Search-UnifiedAuditLog `
        -StartDate $startDate `
        -EndDate $endDate `
        -UserIds $userIds `
        -SessionId $sessionId `
        -SessionCommand ReturnLargeSet `
        -ResultSize 5000
    $results += $batch
    Write-Host "Retrieved $($results.Count) records..."
} while ($batch.Count -eq 5000)

# Export to JSON for analysis
$results | ConvertTo-Json -Depth 10 | Out-File "C:\Evidence\UAL_jdoe.json"

# Export AuditData field (nested JSON) to CSV for tabular analysis
$results | ForEach-Object { $_.AuditData | ConvertFrom-Json } |
    Export-Csv "C:\Evidence\UAL_jdoe_auditdata.csv" -NoTypeInformation

PowerShell — Operation-Specific Queries

POWERSHELL / M365 FORENSICS
# Search for inbox rule creation (BEC indicator)
Search-UnifiedAuditLog -StartDate "2026-02-01" -EndDate "2026-03-01" `
    -Operations New-InboxRule,Set-InboxRule,Enable-InboxRule `
    -ResultSize 5000

# Search for MailItemsAccessed (email surveillance)
Search-UnifiedAuditLog -StartDate "2026-02-01" -EndDate "2026-03-01" `
    -Operations MailItemsAccessed `
    -UserIds "jdoe@contoso.com" `
    -ResultSize 5000

# Search for SharePoint file downloads
Search-UnifiedAuditLog -StartDate "2026-02-01" -EndDate "2026-03-01" `
    -Operations FileDownloaded `
    -ResultSize 5000

# Search for OAuth consent grants
Search-UnifiedAuditLog -StartDate "2026-02-01" -EndDate "2026-03-01" `
    -Operations "Consent to application" `
    -ResultSize 5000

Automated Extraction Tools

ToolAuthorLicenseNotes
Microsoft Extractor SuiteInvictus IROpen source (Python)Automated UAL extraction with pagination handling; also extracts Azure AD sign-in logs, mailbox rules, and OAuth apps
CrowdStrike CRTCrowdStrikeFreeCRT (Cloud Response Tool) automates M365 log collection with pre-built forensic queries
HAWKT0pCyberOpen source (PowerShell)Automated BEC investigation module; extracts inbox rules, sign-in logs, and UAL events
SparrowCISAOpen source (PowerShell)M365 compromise assessment tool; focuses on known compromise indicators

Parsing & Analysis Techniques

Parsing the AuditData JSON

The most important step in UAL analysis is correctly parsing the nested AuditData JSON field. Each record’s AuditData contains the operation-specific details that drive forensic conclusions. The top-level UAL fields (CreationDate, UserIds, Operations) provide the index; the AuditData provides the evidence.

PYTHON / UAL ANALYSIS
# Parse UAL JSON export and analyze MailItemsAccessed events

import json
import pandas as pd
from collections import Counter

with open('/evidence/UAL_jdoe.json', 'r') as f:
    records = json.load(f)

# Extract AuditData from each record
audit_data = []
for r in records:
    try:
        ad = json.loads(r['AuditData']) if isinstance(r['AuditData'], str) else r['AuditData']
        audit_data.append(ad)
    except:
        continue

df = pd.DataFrame(audit_data)

# Analyze MailItemsAccessed — identify non-corporate IPs
mail_access = df[df['Operation'] == 'MailItemsAccessed'].copy()
ip_counts = Counter(mail_access['ClientIPAddress'])
print("Top IPs accessing mailbox:")
for ip, count in ip_counts.most_common(10):
    print(f"  {ip}: {count} events")

# Identify inbox rule creation
rules = df[df['Operation'].isin(['New-InboxRule', 'Set-InboxRule'])]
for _, rule in rules.iterrows():
    params = rule.get('Parameters', [])
    print(f"Rule created at {rule['CreationTime']} from {rule.get('ClientIP', 'N/A')}")
    print(f"  Parameters: {params}")

ClientInfoString Analysis

ClientInfoString Patterns

The ClientInfoString in MailItemsAccessed events identifies the client application. Key patterns for BEC/AiTM detection:

  • Client=OWA — Outlook Web Access (browser); normal for users accessing email via browser
  • Client=Microsoft Outlook 16.0 — Desktop Outlook via MAPI; normal for corporate users
  • Client=REST;Client=RESTSystem — Microsoft Graph API access; common in AiTM token replay attacks
  • Client=CIM;Client=CIMApp — Cloud Intelligence Module; automated Microsoft scanning

Alert trigger: Client=REST or Client=Microsoft Graph from an IP that does not match the user’s normal access pattern is a high-confidence AiTM indicator.

Retention & Licensing

LicenseUAL RetentionMailItemsAccessed Available?Notes
E3 / Business Premium90 daysNo (E5/G5 only)Standard audit; does not include advanced audit events
E5 / G5365 daysYesAdvanced audit; includes MailItemsAccessed, Send, SearchQueryInitiatedExchange
E5 + 10-year retention add-on10 yearsYesMicrosoft Purview Audit (Premium) with long-term retention policies
Any license + SIEMUnlimited (in SIEM)Depends on base licenseUAL streamed to Sentinel/Splunk is retained per SIEM retention policy
License Implication

MailItemsAccessed is the single most important BEC investigation artifact, and it is only available on E5/G5 licenses. Organizations on E3 cannot determine which specific emails the attacker read. If your organization handles financial transactions and is on E3, upgrading compromised accounts to E5 after the breach does not retroactively generate MailItemsAccessed events for the attack period. This is a preventive investment, not a reactive one.

Anti-Forensics Resilience

The UAL is a cloud-hosted, Microsoft-managed audit system. It cannot be directly modified, deleted, or tampered with by tenant administrators or attackers — with important caveats.

ActionImpact on UALExplanation
Attacker clears browser/endpointNoneUAL is server-side; endpoint cleanup has no effect on cloud audit logs
Attacker deletes emailsGenerates eventsDeletions generate SoftDelete, HardDelete, or MoveToDeletedItems events in the UAL
Attacker disables mailbox auditPossible (admin)A Global Admin can disable mailbox auditing via Set-Mailbox -AuditEnabled $false; generates its own audit event
Attacker disables UALPossible (admin)A Global Admin can disable UAL via Set-AdminAuditLogConfig -UnifiedAuditLogIngestionEnabled $false; detectable in admin audit log
Retention expiryPermanent data lossAfter 90/365 days, data is permanently deleted by Microsoft; this is the primary forensic risk
Log tamperingNot possibleUAL records are immutable within the retention window; no API exists to modify or delete individual records
Anti-Forensics Reality

The greatest threat to UAL evidence is not attacker action but retention expiry. In the majority of M365 investigations we handle, the limiting factor is whether the relevant logs still exist within the retention window — not whether they were tampered with. The UAL is effectively tamper-proof for the duration of its retention period, but it is also ephemeral by design.

MITRE ATT&CK Detection Mapping

UAL data provides evidentiary support for detecting the following MITRE ATT&CK techniques:

TechniqueNameUAL Evidence
T1114 T1114Email CollectionMailItemsAccessed Bind/Sync events; inbox rule creation with ForwardTo parameter; delegate access grants
T1098 T1098Account ManipulationNew-InboxRule, Set-Mailbox forwarding changes, OAuth consent grants, mailbox delegation modifications
T1530 T1530Data from Cloud StorageFileDownloaded, FileAccessed, FileSyncDownloadedFull events in SharePoint/OneDrive
T1078 T1078Valid AccountsUserLoggedIn events with anomalous IPs, user agents, or conditional access bypass; MFA status in authentication details

Related Artifacts & Case Studies

Corroborating Artifacts

ArtifactRelationship to UALCross-Correlation Value
Azure AD Sign-in LogsDetailed authentication events with conditional access evaluation, MFA details, risk scoresSign-in logs provide richer auth detail than UAL UserLoggedIn; cross-reference for impossible-travel and MFA bypass analysis
Exchange Message TrackingSMTP-level message routing logs with sender, recipient, subject, timestampsCross-reference MailItemsAccessed InternetMessageIds with message tracking to identify exactly which emails were read
Mailbox Audit LogPer-mailbox audit events (subset of UAL data)Mailbox audit logs can be queried per-mailbox when UAL search is slow or timing out
Azure AD Audit LogsDirectory-level changes (user creation, role assignment, group membership)Detect attacker privilege escalation, persistence via new accounts, or role assignment changes
Conditional Access PoliciesPolicy evaluation results in sign-in logsIdentify which policies were evaluated and whether they were bypassed during the attack
Chrome ArtifactsBrowser history on the victim’s endpoint may show the phishing URLChrome History can identify the initial phishing URL that started the attack chain; complements server-side UAL evidence

Case Studies

DFIR Case Study — BEC Wire Fraud

BEC Wire Fraud Investigation — UAL analysis revealed an inbox forwarding rule created 72 hours before a fraudulent wire transfer instruction was sent from the compromised account. MailItemsAccessed events showed the attacker surveilled the mailbox for three days, reading emails related to an ongoing acquisition. The ClientInfoString showed Client=REST from a VPN exit node in a different country, confirming AiTM session token replay.

DFIR Case Study — CASE #214

Hybrid AiTM + Insider Threat — Cross-service UAL correlation revealed that the compromised account not only had its email surveilled but also downloaded 340 files from a restricted SharePoint site over 48 hours. The FileDownloaded events identified each file by name, and the source IPs matched the AiTM infrastructure. Without UAL’s unified view across Exchange and SharePoint, the SharePoint data theft component would have been missed entirely.

References

  1. Microsoft, “Search the audit log in Microsoft Purview” — https://learn.microsoft.com/en-us/purview/audit-log-search
  2. Microsoft, “Detailed properties in the audit log” — https://learn.microsoft.com/en-us/purview/audit-log-detailed-properties
  3. Invictus IR, “Microsoft Extractor Suite” — https://github.com/invictus-ir/Microsoft-Extractor-Suite
  4. CrowdStrike, “CRT — Cloud Response Tool” — https://github.com/CrowdStrike/CRT
  5. T0pCyber, “HAWK — Hunting Attacks in the Wild with Kinesis” — https://github.com/T0pCyber/hawk
  6. SANS Institute, “FOR509 — Enterprise Cloud Forensics and Incident Response” — https://www.sans.org/
  7. Microsoft, “MailItemsAccessed audit records” — https://learn.microsoft.com/en-us/purview/audit-mailitemsaccessed
  8. Invictus IR, “BEC Investigation Guide using M365 Unified Audit Log” — https://www.invictus-ir.com/

Mjolnir Security — Digital Forensics & Incident Response

Mjolnir Security provides 24/7 incident response, digital forensics, and expert witness testimony. Our DFIR team specializes in M365 compromise investigations, BEC response, and cloud forensics where Unified Audit Log analysis is central to determining attack scope and impact.

Digital ForensicsIncident ResponseExpert WitnessCloud ForensicsBEC InvestigationM365 Analysis

mjolnirsecurity.com — 24/7: +1 833 403 5875